Mobile Applications and Games development
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Creating small images from set of images - problem with tran

2 posters

Go down

Creating small images from set of images - problem with tran Empty Creating small images from set of images - problem with tran

Post  javafan Sun Sep 23, 2007 11:27 pm

I have method like this:

Code:
public Image getClip(int x, int y) {
Image resultImage = Image.createImage(13, 13);
Image items = MIDlet.createImage("/items.png");
resultImage.getGraphics().drawImage(items, x, y, Graphics.TOP | Graphics.LEFT);
return resultImage;
}

and transparency of background in items.png is set correctly, but when I try to create an image for example like this:

Code:
Image item1 = getClip(0, 0);
Image item2 = getClip(-15, 0);

background is white and not transparent. Can you help me? Or maybe there is no possibility to create images with transparent background from set of images and I will have to create sprites and set proper frame?
javafan
javafan

Posts : 11
Join date : 2007-09-11

Back to top Go down

Creating small images from set of images - problem with tran Empty Re: Creating small images from set of images - problem with tran

Post  Nishtha Mon Sep 24, 2007 10:55 pm

javafan wrote:I have method like this:

Code:
public Image getClip(int x, int y) {
Image resultImage = Image.createImage(13, 13);
Image items = MIDlet.createImage("/items.png");
resultImage.getGraphics().drawImage(items, x, y, Graphics.TOP | Graphics.LEFT);
return resultImage;
}

and transparency of background in items.png is set correctly, but when I try to create an image for example like this:

Code:
Image item1 = getClip(0, 0);
Image item2 = getClip(-15, 0);

background is white and not transparent. Can you help me? Or maybe there is no possibility to create images with transparent background from set of images and I will have to create sprites and set proper frame?

Hi friend,

As per my knowledge we cannot create a transparent image using method Image.createImage becoz in this case the graphics object is always white. Try using Image.createRGBImage as i think it work for you.

Feel free to contact me for further queries.

thanks
Nishtha.

Nishtha

Posts : 25
Join date : 2007-09-09

http://sahil-bedi.blogspot.com/

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum