No way to get a color key

In SDL 1.2, colorkey was a field in SDL_PixelFormat and could easily be read. It’s since been moved to the info struct inside the blitmap struct inside the SDL_Surface, and no SDL_GetColorKey API function was added. Could we get one please?

Yes, please :slight_smile: I have been beating my head trying to figure out how to get
the colorkey.
RickOn Sat, Mar 28, 2009 at 8:15 PM, Mason Wheeler wrote:

In SDL 1.2, colorkey was a field in SDL_PixelFormat and could easily be
read. It’s since been moved to the info struct inside the blitmap struct
inside the SDL_Surface, and no SDL_GetColorKey API function was added.
Could we get one please?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

As a workaround, you can get it like this:
BlitMap.info.colorkey

(You may need to replace some or all of the dots with arrows.)
Problem is, the BlitMap field is supposed to be “private,” according to the header, so that’s a less than ideal solution.________________________________
From: mpcacrucesalus@gmail.com (Rick Page)
To: A list for developers using the SDL library. (includes SDL-announce)
Sent: Thursday, April 2, 2009 11:58:29 AM
Subject: Re: [SDL] No way to get a color key

Yes, please :slight_smile: I have been beating my head trying to figure out how to get the colorkey.
Rick

On Sat, Mar 28, 2009 at 8:15 PM, Mason Wheeler <@Mason_Wheeler> wrote:

In SDL 1.2, colorkey was a field in SDL_PixelFormat and could easily be read. It’s since been moved to the info struct inside the blitmap struct inside the SDL_Surface, and no SDL_GetColorKey API function was added. Could we get one please?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Hiyya, doing something like this?

http://www.opengl.org/sdk/docs/tutorials/ClockworkCoders/discard.php

My answer is use old sdl or use openGL…or wait-----------------

---- Mason Wheeler wrote:

=============
As a workaround, you can get it like this:
BlitMap.info.colorkey

(You may need to replace some or all of the dots with arrows.)
Problem is, the BlitMap field is supposed to be “private,” according to the header, so that’s a less than ideal solution.


From: mpcacrucesalus@gmail.com (Rick Page)
To: A list for developers using the SDL library. (includes SDL-announce)
Sent: Thursday, April 2, 2009 11:58:29 AM
Subject: Re: [SDL] No way to get a color key

Yes, please :slight_smile: I have been beating my head trying to figure out how to get the colorkey.
Rick

On Sat, Mar 28, 2009 at 8:15 PM, Mason Wheeler wrote:

In SDL 1.2, colorkey was a field in SDL_PixelFormat and could easily be read. It’s since been moved to the info struct inside the blitmap struct inside the SDL_Surface, and no SDL_GetColorKey API function was added. Could we get one please?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

In SDL 1.2, colorkey was a field in SDL_PixelFormat and could easily be read. It’s since been moved to the info struct inside the blitmap struct inside the SDL_Surface, and no SDL_GetColorKey API function was added. Could we get one please?

Sure!

/*

  • \fn int SDL_GetColorKey(SDL_Surface *surface, Uint32 *key)
    • \brief Sets the color key (transparent pixel) in a blittable surface.*
  • \param surface The surface to update
  • \param key A pointer filled in with the transparent pixel in the native surfa
    ce format
  • \return 0 on success, or -1 if the surface is not valid or colorkey is not en
    abled.
    */
    extern DECLSPEC int SDLCALL SDL_GetColorKey(SDL_Surface * surface,
    Uint32 * key);

See ya,
-Sam Lantinga, Founder and President, Galaxy Gameworks LLC

Thanks!>

----- Original Message ----
From: Sam Lantinga
Subject: Re: [SDL] No way to get a color key

In SDL 1.2, colorkey was a field in SDL_PixelFormat and could easily be read. It’s since been moved to the info struct inside the blitmap struct inside the SDL_Surface, and no SDL_GetColorKey API function was added. Could we get one please?

Sure!

Does this handle getting or just setting? The name combined with the
/brief confuses me.

Jonny DOn Fri, Apr 3, 2009 at 9:29 AM, Sam Lantinga wrote:

In SDL 1.2, colorkey was a field in SDL_PixelFormat and could easily be read. ?It’s since been moved to the info struct inside the blitmap struct inside the SDL_Surface, and no SDL_GetColorKey API function was added. ?Could we get one please?

Sure!

/*
?* \fn int SDL_GetColorKey(SDL_Surface surface, Uint32 key)
?
* \brief Sets the color key (transparent pixel) in a blittable surface.
?

?* \param surface The surface to update
?* \param key A pointer filled in with the transparent pixel in the native surfa
ce format
?*
?* \return 0 on success, or -1 if the surface is not valid or colorkey is not en
abled.
?*/
extern DECLSPEC int SDLCALL SDL_GetColorKey(SDL_Surface * surface,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Uint32 * key);

See ya,
? ? ? ?-Sam Lantinga, Founder and President, Galaxy Gameworks LLC


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Looks like it was carelessly cut-pasted from the SDL_SetColorKey info. The code looks right to me, though I’d prefer if the two different error conditions returned different error values.>----- Original Message ----

From: Jonathan Dearborn
Subject: Re: [SDL] No way to get a color key

Does this handle getting or just setting? The name combined with the
/brief confuses me.

Jonny D