×

Discussion Board

Results 1 to 3 of 3

Thread: image scaling

  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    9

    image scaling

    Hi,

    How can I scale images with J2ME?

    Since the phones have different screen size, I'd like to create only
    one image, and scale it up/down.

    Is there any other way to solve this problem?

    Thanks,
    Sala

  2. #2
    Regular Contributor
    Join Date
    Mar 2003
    Location
    Irving, Texas, USA
    Posts
    419

    RE: image scaling

    Hello,

    There are no routines to scale images. Anyway you should create separate images (especially full screen images) separately to each device Series. This way they you get best results.

    In some games it might be ok to create graphics dynamically using drawing primitives (drawLine, fillArc, etc), but in most of cases the images should be created specifically for each device.

    That shouldn't be too hard task as there are currently only few different (Nokia) categories:
    - Series 30 bw & color
    - Series 40 color
    - Series 60 color

    Regards,

    Petteri / Forum Nokia

  3. #3
    Regular Contributor
    Join Date
    Mar 2003
    Location
    Helsinki.FI
    Posts
    112

    RE: image scaling

    Salamon,

    unfortunately there is no way of scaling images other than programmatically by yourself by usin Nokia UI API.

    Different UI categories and display features surely bring on several challenges and here's a couple of solutions for this issue:

    1) Different image for different platforms in the same JAR size
    Pros:
    + Always 100% the desired result
    Cons:
    - JAR size skyrockets (not a problem in Series 60, but other UI platforms will not bend to this)

    2) Different JAR versions for different UI platforms
    Pros:
    + Always 100% the desired result
    + Possibility to customize things for different UI platforms
    Cons:
    - Different files for different UI categories is always a very bad idea from the end user point of view

    3) One big image for all UI platforms and showing only some part (= screen size) of it on screen
    Pros:
    + Only one image file required for all UI platforms
    Cons:
    - Big image uses up more heap memory (a serious problem with color screen phones!)
    - May not always be suitable to the programmer's needs

    4) Draw the image yourself with MIDP (and/or Nokia UI API) methods
    Pros:
    + Uses significantly less heap memory (a major plus)
    Cons:
    - Does not certainly look as good as drawn images without huge programming

    Personally thinking, I would consider either option 2 or 3, depending on the use of image. 4-way scrolling shooters with a scrolling background will require certainly alternative 2 and static background or transition screens for your games obviously require either alternative 3 or 4. For example, I have been using alternative 4 in my tank game project i.e. bringing the good old vector graphics back to life. Alternative 1 is anyway pretty much ruled out with the exception of possibly having a 96x65 px black-and-white version of the desired image along for those black-and-white screens.

    Hope this was of any help.

    Kind regards,
    Tinke / FN

    PS. One more choice worth considering is to include a 128x128 px picture and use some suitable background colour (black in most cases) and center the image itself on the bigger (such as 176x208 px area on 7650 and so on) screen. This works amazingly well also. That way you can program your MIDlet to work also on Series 40 devices as well.
    DRINK COFFEE - Do stupid things faster with more energy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×