[pascal]procedure TS2DLImage.CopyBitmap(X, Y: Integer; BMP: TBitmap;
TransparentColor: UInt32);
var
bits : Pointer;
I,J, bpp, r, g, b : Uint8;
Color : UInt32;
begin
if ( SDL_LockSurface( ImageSurface ) < 0 ) then
exit;
bpp := ImageSurface.format.BytesPerPixel;
For I := 0 to BMP.Width-1 do
For J := 0 to BMP.Height-1 do
Begin
Color := BMP.Canvas.Pixels[I,J];
If Color <> TransparentColor then
Begin
bits := @(PixelArray(ImageSurface.Pixels^)[((Y+I) * ImageSurface.pitch) + ((X+J) * bpp)]);
// Set the pixel
case bpp of
1:
begin
PUint8( bits )^ := Uint8(Color);
end;
2:
begin
PUint16(bits)^ := Uint16(Color);
end;
3:
begin // Format/endian independent
r := (Color shr ImageSurface.format.Rshift ) and $FF;
g := (Color shr ImageSurface.format.Gshift ) and $FF;
b := (Color shr ImageSurface.format.Bshift ) and $FF;
PixelFormat(bits^)[(ImageSurface.format.Rshift div ] := r;
PixelFormat(bits^)[(ImageSurface.format.Gshift div ] := g;
PixelFormat(bits^)[(ImageSurface.format.Bshift div ] := b;
end;
4:
begin
PUInt32(bits)^ := Uint32( Color );
end;
end;
End;
End;
// Update the display
SDL_UnlockSurface(ImageSurface);
SDL_UpdateRect(ImageSurface, X, Y, BMP.Width, BMP.Height);
end;
[/pascal]

Dont think it will be great performance, but it does work