This site requires JavaScript, please enable it in your browser!
Greenfoot back
Gevater_Tod4711
Gevater_Tod4711 wrote ...

2012/10/13

Problem with drawImage();

1
2
Gevater_Tod4711 Gevater_Tod4711

2012/10/13

#
Hi all, I've got a problem using the drawImage method. Sometimes when I draw a image on another image there is a white area which is not on the basic image and not on the overdrawing image. It seems that this only hapens when I overdraw with a transarent area. I think this might be a bugg in the method because there was no such color on the images and I realy don't get why it should be there after drawing it. Doe's anyone know this problem or how I can avoid it?
Game/maniac Game/maniac

2012/10/13

#
it your color method before the draw method?
Gevater_Tod4711 Gevater_Tod4711

2012/10/13

#
no there is no color method I just used this: GreenfootImge theImage = new GreenfootImage("file"); drawImage(theImage, 0, 0);
Upupzealot Upupzealot

2012/10/13

#
try to use png images which have an alpha chanel. Are you using JPEG images?
Gevater_Tod4711 Gevater_Tod4711

2012/10/13

#
no I already use png images.
erdelf erdelf

2012/10/13

#
try it with setting a color with full transparency before drawing the image
Gevater_Tod4711 Gevater_Tod4711

2012/10/13

#
no this also doesn't help. I didn't use any color before so this is not the failur I think. The transparency is only at a smal area not at the whole image and it is partly transparent so I don't think that I am drawing this.
danpost danpost

2012/10/13

#
How do you create the image that you are 'drawImage'ing onto? what are the dimensions of the two images (by name) and are you actually using (0, 0) as the location to draw the image on the other image?
Gevater_Tod4711 Gevater_Tod4711

2012/10/13

#
I'm just loading the image that I'm 'drawImage'ing using GreenfootImage image = new ... 0, 0 are the coordinates I use to draw the image on the other. I don't get what you mean with dimenstions. Do you mean .png or .jpg? (If yes: all are png's)
danpost danpost

2012/10/13

#
By dimensions, I mean what is the width and height of the image being draw, and what is the width and height of the image that is being drawn onto.
danpost danpost

2012/10/13

#
And how do you create the image that you are drawing onto? You say you create the one with GreenfootImage image = new GreenfootImage("file"); I am asking about the other image.
danpost danpost

2012/10/13

#
If you are using the background image of the world which you have cleared, then I suggest 'fill'ing it with 'Color.white' before drawing an image onto it.
Gevater_Tod4711 Gevater_Tod4711

2012/10/13

#
the other image is also loaded using new GreenfootImage("file"); the sizes of both images are 1200x700. I don't use the background for this.
davmac davmac

2012/10/14

#
Can you reproduce this reliably - could you, for instance, upload a scenario which demonstrated the problem?
Gevater_Tod4711 Gevater_Tod4711

2012/10/14

#
I'm trying to upload the szenario but this will take maybe one or two days because it's a little to big to upload it. And I've never seen such a problem with other szenarios. Last time I saw this (in the same scenario) I thought I had made a mistake with the image but now I've got the problem again with a totally other image. So I can't just upload any szenario because most time I'm doing this it works. Only in a view cases (two this time) there is this problem. I'll try to upload the scenario today.
There are more replies on the next page.
1
2