Creating small images from set of images - problem with tran

Go down

Creating small images from set of images - problem with tran

Post  javafan on 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?
avatar
javafan

Posts : 11
Join date : 2007-09-11

View user profile

Back to top Go down

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

Post  Nishtha on 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

View user profile 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