Mask surfaces

Hi … i have 2 bmp, 1 is the image and the other is the mask.
Does SDL havea way to blit the image using the mask bmp, or do i have to do
this pixel by pixel ??

I need this because BMP doesn’t support alpha and i don’t wanna use PNG or
another image file format.

PD :excuse my english!!–

    Ricardo Markiewicz - Linux Inside!

http://www.globalmente.com/algoritmosii/index.html

Do you want to use the “mask” image as a real alpha channel, or just a mask?

In the latter case, why not just reserving one pixel value for “transparent”,
and then use SDL’s colorkeying?

If you do need real alpha, you could merge the two images into an RGBA SDL
surface. (Do this when loading the images or something.)

//David Olofson — Programmer, Reologica Instruments AB

.- 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 Thursday 31 May 2001 06:17, Ricardo Markiewicz wrote:

Hi … i have 2 bmp, 1 is the image and the other is the mask.
Does SDL havea way to blit the image using the mask bmp, or do i have to do
this pixel by pixel ??

I need this because BMP doesn’t support alpha and i don’t wanna use PNG or
another image file format.

Hi … i have 2 bmp, 1 is the image and the other is the mask.
Does SDL havea way to blit the image using the mask bmp, or do i have to
do
this pixel by pixel ??

I need this because BMP doesn’t support alpha and i don’t wanna use PNG or
another image file format.

You could simply take a colour that is not in your image, colorize the mask
and paste it on the image (in a paint program).
Then you set that colour as colourkey, and blit it on the screen. Should
work perfectly.

HTH

Hi … i have 2 bmp, 1 is the image and the other is the mask.
Does SDL havea way to blit the image using the mask bmp, or do i have
to do
this pixel by pixel ??

I need this because BMP doesn’t support alpha and i don’t wanna use PNG
or
another image file format.

Do you want to use the “mask” image as a real alpha channel, or just a
mask?

In the latter case, why not just reserving one pixel value for
"transparent",
and then use SDL’s colorkeying?

If you do need real alpha, you could merge the two images into an RGBA
SDL
surface. (Do this when loading the images or something.)

how can i do that ??? :-)On Thu, 31 May 2001 03:48:17 David Olofson wrote:

On Thursday 31 May 2001 06:17, Ricardo Markiewicz wrote:

    Ricardo Markiewicz - Linux Inside!

http://www.globalmente.com/algoritmosii/index.html

There might be some shortcut using SDL calls that I’m not aware of, but if
not, load the two images and make sure the “real” image is in RGBA 8:8:8:8
format, and the mask image is in RGB 8:8:8 format. Then (assuming that the
mask image is a gray scale image; R == G == B), copy one of the channels from
the mask image into the A channel of the “real” image.

Just keep in mind to use surface->w for inner loop counter limit, while using
surface->pitch to calculate the start index of a row within the buffer.

//David Olofson — Programmer, Reologica Instruments AB

.- 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 Friday 01 June 2001 07:02, Ricardo Markiewicz wrote:

On Thu, 31 May 2001 03:48:17 David Olofson wrote:

On Thursday 31 May 2001 06:17, Ricardo Markiewicz wrote:

Hi … i have 2 bmp, 1 is the image and the other is the mask.
Does SDL havea way to blit the image using the mask bmp, or do i have

to do

this pixel by pixel ??

I need this because BMP doesn’t support alpha and i don’t wanna use PNG

or

another image file format.

Do you want to use the “mask” image as a real alpha channel, or just a
mask?

In the latter case, why not just reserving one pixel value for
"transparent",
and then use SDL’s colorkeying?

If you do need real alpha, you could merge the two images into an RGBA
SDL
surface. (Do this when loading the images or something.)

how can i do that ??? :slight_smile: