IonicWind Software

Aurora Compiler => 2D Graphics => Topic started by: kryton9 on September 15, 2006, 03:53:35 PM

Title: layers
Post by: kryton9 on September 15, 2006, 03:53:35 PM
Does anyone have an idea of how layers, as in Photoshop, are handled?

That is, that it can have an invisible background and also the opacity of the overall layer can be adjusted separately.
In addition, you can easily change the order of the layers thus effecting their ability to appear on top of other layers.

Can this sort of thing be written in Aurora in its first Beta release?
Title: Re: layers
Post by: Parker on September 15, 2006, 04:04:29 PM
Photoshop draws the bottom layer first, and subsequent layers next. As for transparencies, if layer 2 is 50% transparent, the pixel that is shown is 50% original pixel + 50% layer 2 pixel. However you have to take into account separate red, green, and blue values. So it actually looks something like this:

output_pixel = redraw( orig_pixel, .5 ) + redraw( layer2_pixel, .5 );

redraw( pixel, percent ) =
    red( pixel ) * percent +
    green( pixel ) * percent +
    blue( pixel ) * percent;

The red(), green(), and blue() functions use bit shifts to take a certain part of the pixel out.

I don't know if this can be done natively with the 2D pak though.
Title: Re: layers
Post by: kryton9 on September 15, 2006, 04:12:27 PM
Thanks Parker for a quick reply. I know I would have to set aside memory for the resolution of the image for each layer, a screen buffer if you will. Then go through and calculate the final actual screen as you mentioned, I am not sure if this can all be done in the current version of Aurora.
Title: Re: layers
Post by: J B Wood (Zumwalt) on September 15, 2006, 04:32:15 PM
"with" Aurora and "in" Aurora are two different things, you can do anything "with" Aurora, what we can do "in" Aurora natively with built in methods is a different story
Title: Re: layers
Post by: Ionic Wind Support Team on September 15, 2006, 05:42:04 PM
Use the 3D sprite class which supports PNG transparency.

the 2D library (there are no paks here) uses DirectX 7 as the base since that is the last official DirectDraw interface that Microsoft supported.  And DX7 doesn't support hardware alpha transparency, it is all done in software.
Title: Re: layers
Post by: kryton9 on September 15, 2006, 08:21:24 PM
I thought about 3d sprites, but I need to be able to draw dynamicaly to them then. Will think about it and see if I can come up with anything.