×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Super Contributor
    Join Date
    Apr 2007
    Posts
    2,708

    Image or Sprite, thats the problem

    Hi everyone,
    I have an application in which I get an Image from a server.
    This Image arrives in the form of an Array, which I then use to create the Image itself.
    The idea is to use this Image as a background (it may be a picture, or whatever)...
    Till now I've been using this Image to create a Sprite, which is then appended onto the LayerManager so as to becom a background...
    Now I'd like to know if there are other possibilities ? To begin with : is it necessary to create a Sprite out of this Image ?
    Is there a better (less resource-demanding way) of sending an Image from my (perl) server ?

    Right now I first have to create an array to store the received data, then I need to create an Image out of it an then create a Sprite... all this is actually pretty memory-demanding... Also for garbage collection, when is the best moment to call it ? after creating the image from the array ? or after creating the sprite ? and if I set the array to null is it possible to reuse it after receiving a new data-array ?

    Thanks in advance for any tips, hints and reactions

  2. #2
    Super Contributor
    Join Date
    Jun 2007
    Location
    Mumbai
    Posts
    539

    Re: Image or Sprite, thats the problem

    Well, seeing ur query i looked into API's well i havent tried this but there is one more way in which case u r not needed to create Sprite out of image... wat u can do is, if u have ur background layer, getGraphics() for that image,then u can set it on background using Layer.paint(Graphics g).

    Prakash

  3. #3
    Super Contributor
    Join Date
    Apr 2007
    Posts
    2,708

    Re: Image or Sprite, thats the problem

    hhmm... dont get that....
    are u saying to use the paint method instead of a layer ?
    or using the paint method and a layer ? cause that would kinda be double work ?
    Anyways thanks for taking time to help me

  4. #4
    Regular Contributor
    Join Date
    Jul 2007
    Location
    Malaysia
    Posts
    126

    Re: Image or Sprite, thats the problem

    Quote Originally Posted by Tiger79 View Post
    Hi everyone,
    I have an application in which I get an Image from a server.
    This Image arrives in the form of an Array, which I then use to create the Image itself.
    The idea is to use this Image as a background (it may be a picture, or whatever)...
    Till now I've been using this Image to create a Sprite, which is then appended onto the LayerManager so as to becom a background...
    Now I'd like to know if there are other possibilities ? To begin with : is it necessary to create a Sprite out of this Image ?
    Is there a better (less resource-demanding way) of sending an Image from my (perl) server ?

    Right now I first have to create an array to store the received data, then I need to create an Image out of it an then create a Sprite... all this is actually pretty memory-demanding... Also for garbage collection, when is the best moment to call it ? after creating the image from the array ? or after creating the sprite ? and if I set the array to null is it possible to reuse it after receiving a new data-array ?

    Thanks in advance for any tips, hints and reactions
    Hi there,

    Download the documentation and source codes from this example SheepDog game:

    http://sw.nokia.com/id/748737bb-3d12...de_v2_0_en.zip

    Here it explains all you wanted as above.

    Have fun and play the game.

  5. #5
    Super Contributor
    Join Date
    Jun 2007
    Location
    Mumbai
    Posts
    539

    Re: Image or Sprite, thats the problem

    Quote Originally Posted by Tiger79 View Post
    hhmm... dont get that....
    are u saying to use the paint method instead of a layer ?
    or using the paint method and a layer ? cause that would kinda be double work ?
    Anyways thanks for taking time to help me
    Well I am not asking u to use paint, look into api's u can get the Graphic of an Image, and then call javax.microedition.lcdui.game.Layer.paint(Graphics g) with ur object of Background Layer and passing that Image Graphics as prameter. The method will paint the Graphics on that layer.

    Prakash

  6. #6
    Super Contributor
    Join Date
    Apr 2007
    Posts
    2,708

    Re: Image or Sprite, thats the problem

    Quote Originally Posted by tony_ysy View Post
    Hi there,

    Download the documentation and source codes from this example SheepDog game:

    http://sw.nokia.com/id/748737bb-3d12...de_v2_0_en.zip

    Here it explains all you wanted as above.

    Have fun and play the game.
    yeah The Sheepdog MIDlet I allready knew, funny game that is :P only problem is that they use it as an example for a TiledLayer background which I actually dont use... I have one big Image which I want to use as a Background... I noticed that the array containing the Imge is about 6000 elements, but when te Image is created it can take up to 300kb of memory !!!
    But now another question arises :P Can I use TiledLayer for a big Image ? I tried (Image is 200x300) with a 4 by 5 array (50 by 60 pixels) but for some reason that wont work...

Similar Threads

  1. Problem Sending more than one OBEX image
    By jogissa in forum Bluetooth Technology
    Replies: 0
    Last Post: 2007-09-21, 10:10
  2. how to cut some part of Image
    By mshouab in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2006-08-04, 09:05
  3. HELP: Mutable Image to Immutable Image?
    By rj_cybersilver in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2005-03-26, 09:58
  4. 7650 Image Uploader strange problem
    By kamlesh_in in forum Symbian
    Replies: 1
    Last Post: 2003-08-25, 15:06
  5. Sprites management remarks
    By atomictag in forum Mobile Java General
    Replies: 0
    Last Post: 1970-01-01, 02:00

Posting Permissions

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