Per-pixel alpha-channel, creation of

Greets, how would you create an image with a per-pixel alpha channel?
(that is, not a surface alpha-channel with SDL_SetAlpha.)
I.e. if I’ve already opened an image plus a grey-scale mask image with
SDL_image, then composited them together, how would I alter the format
to accommodate the alpha-components of the pixels?
Any links or source would be appreciated, thanks!

Mark

Greets, how would you create an image with a per-pixel alpha channel?

(that is, not a surface alpha-channel with SDL_SetAlpha.)
I.e. if I’ve already opened an image plus a grey-scale mask image with

SDL_image, then composited them together, how would I alter the format

to accommodate the alpha-components of the pixels?
Any links or source would be appreciated, thanks!

Do you want to load a greyscale image as the alpha channel of another
image? SDL has no such functionality that I’m aware of, I had to write
my own function for this :frowning:

Lic. Gabriel Gambetta
ARTech - GeneXus Development Team
ggambett at artech.com.uy> ----- Original Message -----

From: Mark Bishop [mailto:sealfin@sealfin.com]
Sent: Lunes, 13 de Octubre de 2003 03:24 p.m.
To: sdl at libsdl.org
Subject: [SDL] Per-pixel alpha-channel, creation of

Greets, how would you create an image with a per-pixel alpha channel?
(that is, not a surface alpha-channel with SDL_SetAlpha.)
I.e. if I’ve already opened an image plus a grey-scale mask image with
SDL_image, then composited them together, how would I alter the format
to accommodate the alpha-components of the pixels?
Any links or source would be appreciated, thanks!

Mark


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Greets,

Do you want to load a greyscale image as the alpha channel of another
image? SDL has no such functionality that I’m aware of, I had to write
my own function for this :frowning:
Yes; I’ve already gone through any SDL/alpha-channel-related info, and
realised I’ll need to roll a function for this.

Uint32 SDL_MapRGBA(SDL_PixelFormat *fmt, Uint8 r, Uint8 g, Uint8 b,
Uint8 a);
Simply map the color you want and use a putpixel function to place it
onto your surface.
Yes, this is pretty much the course I’m going to take - I’d just like to
know whether I need to perform any conversions on SDL_Surface->format
before the start of the SDL_MapRGBA routine, or whether SDL will realise
correctly that the surface now has a per-pixel alpha-channel?

Thanks for the help,

Mark