Jump to content

  • Log In with Google      Sign In   
  • Create Account

[java] Image.getGraphics and Component.createImage(width,height)


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 letsch   Members   -  Reputation: 122

Like
Likes
Like

Posted 27 November 2000 - 11:39 AM

Ack! I feel a bit dumb again... Why? I have an Image problem... I am creating an Applet. I need Images where I can getGraphics(). As I cannot use BufferedImage I have to use Component.creatImage(width,height). As far as I know that is the only way to create an Image where I am able to get the Graphics (is there another way?). The problem is (a) I hate the fact that the Component has to be visible (but that is not really the problem) (b) the Image I get has the background color of the Component and the alpha channel is set to NOT transparent at all © I don''t know how to create an Image or convert the one from Component.createImage(width,height) to one that is FULLY transparent, because drawImage(...) cannot make it more transparent (sounds logical) and I don''t know how to SET a pixel (d) I need an Image that is FULLY transparent. Any suggestions? Yours, Leonhard BTW, to explain what I really want to do: I want to convert an Image I download to one where I can get the Graphics - and I also need the transparency. So I tried to create a new Image with Component.createImage(...) and draw my (fully) downloaded Image onto that Image... But this way I lose transparancy and have a background color instead.

Sponsor:

#2 snowmoon   Members   -  Reputation: 122

Like
Likes
Like

Posted 27 November 2000 - 01:52 PM

You have several options here. First off you can also get an Image refrence from Toolkit.getDefaultToolkit().createImage(...); I''m not sure if they will return anything diffrent from what component does, but it''s worth a try.

Another option you have is to create a new Image producer style memory image with a SPECIFIC color model that includes alpha bits.

Hope this starts you in the right direction.

#3 letsch   Members   -  Reputation: 122

Like
Likes
Like

Posted 27 November 2000 - 07:26 PM

Thank you, but I think both options don''t work. I can only getGraphics() from an Image created with Component.createImage(), not from one that is downloaded or created with an ImageProducer. Toolkit.getDefaultToolkit().createImage(...) also uses an ImageProducer. That means I still don''t know how to create the Image I need. Thank you for your answer, Leonhard




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS