PDA

View Full Version : Pixel format is read-only?



masonwheeler
03-04-2008, 03:35 PM
From SDL.pas:
// Everything in the pixel format structure is read-only
PSDL_PixelFormat = ^TSDL_PixelFormat;
TSDL_PixelFormat = record
palette: PSDL_Palette;
BitsPerPixel: UInt8;
BytesPerPixel: UInt8;
Rloss: UInt8;
Gloss: UInt8;
Bloss: UInt8;
Aloss: UInt8;
Rshift: UInt8;
Gshift: UInt8;
Bshift: UInt8;
Ashift: UInt8;
RMask: UInt32;
GMask: UInt32;
BMask: UInt32;
AMask: UInt32;
colorkey: UInt32; // RGB color key information
alpha: UInt8; // Alpha value information (per-surface alpha)
end;


Why is this entire record stated to be read-only? I'm trying to set up a routine to load an image format not covered by SDL_image, and I need access to the palette. What's going on here, and how can I work around it?

savage
03-04-2008, 09:28 PM
It's read only because SDL is the only thing that is allowed to change it.

If you want to manipulate the palette you'll need to do it some other way. If you have a look at the JEDI-SDL demos, you should find a palette example that should hopefully get you started.