Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / June 2006

Tip: Looking for answers? Try searching our database.

Image with transparency?

Thread view: 
somewildmonkey@yahoo.com - 20 Jun 2006 23:54 GMT
Is there a way to create an Image object with transparency?  I would
like to create an instance of Image, obtain a Graphics context to it
and use operations such as fillRect(...) etc to draw onto it, using
Color values that have alpha values specified for level of
transparency.  Then I would like to overlay that image on top of an
onscreen graphics context such as a panel using draw( ...).

The only method I have found so far is to create a filter that uses an
image producer to process the original image, using a specified
transparency "key" color, and yields another Image object that posesses
transparent pixels.  However, I would like to be able to draw directly
onto the image using transparent pixel Color values.

Any advice would be appreciated.

Regards,

MB
Knute Johnson - 21 Jun 2006 01:49 GMT
> Is there a way to create an Image object with transparency?  I would
> like to create an instance of Image, obtain a Graphics context to it
[quoted text clipped - 14 lines]
>
> MB

BufferedImage supports transparency and is easy to work with.  Look at
AlphaComposite to see how to draw with transparency.
somewildmonkey@yahoo.com - 21 Jun 2006 02:49 GMT
> BufferedImage supports transparency and is easy to work with.  Look at
> AlphaComposite to see how to draw with transparency.

Thanks Knute.  I'll give BufferedImag a try.

So, for the sake of my understanding is it correct assuming that an
Image class object is not capable of supporting direct graphics calls (
drawLine, fillRect, etc ) with transparency?  

Regards,

MB
Knute Johnson - 21 Jun 2006 04:47 GMT
>> BufferedImage supports transparency and is easy to work with.  Look at
>> AlphaComposite to see how to draw with transparency.
[quoted text clipped - 8 lines]
>
> MB

No.  But unless you have to use a very old version of the JDK, you won't
want an Image, you will want a BufferedImage.  There are simple classes
to read and write them to and from files, they support multiple color
models and bit depths, you can bet the actual pixel values easily, you
life will be better when you use the BufferedImage.

Signature

Knute Johnson
email s/nospam/knute/

somewildmonkey@yahoo.com - 22 Jun 2006 01:16 GMT
Thanks again.  I used BufferedImage and got my stuff going right away
:-)


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.