Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

invisible transparent Layers

Status
Not open for further replies.

Lupine

Programmer
Aug 3, 2000
53
US
Hello friends,

I am making (transparent) 2D sprites in adobe Image Ready
and coding using AWT(1.1) on a number of operating systems and OS's. I also have access to Java 1.3 but am avoiding using it.

My question is: how can I make transparent layers invisible
(either in Java or Adobe) and how can I make transparent layers visible (in Java 1.1 or later version if absolutely N, please specify which version you are thinking of)

here is pseudo code:

makeinvisible.Layer 6 is invisible
Load Images into buffer
paintImages

take user input
if 6=visible then
make__visible.Layer 6 is visible
Load Images into buffer
paintImages


your impressed, I can tell...:cool:



Lupine
RobertCorrina@patownsend.com

 
Java does not draw transparent regions of a GIF image - if you create your own image and paint the resource image to it first make sure it's a java.awt.image.BufferedImage with image type TYPE_INT_RGBA (A indicating "alpha" - this image contains transparecy).

For the layers: GIF has none - and if you create multiple layers by creating multiple GIFs, just don't draw the invisible ones... :eek:)

Only if you're interested in what Java 2D meanwhile really can do (while being in some, say, "protected" environment and not restricted to what nowaday's average browsers can do on the wild wild web): I'd recommend the book from Sun Series called Java 2D API Graphics - it's pretty good and also on CD has an own graphics framework (with layers and stuff). Not really cheap, but very complete and comprehensive.

But maybe I got your question all wrong...
allow thyself to be the spark that lights the fire
haslo@haslo.ch - www.haslo.ch​
 
Thank you for the part about "alpha"

I have access to that series of books, I'll check it out.

Here's the thing. I definately CAN create layers of transparency on a .gif (for whatever thats worth)

Now, from my JAVA code I must be able to turn a layer
visible or invisible. I realize that I don't understand some important facts here, but I'm thinking this is possible.

Lupine
RobertCorrina@patownsend.com

 
Like what Haslo has said, you can accomplish this using Java2d. The pseudo code for this would be:-

paint image1(with alpha value)
paint image2(with alpha value)
paint image3(with alpha value)

if I don't want to view image3, set the alpha value for it to 0

You can overlap the images since you paint using coordinates, thus creating 'layers' so by setting the alpha values for the images, you will be able to view different images.

You will only be able to accomplish this from JDK1.2 onwards.

Hope this helps,
Leon If you need additional help, you can email to me at zaoliang@hotmail.com I don't guaranty that I will be able to solve your problems but I will try my best :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top