How to retain RGBA when copying an SDL Surface

One of the JEDI-SDL members has the following question…

Any C code would be helpfull.> ----- Original Message -----

Hi,
I have an RGBA Surface created using IMG_Load (works great) NOW I
create a NEW RGBA Surface using SDL_CreateRGBSurface (with all the
parameters from the first Surface).
The problem is HOW do I copy the image WITH the A to the new created
Surface ?
If I’ll use SDL_BlitSurface I won’t get the RGBA I’ll get only RGB.

From the SDL:

RGBA->RGBA:
SDL_SRCALPHA set:
alpha-blend (using the source alpha channel) the RGB values;
leave destination alpha untouched. [Note: is this correct?]
SDL_SRCCOLORKEY ignored.
SDL_SRCALPHA not set:
copy all of RGBA to the destination.
if SDL_SRCCOLORKEY set, only copy the pixels matching the
RGB values of the source colour key, ignoring alpha in the
comparison.

(so for the Note, its correct :confused: )

Please let me know,
Ariel.

------------------------ Yahoo! Groups Sponsor ---------------------~–>
Will You Find True Love?
Will You Meet the One?
Free Love Reading by phone!
http://us.click.yahoo.com/O3jeVD/R_ZEAA/Ey.GAA/hWFolB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
JEDI-SDL-unsubscribe at yahoogroups.com

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/


http://www.DelphiGamer.com := for all your Object Pascal game
development needs;
http://www.delphi-jedi.org/Jedi:TEAM_SDL_HOME := Home of JEDI-SDL;
Cross-platform game development with Pascal, has never been easier.

Double check your code that creates the new surface and
make sure you turn off SRCALPHA on the original.
ie. SDL_SetAlpha( surf, 0, 0 )> -----Original Message-----

From: Dominique Louis [mailto:Dominique at SavageSoftware.com.au]
Sent: Monday, July 22, 2002 2:31 PM
To: sdl at libsdl.org
Subject: [SDL] Fwd: How to retain RGBA when copying an SDL Surface

One of the JEDI-SDL members has the following question…

Any C code would be helpfull.

-------- Original Message --------
Hi,
I have an RGBA Surface created using IMG_Load (works great) NOW I
create a NEW RGBA Surface using SDL_CreateRGBSurface (with all the
parameters from the first Surface).
The problem is HOW do I copy the image WITH the A to the new created
Surface ?
If I’ll use SDL_BlitSurface I won’t get the RGBA I’ll get only RGB.

From the SDL:

RGBA->RGBA:
SDL_SRCALPHA set:
alpha-blend (using the source alpha channel) the RGB values;
leave destination alpha untouched. [Note: is this correct?]
SDL_SRCCOLORKEY ignored.
SDL_SRCALPHA not set:
copy all of RGBA to the destination.
if SDL_SRCCOLORKEY set, only copy the pixels matching the
RGB values of the source colour key, ignoring alpha in the
comparison.

(so for the Note, its correct :confused: )

Please let me know,
Ariel.

------------------------ Yahoo! Groups Sponsor
---------------------~–>
Will You Find True Love?
Will You Meet the One?
Free Love Reading by phone!
http://us.click.yahoo.com/O3jeVD/R_ZEAA/Ey.GAA/hWFolB/TM

-------~->

To unsubscribe from this group, send an email to:
JEDI-SDL-unsubscribe at yahoogroups.com

Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/

http://www.DelphiGamer.com := for all your Object Pascal game
development needs;
http://www.delphi-jedi.org/Jedi:TEAM_SDL_HOME := Home of JEDI-SDL;
Cross-platform game development with Pascal, has never been easier.


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

Thanks Joel,
We will add that to our FAQ.

Dominique.

Joel Chen wrote:> Double check your code that creates the new surface and

make sure you turn off SRCALPHA on the original.
ie. SDL_SetAlpha( surf, 0, 0 )

-----Original Message-----
From: Dominique Louis [mailto:Dominique at SavageSoftware.com.au]
Sent: Monday, July 22, 2002 2:31 PM
To: sdl at libsdl.org
Subject: [SDL] Fwd: How to retain RGBA when copying an SDL Surface

One of the JEDI-SDL members has the following question…

Any C code would be helpfull.

-------- Original Message --------
Hi,
I have an RGBA Surface created using IMG_Load (works great) NOW I
create a NEW RGBA Surface using SDL_CreateRGBSurface (with all the
parameters from the first Surface).
The problem is HOW do I copy the image WITH the A to the new created
Surface ?
If I’ll use SDL_BlitSurface I won’t get the RGBA I’ll get only RGB.

From the SDL:

RGBA->RGBA:
SDL_SRCALPHA set:
alpha-blend (using the source alpha channel) the RGB values;
leave destination alpha untouched. [Note: is this correct?]
SDL_SRCCOLORKEY ignored.
SDL_SRCALPHA not set:
copy all of RGBA to the destination.
if SDL_SRCCOLORKEY set, only copy the pixels matching the
RGB values of the source colour key, ignoring alpha in the
comparison.

(so for the Note, its correct :confused: )

Please let me know,
Ariel.

------------------------ Yahoo! Groups Sponsor
---------------------~–>
Will You Find True Love?
Will You Meet the One?
Free Love Reading by phone!
http://us.click.yahoo.com/O3jeVD/R_ZEAA/Ey.GAA/hWFolB/TM

-------~->

To unsubscribe from this group, send an email to:
JEDI-SDL-unsubscribe at yahoogroups.com

Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/

http://www.DelphiGamer.com := for all your Object Pascal game
development needs;
http://www.delphi-jedi.org/Jedi:TEAM_SDL_HOME := Home of JEDI-SDL;
Cross-platform game development with Pascal, has never been easier.


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


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


http://www.DelphiGamer.com := for all your Object Pascal game
development needs;
http://www.delphi-jedi.org/Jedi:TEAM_SDL_HOME := Home of JEDI-SDL;
Cross-platform game development with Pascal, has never been easier.