Why should I use the alpha channel, for example, in a 32 bit pixel, if it
isn’t used when blitting (only the global alpha value for the surface is
considered, isn’t it?)? Just for when I save the surface to a file?–
Marco Iannaccone @Marco_Iannaccone
ICQ: 18748121 MetalCoder
"What is real? How do you define real? If you’re talking about your
senses, what you feel, taste, smell, or see, then all you’re talking about
are electrical signals interpreted by your brain."
Morpheus - The Matrix
Uhm… Well, you might use the alpha channel in files as a rather inefficient
way of specifying a fixed “full object” alpha in the file, but I’m not sure
why you’d want to do that. You’re probably better off storing the files with
RGB only, and then hacking in some simple “alpha editor” function in your
application to tune your alpha values. That way, you even have a chance
tuning against the actual background, rather than whatever your favourite
image manipulation tool gives you…
Alpha channels in files are for sprites with antialiazed edges and
translucency effects; not for plain alpha blending, IMHO. However, this
becomes less important with modern 3D accelerators which take less than 50%
additional time to render a full scene with RGBA blending instead of RGB, and
practically no difference between RGBA and RGB + alpha blending.
//David
.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia | ----------------------> http://www.linuxaudiodev.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |--------------------------------------> david at linuxdj.com -'On Monday 19 February 2001 17:20, Marco Iannaccone wrote:
Why should I use the alpha channel, for example, in a 32 bit pixel, if it
isn’t used when blitting (only the global alpha value for the surface is
considered, isn’t it?)? Just for when I save the surface to a file?
So you confirm that in SDL has no sense to use alpha values when drawing
pixels to surfaces?–
Marco Iannaccone @Marco_Iannaccone
ICQ: 18748121 MetalCoder
"What is real? How do you define real? If you’re talking about your
senses, what you feel, taste, smell, or see, then all you’re talking about
are electrical signals interpreted by your brain."
Morpheus - The Matrix
Uhm, not quite… An alpha channel and the single alpha value are two
different tools meant for two slightly different tasks.
An alpha channel is used when, and preferably only (for performance
reasons) when you need control over the blending of individual pixels.
Examples of such cases are sprites with “toned”, translucent windows and
sprites with antialiazed edges.
The alpha value (without an alpha channel in the image data) is used when you
want to fade an entire object in and out. An example of that would be
"ghosts" sprits of the kind seen in some SNES games; fading in and out on top
of the background graphics. You can also use it to crossfade between images.
//David
.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia | ----------------------> http://www.linuxaudiodev.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |--------------------------------------> david at linuxdj.com -'On Monday 19 February 2001 22:45, Marco Iannaccone wrote:
So you confirm that in SDL has no sense to use alpha values when drawing
pixels to surfaces?
An alpha channel is used when, and preferably only (for performance
reasons) when you need control over the blending of individual pixels.
Examples of such cases are sprites with “toned”, translucent windows and
sprites with antialiazed edges.
So if i put on the screen a pixel (32-bit) ARGB with values 128, 255, 255, 0
a yellow pixel should be drawn, but it should not be completely opaque, but
shouldbe blended with the background, isn’t it? But I always det the pixel
completely opaque…–
Marco Iannaccone @Marco_Iannaccone
ICQ: 18748121 MetalCoder
"What is real? How do you define real? If you’re talking about your
senses, what you feel, taste, smell, or see, then all you’re talking about
are electrical signals interpreted by your brain."
Morpheus - The Matrix
So if i put on the screen a pixel (32-bit) ARGB with values 128, 255, 255, 0
a yellow pixel should be drawn, but it should not be completely opaque, but
shouldbe blended with the background, isn’t it? But I always det the pixel
completely opaque…
How do you put the pixel on the screen?
Do you blend it onto the screen surface?
The alpha blending flags only affect blitting, not manually manipulating
the pixel data.
See ya,
-Sam Lantinga, Lead Programmer, Loki Entertainment Software