Getting color information from indexed images?

hello

I’ve been having a hard time recently coming to understand the
functionality of surfaces with SDL or successfully utilizing them how I
want to.

so basically from what I’ve read combined with what I know about indexed
images, it SEEMs as though the sdl_color pointer in a surface’s
format’s palette (surface->format->palette->colors) should
point to some kind of information relative to the colors defined in an
image’s palette. All the references online point to the usage of the
pointer such that colors[n] refers to a color in an image’s palette with
the index of n. Which would inherit from it’s type the Uint8 members r,
g, b.(and unused). However my tests to see what values come out for r,
g, and b when I print them out respectively for their respective color
indexes are confusing me. And either I am doing it wrong, or I am not
understanding the functionality of palettes in sdl_surfaces.

so let’s assume I create a surface from a loaded 8 bit indexed bitmap of
256 colors.

img = loadbmp(etc);

now considering that upon testing how a Uint8 variable alone prints
out…

Uint8 jimbo;

.

.

.

.

jimbo = 111;

cout<<jimbo;//prints out weird character e.g. ?

so scratch that and

cout<<(int)jimbo;//prints out 111;

that if img->format->palette->colors[0].r is printed out it
would give me the red intensity of the color with that index for that
image

cout<<(int)img->format->palette->colors[0].r;//this color
in my bitmap equals 168, 0, 255 so I expect this line of code to print
168 but prints 0 instead.

not only that but more behavior follows that makes me question if this
even does what I think it does…

for(int i = 0;i<256;i++)

{

cout<<(int)img->format->palette->colors[i].r<<"
"<<(int)img->format->palette->colors[i].g<<"
"<<(int)img->format->palette->colors[i].b;

cout<<endl;

}

resulted with very unexpected results

r g b //starting with colors[0]

0 0 0

0 0 85

0 0 170

0 0 255

0 36 0

0 36 85

0 36 170

0 36 255

0 73 0

0 73 85

0 73 170

0 73 255

0 109 0

0 109 85

0 109 170

0 109 255

0 146 0

0 146 85

0 146 170

0 146 255

0 182 0

0 182 85

0 182 170

0 182 255

0 219 0

0 219 85

0 219 170

0 219 255

0 255 0

0 255 85

0 255 170

0 255 255

36 0 0

36 0 85

36 0 170

36 0 255

36 36 0

36 36 85

36 36 170

36 36 255

36 73 0

36 73 85

36 73 170

36 73 255

36 109 0

36 109 85

36 109 170

36 109 255

36 146 0

36 146 85

36 146 170

36 146 255

36 182 0

36 182 85

36 182 170

36 182 255

36 219 0

36 219 85

36 219 170

36 219 255

36 255 0

36 255 85

36 255 170

36 255 255

73 0 0

73 0 85

73 0 170

73 0 255

73 36 0

73 36 85

73 36 170

73 36 255

73 73 0

73 73 85

73 73 170

73 73 255

73 109 0

73 109 85

73 109 170

73 109 255

73 146 0

73 146 85

73 146 170

73 146 255

73 182 0

73 182 85

73 182 170

73 182 255

73 219 0

73 219 85

73 219 170

73 219 255

73 255 0

73 255 85

73 255 170

73 255 255

109 0 0

109 0 85

109 0 170

109 0 255

109 36 0

109 36 85

109 36 170

109 36 255

109 73 0

109 73 85

109 73 170

109 73 255

109 109 0

109 109 85

109 109 170

109 109 255

109 146 0

109 146 85

109 146 170

109 146 255

109 182 0

109 182 85

109 182 170

109 182 255

109 219 0

109 219 85

109 219 170

109 219 255

109 255 0

109 255 85

109 255 170

109 255 255

146 0 0

146 0 85

146 0 170

146 0 255

146 36 0

146 36 85

146 36 170

146 36 255

146 73 0

146 73 85

146 73 170

146 73 255

146 109 0

146 109 85

146 109 170

146 109 255

146 146 0

146 146 85

146 146 170

146 146 255

146 182 0

146 182 85

146 182 170

146 182 255

146 219 0

146 219 85

146 219 170

146 219 255

146 255 0

146 255 85

146 255 170

146 255 255

182 0 0

182 0 85

182 0 170

182 0 255

182 36 0

182 36 85

182 36 170

182 36 255

182 73 0

182 73 85

182 73 170

182 73 255

182 109 0

182 109 85

182 109 170

182 109 255

182 146 0

182 146 85

182 146 170

182 146 255

182 182 0

182 182 85

182 182 170

182 182 255

182 219 0

182 219 85

182 219 170

182 219 255

182 255 0

182 255 85

182 255 170

182 255 255

219 0 0

219 0 85

219 0 170

219 0 255

219 36 0

219 36 85

219 36 170

219 36 255

219 73 0

219 73 85

219 73 170

219 73 255

219 109 0

219 109 85

219 109 170

219 109 255

219 146 0

219 146 85

219 146 170

219 146 255

219 182 0

219 182 85

219 182 170

219 182 255

219 219 0

219 219 85

219 219 170

219 219 255

219 255 0

219 255 85

219 255 170

219 255 255

255 0 0

255 0 85

255 0 170

255 0 255

255 36 0

255 36 85

255 36 170

255 36 255

255 73 0

255 73 85

255 73 170

255 73 255

255 109 0

255 109 85

255 109 170

255 109 255

255 146 0

255 146 85

255 146 170

255 146 255

255 182 0

255 182 85

255 182 170

255 182 255

255 219 0

255 219 85

255 219 170

255 219 255

255 255 0

255 255 85

255 255 170

255 255 255

and these values don’t resemble the colors in my bitmap at all because
for one thing I specificaly remember having a bunch (like 50) of the
colors in the middle of the palette just be black, 0, 0, 0

and actually was similar when I tried doing it to a suface pointer I
call screen.

screen->format etc…

which points to my window I guess(screen = setvideomode(etc))

r g b

0 0 0

0 0 85

0 0 170

0 0 255

0 36 0

0 36 85

0 36 170

0 36 255

0 73 0

0 73 85

0 73 170

0 73 255

0 109 0

0 109 85

0 109 170

0 109 255

0 146 0

0 146 85

0 146 170

0 146 255

0 182 0

0 182 85

0 182 170

0 182 255

0 219 0

0 219 85

0 219 170

0 219 255

0 255 0

0 255 85

0 255 170

0 255 255

36 0 0

36 0 85

36 0 170

36 0 255

36 36 0

36 36 85

36 36 170

36 36 255

36 73 0

36 73 85

36 73 170

36 73 255

36 109 0

36 109 85

36 109 170

36 109 255

36 146 0

36 146 85

36 146 170

36 146 255

36 182 0

36 182 85

36 182 170

36 182 255

36 219 0

36 219 85

36 219 170

36 219 255

36 255 0

36 255 85

36 255 170

36 255 255

73 0 0

73 0 85

73 0 170

73 0 255

73 36 0

73 36 85

73 36 170

73 36 255

73 73 0

73 73 85

73 73 170

73 73 255

73 109 0

73 109 85

73 109 170

73 109 255

73 146 0

73 146 85

73 146 170

73 146 255

73 182 0

73 182 85

73 182 170

73 182 255

73 219 0

73 219 85

73 219 170

73 219 255

73 255 0

73 255 85

73 255 170

73 255 255

109 0 0

109 0 85

109 0 170

109 0 255

109 36 0

109 36 85

109 36 170

109 36 255

109 73 0

109 73 85

109 73 170

109 73 255

109 109 0

109 109 85

109 109 170

109 109 255

109 146 0

109 146 85

109 146 170

109 146 255

109 182 0

109 182 85

109 182 170

109 182 255

109 219 0

109 219 85

109 219 170

109 219 255

109 255 0

109 255 85

109 255 170

109 255 255

146 0 0

146 0 85

146 0 170

146 0 255

146 36 0

146 36 85

146 36 170

146 36 255

146 73 0

146 73 85

146 73 170

146 73 255

146 109 0

146 109 85

146 109 170

146 109 255

146 146 0

146 146 85

146 146 170

146 146 255

146 182 0

146 182 85

146 182 170

146 182 255

146 219 0

146 219 85

146 219 170

146 219 255

146 255 0

146 255 85

146 255 170

146 255 255

182 0 0

182 0 85

182 0 170

182 0 255

182 36 0

182 36 85

182 36 170

182 36 255

182 73 0

182 73 85

182 73 170

182 73 255

182 109 0

182 109 85

182 109 170

182 109 255

182 146 0

182 146 85

182 146 170

182 146 255

182 182 0

182 182 85

182 182 170

182 182 255

182 219 0

182 219 85

182 219 170

182 219 255

182 255 0

182 255 85

182 255 170

182 255 255

219 0 0

219 0 85

219 0 170

219 0 255

219 36 0

219 36 85

219 36 170

219 36 255

219 73 0

219 73 85

219 73 170

219 73 255

219 109 0

219 109 85

219 109 170

219 109 255

219 146 0

219 146 85

219 146 170

219 146 255

219 182 0

219 182 85

219 182 170

219 182 255

219 219 0

219 219 85

219 219 170

219 219 255

219 255 0

219 255 85

219 255 170

219 255 255

255 0 0

255 0 85

255 0 170

255 0 255

255 36 0

255 36 85

255 36 170

255 36 255

255 73 0

255 73 85

255 73 170

255 73 255

255 109 0

255 109 85

255 109 170

255 109 255

255 146 0

255 146 85

255 146 170

255 146 255

255 182 0

255 182 85

255 182 170

255 182 255

255 219 0

255 219 85

255 219 170

255 219 255

255 255 0

255 255 85

255 255 170

255 255 255

So now these results make me consider if I even accurately accessed my images palette, or if something is in the way of that, or if its not even supposed to do what it looks like it should do.

this feels like some sort of default palette where the color spectrum is represented as squarely as possible and I’m trying to get the palette of a specific image to show.

If there is more information I could reveal you think would be helpful in ascertaining the problem please let me know, thank you_________________________________________________________________
Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_1

hello

I’ve been having a hard time recently coming to understand the
functionality of surfaces with SDL or successfully utilizing them how I
want to.

so basically from what I’ve read combined with what I know about indexed
images, it SEEMs as though the sdl_color pointer in a surface’s
format’s palette (surface->format->palette->colors) should
point to some kind of information relative to the colors defined in an
image’s palette. All the references online point to the usage of the
pointer such that colors[n] refers to a color in an image’s palette with
the index of n. Which would inherit from it’s type the Uint8 members r,
g, b.(and unused). However my tests to see what values come out for r,
g, and b when I print them out respectively for their respective color
indexes are confusing me. And either I am doing it wrong, or I am not
understanding the functionality of palettes in sdl_surfaces.

so let’s assume I create a surface from a loaded 8 bit indexed bitmap of
256 colors.

img = loadbmp(etc);

now considering that upon testing how a Uint8 variable alone prints
out…

Uint8 jimbo;

.

.

.

.

jimbo = 111;

cout<<jimbo;//prints out weird character e.g. ?

so scratch that and

cout<<(int)jimbo;//prints out 111;

that if img->format->palette->colors[0].r is printed out it
would give me the red intensity of the color with that index for that
image

cout<<(int)img->format->palette->colors[0].r;//this color
in my bitmap equals 168, 0, 255 so I expect this line of code to print
168 but prints 0 instead.

not only that but more behavior follows that makes me question if this
even does what I think it does…

for(int i = 0;i<256;i++)

{

cout<<(int)img->format->palette->colors[i].r<<"
"<<(int)img->format->palette->colors[i].g<<"
"<<(int)img->format->palette->colors[i].b;

cout<<endl;

}

resulted with very unexpected results

r g b //starting with colors[0]

0 0 0

0 0 85

0 0 170

0 0 255

0 36 0

0 36 85

0 36 170

0 36 255

0 73 0

0 73 85

0 73 170

0 73 255

0 109 0

0 109 85

0 109 170

0 109 255

0 146 0

0 146 85

0 146 170

0 146 255

0 182 0

0 182 85

0 182 170

0 182 255

0 219 0

0 219 85

0 219 170

0 219 255

0 255 0

0 255 85

0 255 170

0 255 255

36 0 0

36 0 85

36 0 170

36 0 255

36 36 0

36 36 85

36 36 170

36 36 255

36 73 0

36 73 85

36 73 170

36 73 255

36 109 0

36 109 85

36 109 170

36 109 255

36 146 0

36 146 85

36 146 170

36 146 255

36 182 0

36 182 85

36 182 170

36 182 255

36 219 0

36 219 85

36 219 170

36 219 255

36 255 0

36 255 85

36 255 170

36 255 255

73 0 0

73 0 85

73 0 170

73 0 255

73 36 0

73 36 85

73 36 170

73 36 255

73 73 0

73 73 85

73 73 170

73 73 255

73 109 0

73 109 85

73 109 170

73 109 255

73 146 0

73 146 85

73 146 170

73 146 255

73 182 0

73 182 85

73 182 170

73 182 255

73 219 0

73 219 85

73 219 170

73 219 255

73 255 0

73 255 85

73 255 170

73 255 255

109 0 0

109 0 85

109 0 170

109 0 255

109 36 0

109 36 85

109 36 170

109 36 255

109 73 0

109 73 85

109 73 170

109 73 255

109 109 0

109 109 85

109 109 170

109 109 255

109 146 0

109 146 85

109 146 170

109 146 255

109 182 0

109 182 85

109 182 170

109 182 255

109 219 0

109 219 85

109 219 170

109 219 255

109 255 0

109 255 85

109 255 170

109 255 255

146 0 0

146 0 85

146 0 170

146 0 255

146 36 0

146 36 85

146 36 170

146 36 255

146 73 0

146 73 85

146 73 170

146 73 255

146 109 0

146 109 85

146 109 170

146 109 255

146 146 0

146 146 85

146 146 170

146 146 255

146 182 0

146 182 85

146 182 170

146 182 255

146 219 0

146 219 85

146 219 170

146 219 255

146 255 0

146 255 85

146 255 170

146 255 255

182 0 0

182 0 85

182 0 170

182 0 255

182 36 0

182 36 85

182 36 170

182 36 255

182 73 0

182 73 85

182 73 170

182 73 255

182 109 0

182 109 85

182 109 170

182 109 255

182 146 0

182 146 85

182 146 170

182 146 255

182 182 0

182 182 85

182 182 170

182 182 255

182 219 0

182 219 85

182 219 170

182 219 255

182 255 0

182 255 85

182 255 170

182 255 255

219 0 0

219 0 85

219 0 170

219 0 255

219 36 0

219 36 85

219 36 170

219 36 255

219 73 0

219 73 85

219 73 170

219 73 255

219 109 0

219 109 85

219 109 170

219 109 255

219 146 0

219 146 85

219 146 170

219 146 255

219 182 0

219 182 85

219 182 170

219 182 255

219 219 0

219 219 85

219 219 170

219 219 255

219 255 0

219 255 85

219 255 170

219 255 255

255 0 0

255 0 85

255 0 170

255 0 255

255 36 0

255 36 85

255 36 170

255 36 255

255 73 0

255 73 85

255 73 170

255 73 255

255 109 0

255 109 85

255 109 170

255 109 255

255 146 0

255 146 85

255 146 170

255 146 255

255 182 0

255 182 85

255 182 170

255 182 255

255 219 0

255 219 85

255 219 170

255 219 255

255 255 0

255 255 85

255 255 170

255 255 255

and these values don’t resemble the colors in my bitmap at all because
for one thing I specificaly remember having a bunch (like 50) of the
colors in the middle of the palette just be black, 0, 0, 0

and actually was similar when I tried doing it to a suface pointer I
call screen.

screen->format etc…

which points to my window I guess(screen = setvideomode(etc))

r g b

0 0 0

0 0 85

0 0 170

0 0 255

0 36 0

0 36 85

0 36 170

0 36 255

0 73 0

0 73 85

0 73 170

0 73 255

0 109 0

0 109 85

0 109 170

0 109 255

0 146 0

0 146 85

0 146 170

0 146 255

0 182 0

0 182 85

0 182 170

0 182 255

0 219 0

0 219 85

0 219 170

0 219 255

0 255 0

0 255 85

0 255 170

0 255 255

36 0 0

36 0 85

36 0 170

36 0 255

36 36 0

36 36 85

36 36 170

36 36 255

36 73 0

36 73 85

36 73 170

36 73 255

36 109 0

36 109 85

36 109 170

36 109 255

36 146 0

36 146 85

36 146 170

36 146 255

36 182 0

36 182 85

36 182 170

36 182 255

36 219 0

36 219 85

36 219 170

36 219 255

36 255 0

36 255 85

36 255 170

36 255 255

73 0 0

73 0 85

73 0 170

73 0 255

73 36 0

73 36 85

73 36 170

73 36 255

73 73 0

73 73 85

73 73 170

73 73 255

73 109 0

73 109 85

73 109 170

73 109 255

73 146 0

73 146 85

73 146 170

73 146 255

73 182 0

73 182 85

73 182 170

73 182 255

73 219 0

73 219 85

73 219 170

73 219 255

73 255 0

73 255 85

73 255 170

73 255 255

109 0 0

109 0 85

109 0 170

109 0 255

109 36 0

109 36 85

109 36 170

109 36 255

109 73 0

109 73 85

109 73 170

109 73 255

109 109 0

109 109 85

109 109 170

109 109 255

109 146 0

109 146 85

109 146 170

109 146 255

109 182 0

109 182 85

109 182 170

109 182 255

109 219 0

109 219 85

109 219 170

109 219 255

109 255 0

109 255 85

109 255 170

109 255 255

146 0 0

146 0 85

146 0 170

146 0 255

146 36 0

146 36 85

146 36 170

146 36 255

146 73 0

146 73 85

146 73 170

146 73 255

146 109 0

146 109 85

146 109 170

146 109 255

146 146 0

146 146 85

146 146 170

146 146 255

146 182 0

146 182 85

146 182 170

146 182 255

146 219 0

146 219 85

146 219 170

146 219 255

146 255 0

146 255 85

146 255 170

146 255 255

182 0 0

182 0 85

182 0 170

182 0 255

182 36 0

182 36 85

182 36 170

182 36 255

182 73 0

182 73 85

182 73 170

182 73 255

182 109 0

182 109 85

182 109 170

182 109 255

182 146 0

182 146 85

182 146 170

182 146 255

182 182 0

182 182 85

182 182 170

182 182 255

182 219 0

182 219 85

182 219 170

182 219 255

182 255 0

182 255 85

182 255 170

182 255 255

219 0 0

219 0 85

219 0 170

219 0 255

219 36 0

219 36 85

219 36 170

219 36 255

219 73 0

219 73 85

219 73 170

219 73 255

219 109 0

219 109 85

219 109 170

219 109 255

219 146 0

219 146 85

219 146 170

219 146 255

219 182 0

219 182 85

219 182 170

219 182 255

219 219 0

219 219 85

219 219 170

219 219 255

219 255 0

219 255 85

219 255 170

219 255 255

255 0 0

255 0 85

255 0 170

255 0 255

255 36 0

255 36 85

255 36 170

255 36 255

255 73 0

255 73 85

255 73 170

255 73 255

255 109 0

255 109 85

255 109 170

255 109 255

255 146 0

255 146 85

255 146 170

255 146 255

255 182 0

255 182 85

255 182 170

255 182 255

255 219 0

255 219 85

255 219 170

255 219 255

255 255 0

255 255 85

255 255 170

255 255 255

So now these results make me consider if I even accurately accessed my images palette, or if something is in the way of that, or if its not even supposed to do what it looks like it should do.

this feels like some sort of default palette where the color spectrum is represented as squarely as possible and I’m trying to get the palette of a specific image to show.

If there is more information I could reveal you think would be helpful in ascertaining the problem please let me know, thank you_________________________________________________________________
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5

I think the images don’t use their own palette but the colors are
rounded to a generic palette, because a color 24,255,0 was read out as
36,255,0.

This is pretty rotten, what would be the point of using
a palette, if images didn’t actually keep their own palettes? Andreas
the thing you sent helped me figure some of that out. the scolor
vaiables did the same thing but the dcolor ones from the SDL_gfx example
seem to find the color of the pixel given x and y positions, but only
relative to that generic palette. But I was hoping I’d find a way to
turn this into something that grabbed colors from the index, which it’s
not really doing…

Is there no way to read palettes from
images with the sdl libraries??Date: Tue, 20 Apr 2010 08:34:08 -0700
From: aschiffler@ferzkopp.net
To: @Omar_Eshmawi
Subject: Re: [SDL] getting color information from indexed images?

Check out the code from SDL_gfx that handles index images.

http://sdlgfx.svn.sourceforge.net/viewvc/sdlgfx/SDL_gfxPrimitives.c?revision=21&view=markup

line

263 to 273.

On 4/20/10 8:14 AM, Omar Eshmawi wrote:

hello

I’ve been having a hard time recently coming to understand the
functionality of surfaces with SDL or successfully utilizing them how I
want to.

so basically from what I’ve read combined with what I know about
indexed images, it SEEMs as though the sdl_color pointer in a surface’s
format’s palette (surface->format->palette->colors) should
point to some kind of information relative to the colors defined in an
image’s palette. All the references online point to the usage of the
pointer such that colors[n] refers to a color in an image’s palette
with the index of n. Which would inherit from it’s type the Uint8
members r, g, b.(and unused). However my tests to see what values come
out for r, g, and b when I print them out respectively for their
respective color indexes are confusing me. And either I am doing it
wrong, or I am not understanding the functionality of palettes in
sdl_surfaces.

so let’s assume I create a surface from a loaded 8 bit indexed bitmap
of 256 colors.

img = loadbmp(etc);

now considering that upon testing how a Uint8 variable alone prints
out…

Uint8 jimbo;

.

.

.

.

jimbo = 111;

cout<<jimbo;//prints out weird character e.g. ?

so scratch that and

cout<<(int)jimbo;//prints out 111;

that if img->format->palette->colors[0].r is printed out it
would give me the red intensity of the color with that index for that
image

cout<<(int)img->format->palette->colors[0].r;//this
color in my bitmap equals 168, 0, 255 so I expect this line of code to
print 168 but prints 0 instead.

not only that but more behavior follows that makes me question if this
even does what I think it does…

for(int i = 0;i<256;i++)

{

cout<<(int)img->format->palette->colors[i].r<<"
"<<(int)img->format->palette->colors[i].g<<"
"<<(int)img->format->palette->colors[i].b;

cout<<endl;

}

resulted with very unexpected results

r g b //starting with colors[0]

0 0 0

0 0 85

0 0 170

0 0 255

0 36 0

0 36 85

0 36 170

0 36 255

0 73 0

0 73 85

0 73 170

0 73 255

0 109 0

0 109 85

0 109 170

0 109 255

0 146 0

0 146 85

0 146 170

0 146 255

0 182 0

0 182 85

0 182 170

0 182 255

0 219 0

0 219 85

0 219 170

0 219 255

0 255 0

0 255 85

0 255 170

0 255 255

36 0 0

36 0 85

36 0 170

36 0 255

36 36 0

36 36 85

36 36 170

36 36 255

36 73 0

36 73 85

36 73 170

36 73 255

36 109 0

36 109 85

36 109 170

36 109 255

36 146 0

36 146 85

36 146 170

36 146 255

36 182 0

36 182 85

36 182 170

36 182 255

36 219 0

36 219 85

36 219 170

36 219 255

36 255 0

36 255 85

36 255 170

36 255 255

73 0 0

73 0 85

73 0 170

73 0 255

73 36 0

73 36 85

73 36 170

73 36 255

73 73 0

73 73 85

73 73 170

73 73 255

73 109 0

73 109 85

73 109 170

73 109 255

73 146 0

73 146 85

73 146 170

73 146 255

73 182 0

73 182 85

73 182 170

73 182 255

73 219 0

73 219 85

73 219 170

73 219 255

73 255 0

73 255 85

73 255 170

73 255 255

109 0 0

109 0 85

109 0 170

109 0 255

109 36 0

109 36 85

109 36 170

109 36 255

109 73 0

109 73 85

109 73 170

109 73 255

109 109 0

109 109 85

109 109 170

109 109 255

109 146 0

109 146 85

109 146 170

109 146 255

109 182 0

109 182 85

109 182 170

109 182 255

109 219 0

109 219 85

109 219 170

109 219 255

109 255 0

109 255 85

109 255 170

109 255 255

146 0 0

146 0 85

146 0 170

146 0 255

146 36 0

146 36 85

146 36 170

146 36 255

146 73 0

146 73 85

146 73 170

146 73 255

146 109 0

146 109 85

146 109 170

146 109 255

146 146 0

146 146 85

146 146 170

146 146 255

146 182 0

146 182 85

146 182 170

146 182 255

146 219 0

146 219 85

146 219 170

146 219 255

146 255 0

146 255 85

146 255 170

146 255 255

182 0 0

182 0 85

182 0 170

182 0 255

182 36 0

182 36 85

182 36 170

182 36 255

182 73 0

182 73 85

182 73 170

182 73 255

182 109 0

182 109 85

182 109 170

182 109 255

182 146 0

182 146 85

182 146 170

182 146 255

182 182 0

182 182 85

182 182 170

182 182 255

182 219 0

182 219 85

182 219 170

182 219 255

182 255 0

182 255 85

182 255 170

182 255 255

219 0 0

219 0 85

219 0 170

219 0 255

219 36 0

219 36 85

219 36 170

219 36 255

219 73 0

219 73 85

219 73 170

219 73 255

219 109 0

219 109 85

219 109 170

219 109 255

219 146 0

219 146 85

219 146 170

219 146 255

219 182 0

219 182 85

219 182 170

219 182 255

219 219 0

219 219 85

219 219 170

219 219 255

219 255 0

219 255 85

219 255 170

219 255 255

255 0 0

255 0 85

255 0 170

255 0 255

255 36 0

255 36 85

255 36 170

255 36 255

255 73 0

255 73 85

255 73 170

255 73 255

255 109 0

255 109 85

255 109 170

255 109 255

255 146 0

255 146 85

255 146 170

255 146 255

255 182 0

255 182 85

255 182 170

255 182 255

255 219 0

255 219 85

255 219 170

255 219 255

255 255 0

255 255 85

255 255 170

255 255 255

and these values don’t resemble the colors in my bitmap at all because
for one thing I specificaly remember having a bunch (like 50) of the
colors in the middle of the palette just be black, 0, 0, 0

and actually was similar when I tried doing it to a suface pointer I
call screen.

screen->format etc…

which points to my window I guess(screen = setvideomode(etc))

r g b

0 0 0

0 0 85

0 0 170

0 0 255

0 36 0

0 36 85

0 36 170

0 36 255

0 73 0

0 73 85

0 73 170

0 73 255

0 109 0

0 109 85

0 109 170

0 109 255

0 146 0

0 146 85

0 146 170

0 146 255

0 182 0

0 182 85

0 182 170

0 182 255

0 219 0

0 219 85

0 219 170

0 219 255

0 255 0

0 255 85

0 255 170

0 255 255

36 0 0

36 0 85

36 0 170

36 0 255

36 36 0

36 36 85

36 36 170

36 36 255

36 73 0

36 73 85

36 73 170

36 73 255

36 109 0

36 109 85

36 109 170

36 109 255

36 146 0

36 146 85

36 146 170

36 146 255

36 182 0

36 182 85

36 182 170

36 182 255

36 219 0

36 219 85

36 219 170

36 219 255

36 255 0

36 255 85

36 255 170

36 255 255

73 0 0

73 0 85

73 0 170

73 0 255

73 36 0

73 36 85

73 36 170

73 36 255

73 73 0

73 73 85

73 73 170

73 73 255

73 109 0

73 109 85

73 109 170

73 109 255

73 146 0

73 146 85

73 146 170

73 146 255

73 182 0

73 182 85

73 182 170

73 182 255

73 219 0

73 219 85

73 219 170

73 219 255

73 255 0

73 255 85

73 255 170

73 255 255

109 0 0

109 0 85

109 0 170

109 0 255

109 36 0

109 36 85

109 36 170

109 36 255

109 73 0

109 73 85

109 73 170

109 73 255

109 109 0

109 109 85

109 109 170

109 109 255

109 146 0

109 146 85

109 146 170

109 146 255

109 182 0

109 182 85

109 182 170

109 182 255

109 219 0

109 219 85

109 219 170

109 219 255

109 255 0

109 255 85

109 255 170

109 255 255

146 0 0

146 0 85

146 0 170

146 0 255

146 36 0

146 36 85

146 36 170

146 36 255

146 73 0

146 73 85

146 73 170

146 73 255

146 109 0

146 109 85

146 109 170

146 109 255

146 146 0

146 146 85

146 146 170

146 146 255

146 182 0

146 182 85

146 182 170

146 182 255

146 219 0

146 219 85

146 219 170

146 219 255

146 255 0

146 255 85

146 255 170

146 255 255

182 0 0

182 0 85

182 0 170

182 0 255

182 36 0

182 36 85

182 36 170

182 36 255

182 73 0

182 73 85

182 73 170

182 73 255

182 109 0

182 109 85

182 109 170

182 109 255

182 146 0

182 146 85

182 146 170

182 146 255

182 182 0

182 182 85

182 182 170

182 182 255

182 219 0

182 219 85

182 219 170

182 219 255

182 255 0

182 255 85

182 255 170

182 255 255

219 0 0

219 0 85

219 0 170

219 0 255

219 36 0

219 36 85

219 36 170

219 36 255

219 73 0

219 73 85

219 73 170

219 73 255

219 109 0

219 109 85

219 109 170

219 109 255

219 146 0

219 146 85

219 146 170

219 146 255

219 182 0

219 182 85

219 182 170

219 182 255

219 219 0

219 219 85

219 219 170

219 219 255

219 255 0

219 255 85

219 255 170

219 255 255

255 0 0

255 0 85

255 0 170

255 0 255

255 36 0

255 36 85

255 36 170

255 36 255

255 73 0

255 73 85

255 73 170

255 73 255

255 109 0

255 109 85

255 109 170

255 109 255

255 146 0

255 146 85

255 146 170

255 146 255

255 182 0

255 182 85

255 182 170

255 182 255

255 219 0

255 219 85

255 219 170

255 219 255

255 255 0

255 255 85

255 255 170

255 255 255

So now these results make me consider if I even accurately accessed my
images palette, or if something is in the way of that, or if its not
even supposed to do what it looks like it should do.

this feels like some sort of default palette where the color spectrum
is represented as squarely as possible and I’m trying to get the
palette of a specific image to show.

If there is more information I could reveal you think would be helpful
in ascertaining the problem please let me know, thank you

The New Busy think 9 to 5 is a cute idea. Combine multiple
calendars with Hotmail. Get busy.


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


Hotmail is redefining busy with tools for the New Busy. Get more from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2

Please provide an example program that illustrates this unexpected
behavior. An image file will be needed to complete the work, or
perhaps literal data embedded in C source code, but probably then
someone will have to export that data to examine the color palette in
some other program.On Wed, Apr 21, 2010 at 12:19 AM, Omar Eshmawi <neo_storm at live.com> wrote:

I think the images don’t use their own palette but the colors are rounded to
a generic palette, because a color 24,255,0 was read out as 36,255,0.

This is pretty rotten, what would be the point of using a palette, if images
didn’t actually keep their own palettes? Andreas the thing you sent helped
me figure some of that out. the scolor vaiables did the same thing but the
dcolor ones from the SDL_gfx example seem to find the color of the pixel
given x and y positions, but only relative to that generic palette. But I
was hoping I’d find a way to turn this into something that grabbed colors
from the index, which it’s not really doing…

Is there no way to read palettes from images with the sdl libraries??


Date: Tue, 20 Apr 2010 08:34:08 -0700
From: aschiffler at ferzkopp.net
To: neo_storm at live.com
Subject: Re: [SDL] getting color information from indexed images?

Check out the code from SDL_gfx that handles index images.

http://sdlgfx.svn.sourceforge.net/viewvc/sdlgfx/SDL_gfxPrimitives.c?revision=21&view=markup
line 263 to 273.

On 4/20/10 8:14 AM, Omar Eshmawi wrote:

hello
I’ve been having a hard time recently coming to understand the functionality
of surfaces with SDL or successfully utilizing them how I want to.
so basically from what I’ve read combined with what I know about indexed
images, it SEEMs as though the sdl_color pointer in a surface’s format’s
palette (surface->format->palette->colors) should point to some kind of
information relative to the colors defined in an image’s palette. All the
references online point to the usage of the pointer such that colors[n]
refers to a color in an image’s palette with the index of n. Which would
inherit from it’s type the Uint8 members r, g, b.(and unused). However my
tests to see what values come out for r, g, and b when I print them out
respectively for their respective color indexes are confusing me. And either
I am doing it wrong, or I am not understanding the functionality of palettes
in sdl_surfaces.

so let’s assume I create a surface from a loaded 8 bit indexed bitmap of 256
colors.

img = loadbmp(etc);

now considering that upon testing how a Uint8 variable alone prints out…

Uint8 jimbo;
.
.
.
.
jimbo = 111;
cout<<jimbo;//prints out weird character e.g. ?
so scratch that and
cout<<(int)jimbo;//prints out 111;

that if img->format->palette->colors[0].r is printed out it would give me
the red intensity of the color with that index for that image

cout<<(int)img->format->palette->colors[0].r;//this color in my bitmap
equals 168, 0, 255 so I expect this line of code to print 168 but prints 0
instead.

not only that but more behavior follows that makes me question if this even
does what I think it does…

for(int i = 0;i<256;i++)
{

cout<<(int)img->format->palette->colors[i].r<<"
"<<(int)img->format->palette->colors[i].g<<"
"<<(int)img->format->palette->colors[i].b;
cout<<endl;

}

resulted with very unexpected results
r g b //starting with colors[0]
0 0 0
0 0 85
0 0 170
0 0 255
0 36 0
0 36 85
0 36 170
0 36 255
0 73 0
0 73 85
0 73 170
0 73 255
0 109 0
0 109 85
0 109 170
0 109 255
0 146 0
0 146 85
0 146 170
0 146 255
0 182 0
0 182 85
0 182 170
0 182 255
0 219 0
0 219 85
0 219 170
0 219 255
0 255 0
0 255 85
0 255 170
0 255 255
36 0 0
36 0 85
36 0 170
36 0 255
36 36 0
36 36 85
36 36 170
36 36 255
36 73 0
36 73 85
36 73 170
36 73 255
36 109 0
36 109 85
36 109 170
36 109 255
36 146 0
36 146 85
36 146 170
36 146 255
36 182 0
36 182 85
36 182 170
36 182 255
36 219 0
36 219 85
36 219 170
36 219 255
36 255 0
36 255 85
36 255 170
36 255 255
73 0 0
73 0 85
73 0 170
73 0 255
73 36 0
73 36 85
73 36 170
73 36 255
73 73 0
73 73 85
73 73 170
73 73 255
73 109 0
73 109 85
73 109 170
73 109 255
73 146 0
73 146 85
73 146 170
73 146 255
73 182 0
73 182 85
73 182 170
73 182 255
73 219 0
73 219 85
73 219 170
73 219 255
73 255 0
73 255 85
73 255 170
73 255 255
109 0 0
109 0 85
109 0 170
109 0 255
109 36 0
109 36 85
109 36 170
109 36 255
109 73 0
109 73 85
109 73 170
109 73 255
109 109 0
109 109 85
109 109 170
109 109 255
109 146 0
109 146 85
109 146 170
109 146 255
109 182 0
109 182 85
109 182 170
109 182 255
109 219 0
109 219 85
109 219 170
109 219 255
109 255 0
109 255 85
109 255 170
109 255 255
146 0 0
146 0 85
146 0 170
146 0 255
146 36 0
146 36 85
146 36 170
146 36 255
146 73 0
146 73 85
146 73 170
146 73 255
146 109 0
146 109 85
146 109 170
146 109 255
146 146 0
146 146 85
146 146 170
146 146 255
146 182 0
146 182 85
146 182 170
146 182 255
146 219 0
146 219 85
146 219 170
146 219 255
146 255 0
146 255 85
146 255 170
146 255 255
182 0 0
182 0 85
182 0 170
182 0 255
182 36 0
182 36 85
182 36 170
182 36 255
182 73 0
182 73 85
182 73 170
182 73 255
182 109 0
182 109 85
182 109 170
182 109 255
182 146 0
182 146 85
182 146 170
182 146 255
182 182 0
182 182 85
182 182 170
182 182 255
182 219 0
182 219 85
182 219 170
182 219 255
182 255 0
182 255 85
182 255 170
182 255 255
219 0 0
219 0 85
219 0 170
219 0 255
219 36 0
219 36 85
219 36 170
219 36 255
219 73 0
219 73 85
219 73 170
219 73 255
219 109 0
219 109 85
219 109 170
219 109 255
219 146 0
219 146 85
219 146 170
219 146 255
219 182 0
219 182 85
219 182 170
219 182 255
219 219 0
219 219 85
219 219 170
219 219 255
219 255 0
219 255 85
219 255 170
219 255 255
255 0 0
255 0 85
255 0 170
255 0 255
255 36 0
255 36 85
255 36 170
255 36 255
255 73 0
255 73 85
255 73 170
255 73 255
255 109 0
255 109 85
255 109 170
255 109 255
255 146 0
255 146 85
255 146 170
255 146 255
255 182 0
255 182 85
255 182 170
255 182 255
255 219 0
255 219 85
255 219 170
255 219 255
255 255 0
255 255 85
255 255 170
255 255 255

and these values don’t resemble the colors in my bitmap at all because for
one thing I specificaly remember having a bunch (like 50) of the colors in
the middle of the palette just be black, 0, 0, 0

and actually was similar when I tried doing it to a suface pointer I call
screen.
screen->format etc…
which points to my window I guess(screen = setvideomode(etc))

r g b
0 0 0
0 0 85
0 0 170
0 0 255
0 36 0
0 36 85
0 36 170
0 36 255
0 73 0
0 73 85
0 73 170
0 73 255
0 109 0
0 109 85
0 109 170
0 109 255
0 146 0
0 146 85
0 146 170
0 146 255
0 182 0
0 182 85
0 182 170
0 182 255
0 219 0
0 219 85
0 219 170
0 219 255
0 255 0
0 255 85
0 255 170
0 255 255
36 0 0
36 0 85
36 0 170
36 0 255
36 36 0
36 36 85
36 36 170
36 36 255
36 73 0
36 73 85
36 73 170
36 73 255
36 109 0
36 109 85
36 109 170
36 109 255
36 146 0
36 146 85
36 146 170
36 146 255
36 182 0
36 182 85
36 182 170
36 182 255
36 219 0
36 219 85
36 219 170
36 219 255
36 255 0
36 255 85
36 255 170
36 255 255
73 0 0
73 0 85
73 0 170
73 0 255
73 36 0
73 36 85
73 36 170
73 36 255
73 73 0
73 73 85
73 73 170
73 73 255
73 109 0
73 109 85
73 109 170
73 109 255
73 146 0
73 146 85
73 146 170
73 146 255
73 182 0
73 182 85
73 182 170
73 182 255
73 219 0
73 219 85
73 219 170
73 219 255
73 255 0
73 255 85
73 255 170
73 255 255
109 0 0
109 0 85
109 0 170
109 0 255
109 36 0
109 36 85
109 36 170
109 36 255
109 73 0
109 73 85
109 73 170
109 73 255
109 109 0
109 109 85
109 109 170
109 109 255
109 146 0
109 146 85
109 146 170
109 146 255
109 182 0
109 182 85
109 182 170
109 182 255
109 219 0
109 219 85
109 219 170
109 219 255
109 255 0
109 255 85
109 255 170
109 255 255
146 0 0
146 0 85
146 0 170
146 0 255
146 36 0
146 36 85
146 36 170
146 36 255
146 73 0
146 73 85
146 73 170
146 73 255
146 109 0
146 109 85
146 109 170
146 109 255
146 146 0
146 146 85
146 146 170
146 146 255
146 182 0
146 182 85
146 182 170
146 182 255
146 219 0
146 219 85
146 219 170
146 219 255
146 255 0
146 255 85
146 255 170
146 255 255
182 0 0
182 0 85
182 0 170
182 0 255
182 36 0
182 36 85
182 36 170
182 36 255
182 73 0
182 73 85
182 73 170
182 73 255
182 109 0
182 109 85
182 109 170
182 109 255
182 146 0
182 146 85
182 146 170
182 146 255
182 182 0
182 182 85
182 182 170
182 182 255
182 219 0
182 219 85
182 219 170
182 219 255
182 255 0
182 255 85
182 255 170
182 255 255
219 0 0
219 0 85
219 0 170
219 0 255
219 36 0
219 36 85
219 36 170
219 36 255
219 73 0
219 73 85
219 73 170
219 73 255
219 109 0
219 109 85
219 109 170
219 109 255
219 146 0
219 146 85
219 146 170
219 146 255
219 182 0
219 182 85
219 182 170
219 182 255
219 219 0
219 219 85
219 219 170
219 219 255
219 255 0
219 255 85
219 255 170
219 255 255
255 0 0
255 0 85
255 0 170
255 0 255
255 36 0
255 36 85
255 36 170
255 36 255
255 73 0
255 73 85
255 73 170
255 73 255
255 109 0
255 109 85
255 109 170
255 109 255
255 146 0
255 146 85
255 146 170
255 146 255
255 182 0
255 182 85
255 182 170
255 182 255
255 219 0
255 219 85
255 219 170
255 219 255
255 255 0
255 255 85
255 255 170
255 255 255

So now these results make me consider if I even accurately accessed my
images palette, or if something is in the way of that, or if its not even
supposed to do what it looks like it should do.

this feels like some sort of default palette where the color spectrum is
represented as squarely as possible and I’m trying to get the palette of a
specific image to show.

If there is more information I could reveal you think would be helpful in
ascertaining the problem please let me know, thank you


The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with
Hotmail. Get busy.


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


Hotmail is redefining busy with tools for the New Busy. Get more from your
inbox. See how.


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


http://codebad.com/

I’d definitely need to see a code example, since palettes were
designed to work the way you’re expecting.

You can take a look at test/testpalette.c for an example of using
palette manipulation in SDL.On Tue, Apr 20, 2010 at 8:14 AM, Omar Eshmawi <neo_storm at live.com> wrote:

hello
I’ve been having a hard time recently coming to understand the functionality
of surfaces with SDL or successfully utilizing them how I want to.
so basically from what I’ve read combined with what I know about indexed
images, it SEEMs as though the sdl_color pointer in a surface’s format’s
palette (surface->format->palette->colors) should point to some kind of
information relative to the colors defined in an image’s palette. All the
references online point to the usage of the pointer such that colors[n]
refers to a color in an image’s palette with the index of n. Which would
inherit from it’s type the Uint8 members r, g, b.(and unused). However my
tests to see what values come out for r, g, and b when I print them out
respectively for their respective color indexes are confusing me. And either
I am doing it wrong, or I am not understanding the functionality of palettes
in sdl_surfaces.

so let’s assume I create a surface from a loaded 8 bit indexed bitmap of 256
colors.

img = loadbmp(etc);

now considering that upon testing how a Uint8 variable alone prints out…

Uint8 jimbo;
.
.
.
.
jimbo = 111;
cout<<jimbo;//prints out weird character e.g. ?
so scratch that and
cout<<(int)jimbo;//prints out 111;

that if img->format->palette->colors[0].r is printed out it would give me
the red intensity of the color with that index for that image

cout<<(int)img->format->palette->colors[0].r;//this color in my bitmap
equals 168, 0, 255 so I expect this line of code to print 168 but prints 0
instead.

not only that but more behavior follows that makes me question if this even
does what I think it does…

for(int i = 0;i<256;i++)
{

cout<<(int)img->format->palette->colors[i].r<<"
"<<(int)img->format->palette->colors[i].g<<"
"<<(int)img->format->palette->colors[i].b;
cout<<endl;

}

resulted with very unexpected results
r g b //starting with colors[0]
0 0 0
0 0 85
0 0 170
0 0 255
0 36 0
0 36 85
0 36 170
0 36 255
0 73 0
0 73 85
0 73 170
0 73 255
0 109 0
0 109 85
0 109 170
0 109 255
0 146 0
0 146 85
0 146 170
0 146 255
0 182 0
0 182 85
0 182 170
0 182 255
0 219 0
0 219 85
0 219 170
0 219 255
0 255 0
0 255 85
0 255 170
0 255 255
36 0 0
36 0 85
36 0 170
36 0 255
36 36 0
36 36 85
36 36 170
36 36 255
36 73 0
36 73 85
36 73 170
36 73 255
36 109 0
36 109 85
36 109 170
36 109 255
36 146 0
36 146 85
36 146 170
36 146 255
36 182 0
36 182 85
36 182 170
36 182 255
36 219 0
36 219 85
36 219 170
36 219 255
36 255 0
36 255 85
36 255 170
36 255 255
73 0 0
73 0 85
73 0 170
73 0 255
73 36 0
73 36 85
73 36 170
73 36 255
73 73 0
73 73 85
73 73 170
73 73 255
73 109 0
73 109 85
73 109 170
73 109 255
73 146 0
73 146 85
73 146 170
73 146 255
73 182 0
73 182 85
73 182 170
73 182 255
73 219 0
73 219 85
73 219 170
73 219 255
73 255 0
73 255 85
73 255 170
73 255 255
109 0 0
109 0 85
109 0 170
109 0 255
109 36 0
109 36 85
109 36 170
109 36 255
109 73 0
109 73 85
109 73 170
109 73 255
109 109 0
109 109 85
109 109 170
109 109 255
109 146 0
109 146 85
109 146 170
109 146 255
109 182 0
109 182 85
109 182 170
109 182 255
109 219 0
109 219 85
109 219 170
109 219 255
109 255 0
109 255 85
109 255 170
109 255 255
146 0 0
146 0 85
146 0 170
146 0 255
146 36 0
146 36 85
146 36 170
146 36 255
146 73 0
146 73 85
146 73 170
146 73 255
146 109 0
146 109 85
146 109 170
146 109 255
146 146 0
146 146 85
146 146 170
146 146 255
146 182 0
146 182 85
146 182 170
146 182 255
146 219 0
146 219 85
146 219 170
146 219 255
146 255 0
146 255 85
146 255 170
146 255 255
182 0 0
182 0 85
182 0 170
182 0 255
182 36 0
182 36 85
182 36 170
182 36 255
182 73 0
182 73 85
182 73 170
182 73 255
182 109 0
182 109 85
182 109 170
182 109 255
182 146 0
182 146 85
182 146 170
182 146 255
182 182 0
182 182 85
182 182 170
182 182 255
182 219 0
182 219 85
182 219 170
182 219 255
182 255 0
182 255 85
182 255 170
182 255 255
219 0 0
219 0 85
219 0 170
219 0 255
219 36 0
219 36 85
219 36 170
219 36 255
219 73 0
219 73 85
219 73 170
219 73 255
219 109 0
219 109 85
219 109 170
219 109 255
219 146 0
219 146 85
219 146 170
219 146 255
219 182 0
219 182 85
219 182 170
219 182 255
219 219 0
219 219 85
219 219 170
219 219 255
219 255 0
219 255 85
219 255 170
219 255 255
255 0 0
255 0 85
255 0 170
255 0 255
255 36 0
255 36 85
255 36 170
255 36 255
255 73 0
255 73 85
255 73 170
255 73 255
255 109 0
255 109 85
255 109 170
255 109 255
255 146 0
255 146 85
255 146 170
255 146 255
255 182 0
255 182 85
255 182 170
255 182 255
255 219 0
255 219 85
255 219 170
255 219 255
255 255 0
255 255 85
255 255 170
255 255 255

and these values don’t resemble the colors in my bitmap at all because for
one thing I specificaly remember having a bunch (like 50) of the colors in
the middle of the palette just be black, 0, 0, 0

and actually was similar when I tried doing it to a suface pointer I call
screen.
screen->format etc…
which points to my window I guess(screen = setvideomode(etc))

r g b
0 0 0
0 0 85
0 0 170
0 0 255
0 36 0
0 36 85
0 36 170
0 36 255
0 73 0
0 73 85
0 73 170
0 73 255
0 109 0
0 109 85
0 109 170
0 109 255
0 146 0
0 146 85
0 146 170
0 146 255
0 182 0
0 182 85
0 182 170
0 182 255
0 219 0
0 219 85
0 219 170
0 219 255
0 255 0
0 255 85
0 255 170
0 255 255
36 0 0
36 0 85
36 0 170
36 0 255
36 36 0
36 36 85
36 36 170
36 36 255
36 73 0
36 73 85
36 73 170
36 73 255
36 109 0
36 109 85
36 109 170
36 109 255
36 146 0
36 146 85
36 146 170
36 146 255
36 182 0
36 182 85
36 182 170
36 182 255
36 219 0
36 219 85
36 219 170
36 219 255
36 255 0
36 255 85
36 255 170
36 255 255
73 0 0
73 0 85
73 0 170
73 0 255
73 36 0
73 36 85
73 36 170
73 36 255
73 73 0
73 73 85
73 73 170
73 73 255
73 109 0
73 109 85
73 109 170
73 109 255
73 146 0
73 146 85
73 146 170
73 146 255
73 182 0
73 182 85
73 182 170
73 182 255
73 219 0
73 219 85
73 219 170
73 219 255
73 255 0
73 255 85
73 255 170
73 255 255
109 0 0
109 0 85
109 0 170
109 0 255
109 36 0
109 36 85
109 36 170
109 36 255
109 73 0
109 73 85
109 73 170
109 73 255
109 109 0
109 109 85
109 109 170
109 109 255
109 146 0
109 146 85
109 146 170
109 146 255
109 182 0
109 182 85
109 182 170
109 182 255
109 219 0
109 219 85
109 219 170
109 219 255
109 255 0
109 255 85
109 255 170
109 255 255
146 0 0
146 0 85
146 0 170
146 0 255
146 36 0
146 36 85
146 36 170
146 36 255
146 73 0
146 73 85
146 73 170
146 73 255
146 109 0
146 109 85
146 109 170
146 109 255
146 146 0
146 146 85
146 146 170
146 146 255
146 182 0
146 182 85
146 182 170
146 182 255
146 219 0
146 219 85
146 219 170
146 219 255
146 255 0
146 255 85
146 255 170
146 255 255
182 0 0
182 0 85
182 0 170
182 0 255
182 36 0
182 36 85
182 36 170
182 36 255
182 73 0
182 73 85
182 73 170
182 73 255
182 109 0
182 109 85
182 109 170
182 109 255
182 146 0
182 146 85
182 146 170
182 146 255
182 182 0
182 182 85
182 182 170
182 182 255
182 219 0
182 219 85
182 219 170
182 219 255
182 255 0
182 255 85
182 255 170
182 255 255
219 0 0
219 0 85
219 0 170
219 0 255
219 36 0
219 36 85
219 36 170
219 36 255
219 73 0
219 73 85
219 73 170
219 73 255
219 109 0
219 109 85
219 109 170
219 109 255
219 146 0
219 146 85
219 146 170
219 146 255
219 182 0
219 182 85
219 182 170
219 182 255
219 219 0
219 219 85
219 219 170
219 219 255
219 255 0
219 255 85
219 255 170
219 255 255
255 0 0
255 0 85
255 0 170
255 0 255
255 36 0
255 36 85
255 36 170
255 36 255
255 73 0
255 73 85
255 73 170
255 73 255
255 109 0
255 109 85
255 109 170
255 109 255
255 146 0
255 146 85
255 146 170
255 146 255
255 182 0
255 182 85
255 182 170
255 182 255
255 219 0
255 219 85
255 219 170
255 219 255
255 255 0
255 255 85
255 255 170
255 255 255

So now these results make me consider if I even accurately accessed my
images palette, or if something is in the way of that, or if its not even
supposed to do what it looks like it should do.

this feels like some sort of default palette where the color spectrum is
represented as squarely as possible and I’m trying to get the palette of a
specific image to show.

If there is more information I could reveal you think would be helpful in
ascertaining the problem please let me know, thank you


Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox.
Learn more.


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


-Sam Lantinga, Founder and President, Galaxy Gameworks LLC

http://www.zshare.net/download/75303828a6e64bf5/

@Donny & Sam

I included compilers but if you modify anything and want to compile it I don’t think it will work unless you have MinGW on your hard drive as that is the compiler I am using

the code is in c++

image made in photoshop, formatted with photoshop> Date: Wed, 21 Apr 2010 06:46:24 -0700

From: slouken at libsdl.org
To: sdl at lists.libsdl.org
Subject: Re: [SDL] getting color information from indexed images?

I’d definitely need to see a code example, since palettes were
designed to work the way you’re expecting.

You can take a look at test/testpalette.c for an example of using
palette manipulation in SDL.

On Tue, Apr 20, 2010 at 8:14 AM, Omar Eshmawi <@Omar_Eshmawi> wrote:

hello
I’ve been having a hard time recently coming to understand the functionality
of surfaces with SDL or successfully utilizing them how I want to.
so basically from what I’ve read combined with what I know about indexed
images, it SEEMs as though the sdl_color pointer in a surface’s format’s
palette (surface->format->palette->colors) should point to some kind of
information relative to the colors defined in an image’s palette. All the
references online point to the usage of the pointer such that colors[n]
refers to a color in an image’s palette with the index of n. Which would
inherit from it’s type the Uint8 members r, g, b.(and unused). However my
tests to see what values come out for r, g, and b when I print them out
respectively for their respective color indexes are confusing me. And either
I am doing it wrong, or I am not understanding the functionality of palettes
in sdl_surfaces.

so let’s assume I create a surface from a loaded 8 bit indexed bitmap of 256
colors.

img = loadbmp(etc);

now considering that upon testing how a Uint8 variable alone prints out…

Uint8 jimbo;
.
.
.
.
jimbo = 111;
cout<<jimbo;//prints out weird character e.g. ?
so scratch that and
cout<<(int)jimbo;//prints out 111;

that if img->format->palette->colors[0].r is printed out it would give me
the red intensity of the color with that index for that image

cout<<(int)img->format->palette->colors[0].r;//this color in my bitmap
equals 168, 0, 255 so I expect this line of code to print 168 but prints 0
instead.

not only that but more behavior follows that makes me question if this even
does what I think it does…

for(int i = 0;i<256;i++)
{

cout<<(int)img->format->palette->colors[i].r<<"
"<<(int)img->format->palette->colors[i].g<<"
"<<(int)img->format->palette->colors[i].b;
cout<<endl;

}

resulted with very unexpected results
r g b //starting with colors[0]
0 0 0
0 0 85
0 0 170
0 0 255
0 36 0
0 36 85
0 36 170
0 36 255
0 73 0
0 73 85
0 73 170
0 73 255
0 109 0
0 109 85
0 109 170
0 109 255
0 146 0
0 146 85
0 146 170
0 146 255
0 182 0
0 182 85
0 182 170
0 182 255
0 219 0
0 219 85
0 219 170
0 219 255
0 255 0
0 255 85
0 255 170
0 255 255
36 0 0
36 0 85
36 0 170
36 0 255
36 36 0
36 36 85
36 36 170
36 36 255
36 73 0
36 73 85
36 73 170
36 73 255
36 109 0
36 109 85
36 109 170
36 109 255
36 146 0
36 146 85
36 146 170
36 146 255
36 182 0
36 182 85
36 182 170
36 182 255
36 219 0
36 219 85
36 219 170
36 219 255
36 255 0
36 255 85
36 255 170
36 255 255
73 0 0
73 0 85
73 0 170
73 0 255
73 36 0
73 36 85
73 36 170
73 36 255
73 73 0
73 73 85
73 73 170
73 73 255
73 109 0
73 109 85
73 109 170
73 109 255
73 146 0
73 146 85
73 146 170
73 146 255
73 182 0
73 182 85
73 182 170
73 182 255
73 219 0
73 219 85
73 219 170
73 219 255
73 255 0
73 255 85
73 255 170
73 255 255
109 0 0
109 0 85
109 0 170
109 0 255
109 36 0
109 36 85
109 36 170
109 36 255
109 73 0
109 73 85
109 73 170
109 73 255
109 109 0
109 109 85
109 109 170
109 109 255
109 146 0
109 146 85
109 146 170
109 146 255
109 182 0
109 182 85
109 182 170
109 182 255
109 219 0
109 219 85
109 219 170
109 219 255
109 255 0
109 255 85
109 255 170
109 255 255
146 0 0
146 0 85
146 0 170
146 0 255
146 36 0
146 36 85
146 36 170
146 36 255
146 73 0
146 73 85
146 73 170
146 73 255
146 109 0
146 109 85
146 109 170
146 109 255
146 146 0
146 146 85
146 146 170
146 146 255
146 182 0
146 182 85
146 182 170
146 182 255
146 219 0
146 219 85
146 219 170
146 219 255
146 255 0
146 255 85
146 255 170
146 255 255
182 0 0
182 0 85
182 0 170
182 0 255
182 36 0
182 36 85
182 36 170
182 36 255
182 73 0
182 73 85
182 73 170
182 73 255
182 109 0
182 109 85
182 109 170
182 109 255
182 146 0
182 146 85
182 146 170
182 146 255
182 182 0
182 182 85
182 182 170
182 182 255
182 219 0
182 219 85
182 219 170
182 219 255
182 255 0
182 255 85
182 255 170
182 255 255
219 0 0
219 0 85
219 0 170
219 0 255
219 36 0
219 36 85
219 36 170
219 36 255
219 73 0
219 73 85
219 73 170
219 73 255
219 109 0
219 109 85
219 109 170
219 109 255
219 146 0
219 146 85
219 146 170
219 146 255
219 182 0
219 182 85
219 182 170
219 182 255
219 219 0
219 219 85
219 219 170
219 219 255
219 255 0
219 255 85
219 255 170
219 255 255
255 0 0
255 0 85
255 0 170
255 0 255
255 36 0
255 36 85
255 36 170
255 36 255
255 73 0
255 73 85
255 73 170
255 73 255
255 109 0
255 109 85
255 109 170
255 109 255
255 146 0
255 146 85
255 146 170
255 146 255
255 182 0
255 182 85
255 182 170
255 182 255
255 219 0
255 219 85
255 219 170
255 219 255
255 255 0
255 255 85
255 255 170
255 255 255

and these values don’t resemble the colors in my bitmap at all because for
one thing I specificaly remember having a bunch (like 50) of the colors in
the middle of the palette just be black, 0, 0, 0

and actually was similar when I tried doing it to a suface pointer I call
screen.
screen->format etc…
which points to my window I guess(screen = setvideomode(etc))

r g b
0 0 0
0 0 85
0 0 170
0 0 255
0 36 0
0 36 85
0 36 170
0 36 255
0 73 0
0 73 85
0 73 170
0 73 255
0 109 0
0 109 85
0 109 170
0 109 255
0 146 0
0 146 85
0 146 170
0 146 255
0 182 0
0 182 85
0 182 170
0 182 255
0 219 0
0 219 85
0 219 170
0 219 255
0 255 0
0 255 85
0 255 170
0 255 255
36 0 0
36 0 85
36 0 170
36 0 255
36 36 0
36 36 85
36 36 170
36 36 255
36 73 0
36 73 85
36 73 170
36 73 255
36 109 0
36 109 85
36 109 170
36 109 255
36 146 0
36 146 85
36 146 170
36 146 255
36 182 0
36 182 85
36 182 170
36 182 255
36 219 0
36 219 85
36 219 170
36 219 255
36 255 0
36 255 85
36 255 170
36 255 255
73 0 0
73 0 85
73 0 170
73 0 255
73 36 0
73 36 85
73 36 170
73 36 255
73 73 0
73 73 85
73 73 170
73 73 255
73 109 0
73 109 85
73 109 170
73 109 255
73 146 0
73 146 85
73 146 170
73 146 255
73 182 0
73 182 85
73 182 170
73 182 255
73 219 0
73 219 85
73 219 170
73 219 255
73 255 0
73 255 85
73 255 170
73 255 255
109 0 0
109 0 85
109 0 170
109 0 255
109 36 0
109 36 85
109 36 170
109 36 255
109 73 0
109 73 85
109 73 170
109 73 255
109 109 0
109 109 85
109 109 170
109 109 255
109 146 0
109 146 85
109 146 170
109 146 255
109 182 0
109 182 85
109 182 170
109 182 255
109 219 0
109 219 85
109 219 170
109 219 255
109 255 0
109 255 85
109 255 170
109 255 255
146 0 0
146 0 85
146 0 170
146 0 255
146 36 0
146 36 85
146 36 170
146 36 255
146 73 0
146 73 85
146 73 170
146 73 255
146 109 0
146 109 85
146 109 170
146 109 255
146 146 0
146 146 85
146 146 170
146 146 255
146 182 0
146 182 85
146 182 170
146 182 255
146 219 0
146 219 85
146 219 170
146 219 255
146 255 0
146 255 85
146 255 170
146 255 255
182 0 0
182 0 85
182 0 170
182 0 255
182 36 0
182 36 85
182 36 170
182 36 255
182 73 0
182 73 85
182 73 170
182 73 255
182 109 0
182 109 85
182 109 170
182 109 255
182 146 0
182 146 85
182 146 170
182 146 255
182 182 0
182 182 85
182 182 170
182 182 255
182 219 0
182 219 85
182 219 170
182 219 255
182 255 0
182 255 85
182 255 170
182 255 255
219 0 0
219 0 85
219 0 170
219 0 255
219 36 0
219 36 85
219 36 170
219 36 255
219 73 0
219 73 85
219 73 170
219 73 255
219 109 0
219 109 85
219 109 170
219 109 255
219 146 0
219 146 85
219 146 170
219 146 255
219 182 0
219 182 85
219 182 170
219 182 255
219 219 0
219 219 85
219 219 170
219 219 255
219 255 0
219 255 85
219 255 170
219 255 255
255 0 0
255 0 85
255 0 170
255 0 255
255 36 0
255 36 85
255 36 170
255 36 255
255 73 0
255 73 85
255 73 170
255 73 255
255 109 0
255 109 85
255 109 170
255 109 255
255 146 0
255 146 85
255 146 170
255 146 255
255 182 0
255 182 85
255 182 170
255 182 255
255 219 0
255 219 85
255 219 170
255 219 255
255 255 0
255 255 85
255 255 170
255 255 255

So now these results make me consider if I even accurately accessed my
images palette, or if something is in the way of that, or if its not even
supposed to do what it looks like it should do.

this feels like some sort of default palette where the color spectrum is
represented as squarely as possible and I’m trying to get the palette of a
specific image to show.

If there is more information I could reveal you think would be helpful in
ascertaining the problem please let me know, thank you


Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox.
Learn more.


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


-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


Hotmail is redefining busy with tools for the New Busy. Get more from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2

Could you maybe email this to me as an attachment? I had a hard time
with zSHARE.On Fri, Apr 23, 2010 at 2:40 PM, Omar Eshmawi <neo_storm at live.com> wrote:

http://www.zshare.net/download/75303828a6e64bf5/
@Donny & Sam
I included compilers?but if you modify anything and want to compile it?I
don’t think it will work unless you have MinGW on your hard?drive as that is
the compiler I am using
the code is in c++
image?made?in?photoshop, formatted with photoshop

Date: Wed, 21 Apr 2010 06:46:24 -0700
From: slouken at libsdl.org
To: sdl at lists.libsdl.org
Subject: Re: [SDL] getting color information from indexed images?

I’d definitely need to see a code example, since palettes were
designed to work the way you’re expecting.

You can take a look at test/testpalette.c for an example of using
palette manipulation in SDL.

On Tue, Apr 20, 2010 at 8:14 AM, Omar Eshmawi <neo_storm at live.com> wrote:

hello
I’ve been having a hard time recently coming to understand the
functionality
of surfaces with SDL or successfully utilizing them how I want to.
so basically from what I’ve read combined with what I know about indexed
images, it SEEMs as though the sdl_color pointer in a surface’s format’s
palette (surface->format->palette->colors) should point to some kind of
information relative to the colors defined in an image’s palette. All
the
references online point to the usage of the pointer such that colors[n]
refers to a color in an image’s palette with the index of n. Which would
inherit from it’s type the Uint8 members r, g, b.(and unused). However
my
tests to see what values come out for r, g, and b when I print them out
respectively for their respective color indexes are confusing me. And
either
I am doing it wrong, or I am not understanding the functionality of
palettes
in sdl_surfaces.

so let’s assume I create a surface from a loaded 8 bit indexed bitmap of
256
colors.

img = loadbmp(etc);

now considering that upon testing how a Uint8 variable alone prints
out…

Uint8 jimbo;
.
.
.
.
jimbo = 111;
cout<<jimbo;//prints out weird character e.g. ?
so scratch that and
cout<<(int)jimbo;//prints out 111;

that if img->format->palette->colors[0].r is printed out it would give
me
the red intensity of the color with that index for that image

cout<<(int)img->format->palette->colors[0].r;//this color in my bitmap
equals 168, 0, 255 so I expect this line of code to print 168 but prints
0
instead.

not only that but more behavior follows that makes me question if this
even
does what I think it does…

for(int i = 0;i<256;i++)
{

cout<<(int)img->format->palette->colors[i].r<<"
"<<(int)img->format->palette->colors[i].g<<"
"<<(int)img->format->palette->colors[i].b;
cout<<endl;

}

resulted with very unexpected results
r g b //starting with colors[0]
0 0 0
0 0 85
0 0 170
0 0 255
0 36 0
0 36 85
0 36 170
0 36 255
0 73 0
0 73 85
0 73 170
0 73 255
0 109 0
0 109 85
0 109 170
0 109 255
0 146 0
0 146 85
0 146 170
0 146 255
0 182 0
0 182 85
0 182 170
0 182 255
0 219 0
0 219 85
0 219 170
0 219 255
0 255 0
0 255 85
0 255 170
0 255 255
36 0 0
36 0 85
36 0 170
36 0 255
36 36 0
36 36 85
36 36 170
36 36 255
36 73 0
36 73 85
36 73 170
36 73 255
36 109 0
36 109 85
36 109 170
36 109 255
36 146 0
36 146 85
36 146 170
36 146 255
36 182 0
36 182 85
36 182 170
36 182 255
36 219 0
36 219 85
36 219 170
36 219 255
36 255 0
36 255 85
36 255 170
36 255 255
73 0 0
73 0 85
73 0 170
73 0 255
73 36 0
73 36 85
73 36 170
73 36 255
73 73 0
73 73 85
73 73 170
73 73 255
73 109 0
73 109 85
73 109 170
73 109 255
73 146 0
73 146 85
73 146 170
73 146 255
73 182 0
73 182 85
73 182 170
73 182 255
73 219 0
73 219 85
73 219 170
73 219 255
73 255 0
73 255 85
73 255 170
73 255 255
109 0 0
109 0 85
109 0 170
109 0 255
109 36 0
109 36 85
109 36 170
109 36 255
109 73 0
109 73 85
109 73 170
109 73 255
109 109 0
109 109 85
109 109 170
109 109 255
109 146 0
109 146 85
109 146 170
109 146 255
109 182 0
109 182 85
109 182 170
109 182 255
109 219 0
109 219 85
109 219 170
109 219 255
109 255 0
109 255 85
109 255 170
109 255 255
146 0 0
146 0 85
146 0 170
146 0 255
146 36 0
146 36 85
146 36 170
146 36 255
146 73 0
146 73 85
146 73 170
146 73 255
146 109 0
146 109 85
146 109 170
146 109 255
146 146 0
146 146 85
146 146 170
146 146 255
146 182 0
146 182 85
146 182 170
146 182 255
146 219 0
146 219 85
146 219 170
146 219 255
146 255 0
146 255 85
146 255 170
146 255 255
182 0 0
182 0 85
182 0 170
182 0 255
182 36 0
182 36 85
182 36 170
182 36 255
182 73 0
182 73 85
182 73 170
182 73 255
182 109 0
182 109 85
182 109 170
182 109 255
182 146 0
182 146 85
182 146 170
182 146 255
182 182 0
182 182 85
182 182 170
182 182 255
182 219 0
182 219 85
182 219 170
182 219 255
182 255 0
182 255 85
182 255 170
182 255 255
219 0 0
219 0 85
219 0 170
219 0 255
219 36 0
219 36 85
219 36 170
219 36 255
219 73 0
219 73 85
219 73 170
219 73 255
219 109 0
219 109 85
219 109 170
219 109 255
219 146 0
219 146 85
219 146 170
219 146 255
219 182 0
219 182 85
219 182 170
219 182 255
219 219 0
219 219 85
219 219 170
219 219 255
219 255 0
219 255 85
219 255 170
219 255 255
255 0 0
255 0 85
255 0 170
255 0 255
255 36 0
255 36 85
255 36 170
255 36 255
255 73 0
255 73 85
255 73 170
255 73 255
255 109 0
255 109 85
255 109 170
255 109 255
255 146 0
255 146 85
255 146 170
255 146 255
255 182 0
255 182 85
255 182 170
255 182 255
255 219 0
255 219 85
255 219 170
255 219 255
255 255 0
255 255 85
255 255 170
255 255 255

and these values don’t resemble the colors in my bitmap at all because
for
one thing I specificaly remember having a bunch (like 50) of the colors
in
the middle of the palette just be black, 0, 0, 0

and actually was similar when I tried doing it to a suface pointer I
call
screen.
screen->format etc…
which points to my window I guess(screen = setvideomode(etc))

r g b
0 0 0
0 0 85
0 0 170
0 0 255
0 36 0
0 36 85
0 36 170
0 36 255
0 73 0
0 73 85
0 73 170
0 73 255
0 109 0
0 109 85
0 109 170
0 109 255
0 146 0
0 146 85
0 146 170
0 146 255
0 182 0
0 182 85
0 182 170
0 182 255
0 219 0
0 219 85
0 219 170
0 219 255
0 255 0
0 255 85
0 255 170
0 255 255
36 0 0
36 0 85
36 0 170
36 0 255
36 36 0
36 36 85
36 36 170
36 36 255
36 73 0
36 73 85
36 73 170
36 73 255
36 109 0
36 109 85
36 109 170
36 109 255
36 146 0
36 146 85
36 146 170
36 146 255
36 182 0
36 182 85
36 182 170
36 182 255
36 219 0
36 219 85
36 219 170
36 219 255
36 255 0
36 255 85
36 255 170
36 255 255
73 0 0
73 0 85
73 0 170
73 0 255
73 36 0
73 36 85
73 36 170
73 36 255
73 73 0
73 73 85
73 73 170
73 73 255
73 109 0
73 109 85
73 109 170
73 109 255
73 146 0
73 146 85
73 146 170
73 146 255
73 182 0
73 182 85
73 182 170
73 182 255
73 219 0
73 219 85
73 219 170
73 219 255
73 255 0
73 255 85
73 255 170
73 255 255
109 0 0
109 0 85
109 0 170
109 0 255
109 36 0
109 36 85
109 36 170
109 36 255
109 73 0
109 73 85
109 73 170
109 73 255
109 109 0
109 109 85
109 109 170
109 109 255
109 146 0
109 146 85
109 146 170
109 146 255
109 182 0
109 182 85
109 182 170
109 182 255
109 219 0
109 219 85
109 219 170
109 219 255
109 255 0
109 255 85
109 255 170
109 255 255
146 0 0
146 0 85
146 0 170
146 0 255
146 36 0
146 36 85
146 36 170
146 36 255
146 73 0
146 73 85
146 73 170
146 73 255
146 109 0
146 109 85
146 109 170
146 109 255
146 146 0
146 146 85
146 146 170
146 146 255
146 182 0
146 182 85
146 182 170
146 182 255
146 219 0
146 219 85
146 219 170
146 219 255
146 255 0
146 255 85
146 255 170
146 255 255
182 0 0
182 0 85
182 0 170
182 0 255
182 36 0
182 36 85
182 36 170
182 36 255
182 73 0
182 73 85
182 73 170
182 73 255
182 109 0
182 109 85
182 109 170
182 109 255
182 146 0
182 146 85
182 146 170
182 146 255
182 182 0
182 182 85
182 182 170
182 182 255
182 219 0
182 219 85
182 219 170
182 219 255
182 255 0
182 255 85
182 255 170
182 255 255
219 0 0
219 0 85
219 0 170
219 0 255
219 36 0
219 36 85
219 36 170
219 36 255
219 73 0
219 73 85
219 73 170
219 73 255
219 109 0
219 109 85
219 109 170
219 109 255
219 146 0
219 146 85
219 146 170
219 146 255
219 182 0
219 182 85
219 182 170
219 182 255
219 219 0
219 219 85
219 219 170
219 219 255
219 255 0
219 255 85
219 255 170
219 255 255
255 0 0
255 0 85
255 0 170
255 0 255
255 36 0
255 36 85
255 36 170
255 36 255
255 73 0
255 73 85
255 73 170
255 73 255
255 109 0
255 109 85
255 109 170
255 109 255
255 146 0
255 146 85
255 146 170
255 146 255
255 182 0
255 182 85
255 182 170
255 182 255
255 219 0
255 219 85
255 219 170
255 219 255
255 255 0
255 255 85
255 255 170
255 255 255

So now these results make me consider if I even accurately accessed my
images palette, or if something is in the way of that, or if its not
even
supposed to do what it looks like it should do.

this feels like some sort of default palette where the color spectrum is
represented as squarely as possible and I’m trying to get the palette of
a
specific image to show.

If there is more information I could reveal you think would be helpful
in
ascertaining the problem please let me know, thank you


Hotmail has tools for the New Busy. Search, chat and e-mail from your
inbox.
Learn more.


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


-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


Hotmail is redefining busy with tools for the New Busy. Get more from your
inbox. See how.


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


http://codebad.com/

http://www.speedyshare.com/files/22093997/example_palette.zip
http://www.mediafire.com/?lozmdzmjyz0
http://www.megaupload.com/?d=E064R1JK
at
first I tried to attach it, but I suppose you can’t send messages
larger than 40 kb to the mailing list
and @donny I’ll send you the
attachment just to be safe_________________________________________________________________
Hotmail is redefining busy with tools for the New Busy. Get more from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2

Still waiting for that attachment :)On Fri, Apr 23, 2010 at 8:11 PM, Omar Eshmawi <neo_storm at live.com> wrote:

http://www.speedyshare.com/files/22093997/example_palette.zip
http://www.mediafire.com/?lozmdzmjyz0
http://www.megaupload.com/?d=E064R1JK
at first I tried to attach it, but I suppose you can’t send messages larger
than 40 kb to the mailing list
and @donny I’ll send you the attachment just to be safe


Hotmail is redefining busy with tools for the New Busy. Get more from your
inbox. See how.


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


http://codebad.com/

I sent you an email yesterday??
did you try one of the 3 links I sent to the mailing list?> Date: Sat, 24 Apr 2010 05:14:33 -0400

From: donny.viszneki at gmail.com
To: sdl at lists.libsdl.org
Subject: Re: [SDL] getting color information from indexed images?

Still waiting for that attachment :slight_smile:

On Fri, Apr 23, 2010 at 8:11 PM, Omar Eshmawi <@Omar_Eshmawi> wrote:

http://www.speedyshare.com/files/22093997/example_palette.zip
http://www.mediafire.com/?lozmdzmjyz0
http://www.megaupload.com/?d=E064R1JK
at first I tried to attach it, but I suppose you can’t send messages larger
than 40 kb to the mailing list
and @donny I’ll send you the attachment just to be safe


Hotmail is redefining busy with tools for the New Busy. Get more from your
inbox. See how.


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


http://codebad.com/


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


The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5

is this your email? donny.viszneki at gmail.com
because I keep getting notifications of failure in my inbox> Date: Sat, 24 Apr 2010 05:14:33 -0400

From: donny.viszneki at gmail.com
To: sdl at lists.libsdl.org
Subject: Re: [SDL] getting color information from indexed images?

Still waiting for that attachment :slight_smile:

On Fri, Apr 23, 2010 at 8:11 PM, Omar Eshmawi <@Omar_Eshmawi> wrote:

http://www.speedyshare.com/files/22093997/example_palette.zip
http://www.mediafire.com/?lozmdzmjyz0
http://www.megaupload.com/?d=E064R1JK
at first I tried to attach it, but I suppose you can’t send messages larger
than 40 kb to the mailing list
and @donny I’ll send you the attachment just to be safe


Hotmail is redefining busy with tools for the New Busy. Get more from your
inbox. See how.


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


http://codebad.com/


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


The New Busy is not the old busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3

That’s weird, that is my email address.

If I had the root password for my server I would give you an FTP
account, but I need to get a hard drive out of an older machine and I
can’t even find it…

I’ll try one of your other linksOn Sat, Apr 24, 2010 at 11:15 PM, Omar Eshmawi <neo_storm at live.com> wrote:

is this your email? @Donny_Viszneki
because I keep getting notifications of failure in my inbox

Date: Sat, 24 Apr 2010 05:14:33 -0400
From: @Donny_Viszneki
To: sdl at lists.libsdl.org
Subject: Re: [SDL] getting color information from indexed images?

Still waiting for that attachment :slight_smile:

On Fri, Apr 23, 2010 at 8:11 PM, Omar Eshmawi <neo_storm at live.com> wrote:

http://www.speedyshare.com/files/22093997/example_palette.zip
http://www.mediafire.com/?lozmdzmjyz0
http://www.megaupload.com/?d=E064R1JK
at first I tried to attach it, but I suppose you can’t send messages
larger
than 40 kb to the mailing list
and @donny I’ll send you the attachment just to be safe


Hotmail is redefining busy with tools for the New Busy. Get more from
your
inbox. See how.


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


http://codebad.com/


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


The New Busy is not the old busy. Search, chat and e-mail from your inbox.
Get started.


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


http://codebad.com/

Looks like SpeedyShare worked quite speedily!On Sun, Apr 25, 2010 at 1:38 AM, Donny Viszneki <@Donny_Viszneki> wrote:

That’s weird, that is my email address.

If I had the root password for my server I would give you an FTP
account, but I need to get a hard drive out of an older machine and I
can’t even find it…

I’ll try one of your other links

On Sat, Apr 24, 2010 at 11:15 PM, Omar Eshmawi <neo_storm at live.com> wrote:

is this your email? @Donny_Viszneki
because I keep getting notifications of failure in my inbox

Date: Sat, 24 Apr 2010 05:14:33 -0400
From: @Donny_Viszneki
To: sdl at lists.libsdl.org
Subject: Re: [SDL] getting color information from indexed images?

Still waiting for that attachment :slight_smile:

On Fri, Apr 23, 2010 at 8:11 PM, Omar Eshmawi <neo_storm at live.com> wrote:

http://www.speedyshare.com/files/22093997/example_palette.zip
http://www.mediafire.com/?lozmdzmjyz0
http://www.megaupload.com/?d=E064R1JK
at first I tried to attach it, but I suppose you can’t send messages
larger
than 40 kb to the mailing list
and @donny I’ll send you the attachment just to be safe


Hotmail is redefining busy with tools for the New Busy. Get more from
your
inbox. See how.


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


http://codebad.com/


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


The New Busy is not the old busy. Search, chat and e-mail from your inbox.
Get started.


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


http://codebad.com/


http://codebad.com/

haha, good> Date: Sun, 25 Apr 2010 01:39:08 -0400

From: donny.viszneki at gmail.com
To: sdl at lists.libsdl.org
Subject: Re: [SDL] getting color information from indexed images?

Looks like SpeedyShare worked quite speedily!

On Sun, Apr 25, 2010 at 1:38 AM, Donny Viszneki <donny.viszneki at gmail.com> wrote:

That’s weird, that is my email address.

If I had the root password for my server I would give you an FTP
account, but I need to get a hard drive out of an older machine and I
can’t even find it…

I’ll try one of your other links

On Sat, Apr 24, 2010 at 11:15 PM, Omar Eshmawi <@Omar_Eshmawi> wrote:

is this your email? donny.viszneki at gmail.com
because I keep getting notifications of failure in my inbox

Date: Sat, 24 Apr 2010 05:14:33 -0400
From: donny.viszneki at gmail.com
To: sdl at lists.libsdl.org
Subject: Re: [SDL] getting color information from indexed images?

Still waiting for that attachment :slight_smile:

On Fri, Apr 23, 2010 at 8:11 PM, Omar Eshmawi <@Omar_Eshmawi> wrote:

http://www.speedyshare.com/files/22093997/example_palette.zip
http://www.mediafire.com/?lozmdzmjyz0
http://www.megaupload.com/?d=E064R1JK
at first I tried to attach it, but I suppose you can’t send messages
larger
than 40 kb to the mailing list
and @donny I’ll send you the attachment just to be safe


Hotmail is redefining busy with tools for the New Busy. Get more from
your
inbox. See how.


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


http://codebad.com/


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


The New Busy is not the old busy. Search, chat and e-mail from your inbox.
Get started.


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


http://codebad.com/


http://codebad.com/


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


The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5

so… it would be nice to get some confirmation on whether anyone could ever solve my problem or not?
I remember putting up 3 links to my example program that sam and donny conveyed request for. But I never got a reply as to whether you guys were able to figure it out or not? Please let me know if you want me to reupload it.From: @Omar_Eshmawi
To: sdl at lists.libsdl.org
Date: Sun, 25 Apr 2010 13:58:54 -0700
Subject: Re: [SDL] getting color information from indexed images?

haha, good

Date: Sun, 25 Apr 2010 01:39:08 -0400
From: donny.viszneki at gmail.com
To: sdl at lists.libsdl.org
Subject: Re: [SDL] getting color information from indexed images?

Looks like SpeedyShare worked quite speedily!

On Sun, Apr 25, 2010 at 1:38 AM, Donny Viszneki <donny.viszneki at gmail.com> wrote:

That’s weird, that is my email address.

If I had the root password for my server I would give you an FTP
account, but I need to get a hard drive out of an older machine and I
can’t even find it…

I’ll try one of your other links

On Sat, Apr 24, 2010 at 11:15 PM, Omar Eshmawi <@Omar_Eshmawi> wrote:

is this your email? donny.viszneki at gmail.com
because I keep getting notifications of failure in my inbox

Date: Sat, 24 Apr 2010 05:14:33 -0400
From: donny.viszneki at gmail.com
To: sdl at lists.libsdl.org
Subject: Re: [SDL] getting color information from indexed images?

Still waiting for that attachment :slight_smile:

On Fri, Apr 23, 2010 at 8:11 PM, Omar Eshmawi <@Omar_Eshmawi> wrote:

http://www.speedyshare.com/files/22093997/example_palette.zip
http://www.mediafire.com/?lozmdzmjyz0
http://www.megaupload.com/?d=E064R1JK
at first I tried to attach it, but I suppose you can’t send messages
larger
than 40 kb to the mailing list
and @donny I’ll send you the attachment just to be safe


Hotmail is redefining busy with tools for the New Busy. Get more from
your
inbox. See how.


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


http://codebad.com/


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


The New Busy is not the old busy. Search, chat and e-mail from your inbox.
Get started.


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


http://codebad.com/


http://codebad.com/


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

The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with Hotmail. Get busy.


The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4

Sorry, I was unable to do the test because it contains MSWindows-only
code, and I don’t have MSWindows :frowning:

Does your project require MSWindows-only code? I kind of suspect that
your bug might be caused by not actually getting what you think you’re
getting from the MSWindows APIs you’re using.

Okay, so I took out the Windows-specific stuff and I replaced a call
to your LoadBMP_Resource() function with a call to SDL_LoadBMP().

What I got for the palette is different from what you got for the palette:

donny at donny-desktop:~/palette/example_palette$ ./a.out
255 255 255
0 0 0
255 0 0
255 14 14
255 28 28
255 42 42
255 55 55
255 69 69
255 83 83
255 97 97
255 111 111
255 125 125
255 138 138
255 152 152
255 166 166
255 180 180
6 0 255
19 13 255
32 26 255
45 40 255
57 53 255
70 66 255
83 79 255
96 92 255
109 106 255
122 119 255
135 132 255
148 145 255
160 158 255
173 172 255
186 185 255
199 198 255
0 255 18
15 255 32
29 255 45
44 255 59
58 255 72
73 255 86
87 255 99
102 255 113
116 255 126
131 255 140
145 255 153
160 255 167
174 255 180
189 255 194
203 255 207
218 255 221
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 255 0

This information is confirmed by a look at resources/test.bmp. Here is
a screenshot:

http://codebad.com/d/omars-palette.png

I suspect that those old MSWindows APIs are fitting your image into
their own 256 color palette. IIRC MSWindows used to have a different
palette for each application that used an indexed color mode, and
switching focus between different application windows would result in
other applications’ windows on your screen looking funny when the
palette changed.

Try factoring out your MSWindows APIs as much as possible. Your
applications will be more portable and you’ll have access to more of
the source code you are invoking and therefore be able to troubleshoot
more effectively :slight_smile:

Sorry I took so long to check out your ZIP file. I have been moving
into a new apartment and replacing the carpet and painting the walls
:OOn Wed, May 5, 2010 at 10:08 PM, Omar Eshmawi <neo_storm at live.com> wrote:

so… it would be nice to get some confirmation on whether anyone could ever
solve my problem or not?
I remember putting up 3 links to my example program that sam and donny
conveyed request for. But I never got a reply as to whether you guys were
able to figure it out or not? Please let me know if you want me to reupload
it.


From: neo_storm at live.com
To: sdl at lists.libsdl.org
Date: Sun, 25 Apr 2010 13:58:54 -0700
Subject: Re: [SDL] getting color information from indexed images?

haha, good

Date: Sun, 25 Apr 2010 01:39:08 -0400
From: @Donny_Viszneki
To: sdl at lists.libsdl.org
Subject: Re: [SDL] getting color information from indexed images?

Looks like SpeedyShare worked quite speedily!

On Sun, Apr 25, 2010 at 1:38 AM, Donny Viszneki <@Donny_Viszneki> wrote:

That’s weird, that is my email address.

If I had the root password for my server I would give you an FTP
account, but I need to get a hard drive out of an older machine and I
can’t even find it…

I’ll try one of your other links

On Sat, Apr 24, 2010 at 11:15 PM, Omar Eshmawi <neo_storm at live.com> wrote:

is this your email? @Donny_Viszneki
because I keep getting notifications of failure in my inbox

Date: Sat, 24 Apr 2010 05:14:33 -0400
From: @Donny_Viszneki
To: sdl at lists.libsdl.org
Subject: Re: [SDL] getting color information from indexed images?

Still waiting for that attachment :slight_smile:

On Fri, Apr 23, 2010 at 8:11 PM, Omar Eshmawi <neo_storm at live.com> wrote:

http://www.speedyshare.com/files/22093997/example_palette.zip
http://www.mediafire.com/?lozmdzmjyz0
http://www.megaupload.com/?d=E064R1JK
at first I tried to attach it, but I suppose you can’t send messages
larger
than 40 kb to the mailing list
and @donny I’ll send you the attachment just to be safe


Hotmail is redefining busy with tools for the New Busy. Get more
from
your
inbox. See how.


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


http://codebad.com/


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


The New Busy is not the old busy. Search, chat and e-mail from your
inbox.
Get started.


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


http://codebad.com/


http://codebad.com/


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


The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with
Hotmail. Get busy.


The New Busy is not the too busy. Combine all your e-mail accounts with
Hotmail. Get busy.


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


http://codebad.com/

ahh I see now, I was afraid of that. well at least now I know what my problem was, well thank you donny, you’ve been very helpful! :slight_smile:

cheers

-omar> Date: Thu, 6 May 2010 01:08:36 -0400

From: donny.viszneki at gmail.com
To: sdl at lists.libsdl.org
Subject: Re: [SDL] getting color information from indexed images?

Sorry, I was unable to do the test because it contains MSWindows-only
code, and I don’t have MSWindows :frowning:

Does your project require MSWindows-only code? I kind of suspect that
your bug might be caused by not actually getting what you think you’re
getting from the MSWindows APIs you’re using.

Okay, so I took out the Windows-specific stuff and I replaced a call
to your LoadBMP_Resource() function with a call to SDL_LoadBMP().

What I got for the palette is different from what you got for the palette:

donny at donny-desktop:~/palette/example_palette$ ./a.out
255 255 255
0 0 0
255 0 0
255 14 14
255 28 28
255 42 42
255 55 55
255 69 69
255 83 83
255 97 97
255 111 111
255 125 125
255 138 138
255 152 152
255 166 166
255 180 180
6 0 255
19 13 255
32 26 255
45 40 255
57 53 255
70 66 255
83 79 255
96 92 255
109 106 255
122 119 255
135 132 255
148 145 255
160 158 255
173 172 255
186 185 255
199 198 255
0 255 18
15 255 32
29 255 45
44 255 59
58 255 72
73 255 86
87 255 99
102 255 113
116 255 126
131 255 140
145 255 153
160 255 167
174 255 180
189 255 194
203 255 207
218 255 221
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 255 0

This information is confirmed by a look at resources/test.bmp. Here is
a screenshot:
http://codebad.com/d/omars-palette.png

I suspect that those old MSWindows APIs are fitting your image into
their own 256 color palette. IIRC MSWindows used to have a different
palette for each application that used an indexed color mode, and
switching focus between different application windows would result in
other applications’ windows on your screen looking funny when the
palette changed.

Try factoring out your MSWindows APIs as much as possible. Your
applications will be more portable and you’ll have access to more of
the source code you are invoking and therefore be able to troubleshoot
more effectively :slight_smile:

Sorry I took so long to check out your ZIP file. I have been moving
into a new apartment and replacing the carpet and painting the walls
:open_mouth:

On Wed, May 5, 2010 at 10:08 PM, Omar Eshmawi <@Omar_Eshmawi> wrote:

so… it would be nice to get some confirmation on whether anyone could ever
solve my problem or not?
I remember putting up 3 links to my example program that sam and donny
conveyed request for. But I never got a reply as to whether you guys were
able to figure it out or not? Please let me know if you want me to reupload
it.


From: @Omar_Eshmawi
To: sdl at lists.libsdl.org
Date: Sun, 25 Apr 2010 13:58:54 -0700
Subject: Re: [SDL] getting color information from indexed images?

haha, good

Date: Sun, 25 Apr 2010 01:39:08 -0400
From: donny.viszneki at gmail.com
To: sdl at lists.libsdl.org
Subject: Re: [SDL] getting color information from indexed images?

Looks like SpeedyShare worked quite speedily!

On Sun, Apr 25, 2010 at 1:38 AM, Donny Viszneki <donny.viszneki at gmail.com> wrote:

That’s weird, that is my email address.

If I had the root password for my server I would give you an FTP
account, but I need to get a hard drive out of an older machine and I
can’t even find it…

I’ll try one of your other links

On Sat, Apr 24, 2010 at 11:15 PM, Omar Eshmawi <@Omar_Eshmawi> wrote:

is this your email? donny.viszneki at gmail.com
because I keep getting notifications of failure in my inbox

Date: Sat, 24 Apr 2010 05:14:33 -0400
From: donny.viszneki at gmail.com
To: sdl at lists.libsdl.org
Subject: Re: [SDL] getting color information from indexed images?

Still waiting for that attachment :slight_smile:

On Fri, Apr 23, 2010 at 8:11 PM, Omar Eshmawi <@Omar_Eshmawi> wrote:

http://www.speedyshare.com/files/22093997/example_palette.zip
http://www.mediafire.com/?lozmdzmjyz0
http://www.megaupload.com/?d=E064R1JK
at first I tried to attach it, but I suppose you can’t send messages
larger
than 40 kb to the mailing list
and @donny I’ll send you the attachment just to be safe


Hotmail is redefining busy with tools for the New Busy. Get more
from
your
inbox. See how.


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


http://codebad.com/


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


The New Busy is not the old busy. Search, chat and e-mail from your
inbox.
Get started.


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


http://codebad.com/


http://codebad.com/


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


The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with
Hotmail. Get busy.


The New Busy is not the too busy. Combine all your e-mail accounts with
Hotmail. Get busy.


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


http://codebad.com/


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


The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5

my project does require loading bitmaps from resources though, those functions were the only ones I could find able to do that.> Date: Thu, 6 May 2010 01:08:36 -0400

From: donny.viszneki at gmail.com
To: sdl at lists.libsdl.org
Subject: Re: [SDL] getting color information from indexed images?

Sorry, I was unable to do the test because it contains MSWindows-only
code, and I don’t have MSWindows :frowning:

Does your project require MSWindows-only code? I kind of suspect that
your bug might be caused by not actually getting what you think you’re
getting from the MSWindows APIs you’re using.

Okay, so I took out the Windows-specific stuff and I replaced a call
to your LoadBMP_Resource() function with a call to SDL_LoadBMP().

What I got for the palette is different from what you got for the palette:

donny at donny-desktop:~/palette/example_palette$ ./a.out
255 255 255
0 0 0
255 0 0
255 14 14
255 28 28
255 42 42
255 55 55
255 69 69
255 83 83
255 97 97
255 111 111
255 125 125
255 138 138
255 152 152
255 166 166
255 180 180
6 0 255
19 13 255
32 26 255
45 40 255
57 53 255
70 66 255
83 79 255
96 92 255
109 106 255
122 119 255
135 132 255
148 145 255
160 158 255
173 172 255
186 185 255
199 198 255
0 255 18
15 255 32
29 255 45
44 255 59
58 255 72
73 255 86
87 255 99
102 255 113
116 255 126
131 255 140
145 255 153
160 255 167
174 255 180
189 255 194
203 255 207
218 255 221
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 255 0

This information is confirmed by a look at resources/test.bmp. Here is
a screenshot:

http://codebad.com/d/omars-palette.png

I suspect that those old MSWindows APIs are fitting your image into
their own 256 color palette. IIRC MSWindows used to have a different
palette for each application that used an indexed color mode, and
switching focus between different application windows would result in
other applications’ windows on your screen looking funny when the
palette changed.

Try factoring out your MSWindows APIs as much as possible. Your
applications will be more portable and you’ll have access to more of
the source code you are invoking and therefore be able to troubleshoot
more effectively :slight_smile:

Sorry I took so long to check out your ZIP file. I have been moving
into a new apartment and replacing the carpet and painting the walls
:open_mouth:

On Wed, May 5, 2010 at 10:08 PM, Omar Eshmawi <@Omar_Eshmawi> wrote:

so… it would be nice to get some confirmation on whether anyone could ever
solve my problem or not?
I remember putting up 3 links to my example program that sam and donny
conveyed request for. But I never got a reply as to whether you guys were
able to figure it out or not? Please let me know if you want me to reupload
it.


From: @Omar_Eshmawi
To: sdl at lists.libsdl.org
Date: Sun, 25 Apr 2010 13:58:54 -0700
Subject: Re: [SDL] getting color information from indexed images?

haha, good

Date: Sun, 25 Apr 2010 01:39:08 -0400
From: donny.viszneki at gmail.com
To: sdl at lists.libsdl.org
Subject: Re: [SDL] getting color information from indexed images?

Looks like SpeedyShare worked quite speedily!

On Sun, Apr 25, 2010 at 1:38 AM, Donny Viszneki <donny.viszneki at gmail.com> wrote:

That’s weird, that is my email address.

If I had the root password for my server I would give you an FTP
account, but I need to get a hard drive out of an older machine and I
can’t even find it…

I’ll try one of your other links

On Sat, Apr 24, 2010 at 11:15 PM, Omar Eshmawi <@Omar_Eshmawi> wrote:

is this your email? donny.viszneki at gmail.com
because I keep getting notifications of failure in my inbox

Date: Sat, 24 Apr 2010 05:14:33 -0400
From: donny.viszneki at gmail.com
To: sdl at lists.libsdl.org
Subject: Re: [SDL] getting color information from indexed images?

Still waiting for that attachment :slight_smile:

On Fri, Apr 23, 2010 at 8:11 PM, Omar Eshmawi <@Omar_Eshmawi> wrote:

http://www.speedyshare.com/files/22093997/example_palette.zip
http://www.mediafire.com/?lozmdzmjyz0
http://www.megaupload.com/?d=E064R1JK
at first I tried to attach it, but I suppose you can’t send messages
larger
than 40 kb to the mailing list
and @donny I’ll send you the attachment just to be safe


Hotmail is redefining busy with tools for the New Busy. Get more
from
your
inbox. See how.


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


http://codebad.com/


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


The New Busy is not the old busy. Search, chat and e-mail from your
inbox.
Get started.


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


http://codebad.com/


http://codebad.com/


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


The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with
Hotmail. Get busy.


The New Busy is not the too busy. Combine all your e-mail accounts with
Hotmail. Get busy.


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


http://codebad.com/


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


Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_1

y’know what, nevermind, forget that last post :PFrom: @Omar_Eshmawi
To: sdl at lists.libsdl.org
Date: Sun, 9 May 2010 18:02:38 -0700
Subject: Re: [SDL] getting color information from indexed images?

my project does require loading bitmaps from resources though, those functions were the only ones I could find able to do that.

Date: Thu, 6 May 2010 01:08:36 -0400
From: donny.viszneki at gmail.com
To: sdl at lists.libsdl.org
Subject: Re: [SDL] getting color information from indexed images?

Sorry, I was unable to do the test because it contains MSWindows-only
code, and I don’t have MSWindows :frowning:

Does your project require MSWindows-only code? I kind of suspect that
your bug might be caused by not actually getting what you think you’re
getting from the MSWindows APIs you’re using.

Okay, so I took out the Windows-specific stuff and I replaced a call
to your LoadBMP_Resource() function with a call to SDL_LoadBMP().

What I got for the palette is different from what you got for the palette:

donny at donny-desktop:~/palette/example_palette$ ./a.out
255 255 255
0 0 0
255 0 0
255 14 14
255 28 28
255 42 42
255 55 55
255 69 69
255 83 83
255 97 97
255 111 111
255 125 125
255 138 138
255 152 152
255 166 166
255 180 180
6 0 255
19 13 255
32 26 255
45 40 255
57 53 255
70 66 255
83 79 255
96 92 255
109 106 255
122 119 255
135 132 255
148 145 255
160 158 255
173 172 255
186 185 255
199 198 255
0 255 18
15 255 32
29 255 45
44 255 59
58 255 72
73 255 86
87 255 99
102 255 113
116 255 126
131 255 140
145 255 153
160 255 167
174 255 180
189 255 194
203 255 207
218 255 221
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 255 0

This information is confirmed by a look at resources/test.bmp. Here is
a screenshot:

http://codebad.com/d/omars-palette.png

I suspect that those old MSWindows APIs are fitting your image into
their own 256 color palette. IIRC MSWindows used to have a different
palette for each application that used an indexed color mode, and
switching focus between different application windows would result in
other applications’ windows on your screen looking funny when the
palette changed.

Try factoring out your MSWindows APIs as much as possible. Your
applications will be more portable and you’ll have access to more of
the source code you are invoking and therefore be able to troubleshoot
more effectively :slight_smile:

Sorry I took so long to check out your ZIP file. I have been moving
into a new apartment and replacing the carpet and painting the walls
:open_mouth:

On Wed, May 5, 2010 at 10:08 PM, Omar Eshmawi <@Omar_Eshmawi> wrote:

so… it would be nice to get some confirmation on whether anyone could ever
solve my problem or not?
I remember putting up 3 links to my example program that sam and donny
conveyed request for. But I never got a reply as to whether you guys were
able to figure it out or not? Please let me know if you want me to reupload
it.


From: @Omar_Eshmawi
To: sdl at lists.libsdl.org
Date: Sun, 25 Apr 2010 13:58:54 -0700
Subject: Re: [SDL] getting color information from indexed images?

haha, good

Date: Sun, 25 Apr 2010 01:39:08 -0400
From: donny.viszneki at gmail.com
To: sdl at lists.libsdl.org
Subject: Re: [SDL] getting color information from indexed images?

Looks like SpeedyShare worked quite speedily!

On Sun, Apr 25, 2010 at 1:38 AM, Donny Viszneki <donny.viszneki at gmail.com> wrote:

That’s weird, that is my email address.

If I had the root password for my server I would give you an FTP
account, but I need to get a hard drive out of an older machine and I
can’t even find it…

I’ll try one of your other links

On Sat, Apr 24, 2010 at 11:15 PM, Omar Eshmawi <@Omar_Eshmawi> wrote:

is this your email? donny.viszneki at gmail.com
because I keep getting notifications of failure in my inbox

Date: Sat, 24 Apr 2010 05:14:33 -0400
From: donny.viszneki at gmail.com
To: sdl at lists.libsdl.org
Subject: Re: [SDL] getting color information from indexed images?

Still waiting for that attachment :slight_smile:

On Fri, Apr 23, 2010 at 8:11 PM, Omar Eshmawi <@Omar_Eshmawi> wrote:

http://www.speedyshare.com/files/22093997/example_palette.zip
http://www.mediafire.com/?lozmdzmjyz0
http://www.megaupload.com/?d=E064R1JK
at first I tried to attach it, but I suppose you can’t send messages
larger
than 40 kb to the mailing list
and @donny I’ll send you the attachment just to be safe


Hotmail is redefining busy with tools for the New Busy. Get more
from
your
inbox. See how.


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


http://codebad.com/


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


The New Busy is not the old busy. Search, chat and e-mail from your
inbox.
Get started.


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


http://codebad.com/


http://codebad.com/


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


The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with
Hotmail. Get busy.


The New Busy is not the too busy. Combine all your e-mail accounts with
Hotmail. Get busy.


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


http://codebad.com/


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

Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox. Learn more.


The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4

I thought I would post this in case it peaked anyone’s interests. Maybe that of others who like using windows resources compiled into the executable. For one thing the resources themselves were custom resources (declared by naming a resource any made up type name) and that alone made them more difficult to work with to fill out the bmiColors member. and those random palettes I got before I think were because I didn’t even set the bmiColors member of a bitmapinfo, and I looked in the source for SDL_Bitmaps or SDL_Bitmap.c or whatever it’s called and it looks like it too does stuff with bitmapinfo structures. but it didn’t fill things out with my custom resources because they were so raw or whatever, they weren’t even BITMAP resources just custom. so this code worked for bitmaps
BITMAPINFO * bmi;
bmi = (BITMAPINFO*)malloc(sizeof(BITMAPINFOHEADER)+256sizeof(RGBQUAD));
memmove(bmi,(void((int)GetBufferFromResource(obj_shptst_a)+14),sizeof(BITMAPINFOHEADER)+256
sizeof(RGBQUAD));

for(int p = 0;p<256;p++){
cout<<(int)bmi->bmiColors[p].rgbRed;
cout<<" “;
cout<<(int)bmi->bmiColors[p].rgbGreen;
cout<<” ";
cout<<(int)bmi->bmiColors[p].rgbBlue;
cout<<endl;
}
and um, it’s hard to explain and I’m probably not doing a great job as I don’t understand it too well myself, but that memmove function sort of does the trick, and the colors are messed up because maybe the resource is misaligned or something since after much fiddling around adding some offset to the resource seems to do the trick. I didn’t bother figuring out the mechanics of it, it’s probably +sizeof(something) but tests showed that 14 seems to usually do the trick with 8bit palettized bitmaps. I know this probably all looks unnecessary as opposed to just using files or whatever, but it’s nice to have multiple options right? It’s not too big a deal but I figured it was worth mentioning, (+I had a heck of a time trying to figure it out !).
/source if you feel like checking it out
http://www.speedyshare.com/files/22475796/example_palette.zipFrom: @Omar_Eshmawi
To: sdl at lists.libsdl.org
Date: Sat, 8 May 2010 15:24:09 -0700
Subject: Re: [SDL] getting color information from indexed images?

ahh I see now, I was afraid of that. well at least now I know what my problem was, well thank you donny, you’ve been very helpful! :slight_smile:

cheers

-omar

Date: Thu, 6 May 2010 01:08:36 -0400
From: donny.viszneki at gmail.com
To: sdl at lists.libsdl.org
Subject: Re: [SDL] getting color information from indexed images?

Sorry, I was unable to do the test because it contains MSWindows-only
code, and I don’t have MSWindows :frowning:

Does your project require MSWindows-only code? I kind of suspect that
your bug might be caused by not actually getting what you think you’re
getting from the MSWindows APIs you’re using.

Okay, so I took out the Windows-specific stuff and I replaced a call
to your LoadBMP_Resource() function with a call to SDL_LoadBMP().

What I got for the palette is different from what you got for the palette:

donny at donny-desktop:~/palette/example_palette$ ./a.out
255 255 255
0 0 0
255 0 0
255 14 14
255 28 28
255 42 42
255 55 55
255 69 69
255 83 83
255 97 97
255 111 111
255 125 125
255 138 138
255 152 152
255 166 166
255 180 180
6 0 255
19 13 255
32 26 255
45 40 255
57 53 255
70 66 255
83 79 255
96 92 255
109 106 255
122 119 255
135 132 255
148 145 255
160 158 255
173 172 255
186 185 255
199 198 255
0 255 18
15 255 32
29 255 45
44 255 59
58 255 72
73 255 86
87 255 99
102 255 113
116 255 126
131 255 140
145 255 153
160 255 167
174 255 180
189 255 194
203 255 207
218 255 221
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 0 216
255 255 0

This information is confirmed by a look at resources/test.bmp. Here is
a screenshot:
http://codebad.com/d/omars-palette.png

I suspect that those old MSWindows APIs are fitting your image into
their own 256 color palette. IIRC MSWindows used to have a different
palette for each application that used an indexed color mode, and
switching focus between different application windows would result in
other applications’ windows on your screen looking funny when the
palette changed.

Try factoring out your MSWindows APIs as much as possible. Your
applications will be more portable and you’ll have access to more of
the source code you are invoking and therefore be able to troubleshoot
more effectively :slight_smile:

Sorry I took so long to check out your ZIP file. I have been moving
into a new apartment and replacing the carpet and painting the walls
:open_mouth:

On Wed, May 5, 2010 at 10:08 PM, Omar Eshmawi <@Omar_Eshmawi> wrote:

so… it would be nice to get some confirmation on whether anyone could ever
solve my problem or not?
I remember putting up 3 links to my example program that sam and donny
conveyed request for. But I never got a reply as to whether you guys were
able to figure it out or not? Please let me know if you want me to reupload
it.


From: @Omar_Eshmawi
To: sdl at lists.libsdl.org
Date: Sun, 25 Apr 2010 13:58:54 -0700
Subject: Re: [SDL] getting color information from indexed images?

haha, good

Date: Sun, 25 Apr 2010 01:39:08 -0400
From: donny.viszneki at gmail.com
To: sdl at lists.libsdl.org
Subject: Re: [SDL] getting color information from indexed images?

Looks like SpeedyShare worked quite speedily!

On Sun, Apr 25, 2010 at 1:38 AM, Donny Viszneki <donny.viszneki at gmail.com> wrote:

That’s weird, that is my email address.

If I had the root password for my server I would give you an FTP
account, but I need to get a hard drive out of an older machine and I
can’t even find it…

I’ll try one of your other links

On Sat, Apr 24, 2010 at 11:15 PM, Omar Eshmawi <@Omar_Eshmawi> wrote:

is this your email? donny.viszneki at gmail.com
because I keep getting notifications of failure in my inbox

Date: Sat, 24 Apr 2010 05:14:33 -0400
From: donny.viszneki at gmail.com
To: sdl at lists.libsdl.org
Subject: Re: [SDL] getting color information from indexed images?

Still waiting for that attachment :slight_smile:

On Fri, Apr 23, 2010 at 8:11 PM, Omar Eshmawi <@Omar_Eshmawi> wrote:

http://www.speedyshare.com/files/22093997/example_palette.zip
http://www.mediafire.com/?lozmdzmjyz0
http://www.megaupload.com/?d=E064R1JK
at first I tried to attach it, but I suppose you can’t send messages
larger
than 40 kb to the mailing list
and @donny I’ll send you the attachment just to be safe


Hotmail is redefining busy with tools for the New Busy. Get more
from
your
inbox. See how.


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


http://codebad.com/


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


The New Busy is not the old busy. Search, chat and e-mail from your
inbox.
Get started.


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


http://codebad.com/


http://codebad.com/


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


The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with
Hotmail. Get busy.


The New Busy is not the too busy. Combine all your e-mail accounts with
Hotmail. Get busy.


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


http://codebad.com/


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

The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with Hotmail. Get busy.


The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5