I can't test this code, but it seems something like:
Code:
function getpixel(surface: SDL_Surface; num: integer): cardinal;
var bpp: integer;
p: PByte;
begin
bpp := surface.format.BytesPerPixel;
p := pointer(surface.pixels + num * bpp);
case bpp of
1: result := p^;
2: result := PWord(p)^;
3: begin
if (SDL_BYTEORDER = SDL_BIG_ENDIAN)
result := p[0] shl 16 or p[1] shl 8 or p[2]
else
result := p[0] or p[1] shl 8 or p[2] shl 16;
end;
4: result := PCardinal(p)^;
default: result := 0;
end;
end;
edit: If you have the pixel, you can try this function
http://www.libsdl.org/release/SDL-1....sdlgetrgb.html
or
http://www.libsdl.org/release/SDL-1....dlgetrgba.html
Bookmarks