1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| LLoadedImage := IMG_Load(PChar(AFilename));
if LLoadedImage = nil then
begin
WriteLn(Format('Could not load image %s.', [AFilename]));
Exit;
end;
{ Convert the image to the screen's native format }
LOptimizedImage := SDL_DisplayFormat(LLoadedImage);
SDL_FreeSurface(LLoadedImage);
if LOptimizedImage = nil then
begin
WriteLn(Format('Failed to convert image %s to native format', [AFilename]));
Exit;
end;
LColorKey:=SDL_MapRGB(LOptimizedImage^.format, 0, 0, 0);
SDL_SetColorKey(LOptimizedImage, SDL_RLEACCEL or SDL_SRCCOLORKEY, LColorKey); |
Partager