Browse Source

* added SDL support

master
Bergmann89 10 years ago
parent
commit
68113a32f5
1 changed files with 89 additions and 152 deletions
  1. +89
    -152
      glBitmap.pas

+ 89
- 152
glBitmap.pas View File

@@ -227,10 +227,10 @@ unit glBitmap;

// activate to enable build-in OpenGL support with dynamically linked methods
// use dglOpenGL.pas if not enabled
{$DEFINE GLB_NATIVE_OGL_DYNAMIC}
{.$DEFINE GLB_NATIVE_OGL_DYNAMIC}

// activate to enable the support for SDL_surfaces
{.$DEFINE GLB_SDL}
{$DEFINE GLB_SDL}

// activate to enable the support for TBitmap from Delphi (not lazarus)
{.$DEFINE GLB_DELPHI}
@@ -239,7 +239,7 @@ unit glBitmap;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// activate to enable the support of SDL_image to load files. (READ ONLY)
// If you enable SDL_image all other libraries will be ignored!
{.$DEFINE GLB_SDL_IMAGE}
{$DEFINE GLB_SDL_IMAGE}

// activate to enable png support with the unit pngimage. You can download it from http://pngdelphi.sourceforge.net/
// if you enable pngimage the libPNG will be ignored
@@ -681,7 +681,7 @@ type
EglBitmapException = class(Exception);
EglBitmapSizeToLargeException = class(EglBitmapException);
EglBitmapNonPowerOfTwoException = class(EglBitmapException);
EglBitmapUnsupportedFormatFormat = class(EglBitmapException);
EglBitmapUnsupportedFormat = class(EglBitmapException);

////////////////////////////////////////////////////////////////////////////////////////////////////
TglBitmapFormat = (
@@ -977,14 +977,12 @@ type
constructor Create(const aInstance: Cardinal; const aResourceID: Integer; const aResType: PChar); overload;
{$ENDIF}
private
{$IFDEF GLB_SUPPORT_PNG_READ}
function LoadPNG(const aStream: TStream): Boolean; virtual;
procedure SavePNG(const aStream: TStream); virtual;
{$ENDIF}
{$IFDEF GLB_SUPPORT_JPEG_READ}
function LoadJPEG(const aStream: TStream): Boolean; virtual;
procedure SaveJPEG(const aStream: TStream); virtual;
{$ENDIF}
{$IFDEF GLB_SUPPORT_PNG_READ} function LoadPNG(const aStream: TStream): Boolean; virtual; {$ENDIF}
{$ifdef GLB_SUPPORT_PNG_WRITE} procedure SavePNG(const aStream: TStream); virtual; {$ENDIF}

{$IFDEF GLB_SUPPORT_JPEG_READ} function LoadJPEG(const aStream: TStream): Boolean; virtual; {$ENDIF}
{$IFDEF GLB_SUPPORT_JPEG_WRITE} procedure SaveJPEG(const aStream: TStream); virtual; {$ENDIF}

function LoadBMP(const aStream: TStream): Boolean; virtual;
procedure SaveBMP(const aStream: TStream); virtual;

@@ -1140,10 +1138,10 @@ type

TFormatDescriptor = class(TObject)
private
function GetRedMask: UInt64;
function GetGreenMask: UInt64;
function GetBlueMask: UInt64;
function GetAlphaMask: UInt64;
function GetRedMask: QWord;
function GetGreenMask: QWord;
function GetBlueMask: QWord;
function GetAlphaMask: QWord;
protected
fFormat: TglBitmapFormat;
fWithAlpha: TglBitmapFormat;
@@ -1177,10 +1175,10 @@ type
property Range: TglBitmapColorRec read fRange;
property Shift: TShiftRec read fShift;

property RedMask: UInt64 read GetRedMask;
property GreenMask: UInt64 read GetGreenMask;
property BlueMask: UInt64 read GetBlueMask;
property AlphaMask: UInt64 read GetAlphaMask;
property RedMask: QWord read GetRedMask;
property GreenMask: QWord read GetGreenMask;
property BlueMask: QWord read GetBlueMask;
property AlphaMask: QWord read GetAlphaMask;

procedure Map(const aPixel: TglBitmapPixelData; var aData: PByte; var aMapData: Pointer); virtual; abstract;
procedure Unmap(var aData: PByte; out aPixel: TglBitmapPixelData; var aMapData: Pointer); virtual; abstract;
@@ -1193,7 +1191,7 @@ type

function IsEmpty: Boolean; virtual;
function HasAlpha: Boolean; virtual;
function MaskMatch(const aRedMask, aGreenMask, aBlueMask, aAlphaMask: UInt64): Boolean; virtual;
function MaskMatch(const aRedMask, aGreenMask, aBlueMask, aAlphaMask: QWord): Boolean; virtual;

procedure PreparePixel(out aPixel: TglBitmapPixelData); virtual;

@@ -1532,17 +1530,17 @@ type
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TbmpBitfieldFormat = class(TFormatDescriptor)
private
procedure SetRedMask (const aValue: UInt64);
procedure SetGreenMask(const aValue: UInt64);
procedure SetBlueMask (const aValue: UInt64);
procedure SetAlphaMask(const aValue: UInt64);
procedure SetRedMask (const aValue: QWord);
procedure SetGreenMask(const aValue: QWord);
procedure SetBlueMask (const aValue: QWord);
procedure SetAlphaMask(const aValue: QWord);

procedure Update(aMask: UInt64; out aRange: Cardinal; out aShift: Byte);
procedure Update(aMask: QWord; out aRange: Cardinal; out aShift: Byte);
public
property RedMask: UInt64 read GetRedMask write SetRedMask;
property GreenMask: UInt64 read GetGreenMask write SetGreenMask;
property BlueMask: UInt64 read GetBlueMask write SetBlueMask;
property AlphaMask: UInt64 read GetAlphaMask write SetAlphaMask;
property RedMask: QWord read GetRedMask write SetRedMask;
property GreenMask: QWord read GetGreenMask write SetGreenMask;
property BlueMask: QWord read GetBlueMask write SetBlueMask;
property AlphaMask: QWord read GetAlphaMask write SetAlphaMask;

property PixelSize: Single read fPixelSize write fPixelSize;

@@ -1803,7 +1801,7 @@ begin
end;

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function GetTopMostBit(aBitSet: UInt64): Integer;
function GetTopMostBit(aBitSet: QWord): Integer;
begin
result := 0;
while aBitSet > 0 do begin
@@ -1813,7 +1811,7 @@ begin
end;

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function CountSetBits(aBitSet: UInt64): Integer;
function CountSetBits(aBitSet: QWord): Integer;
begin
result := 0;
while aBitSet > 0 do begin
@@ -2126,8 +2124,10 @@ end;
{$ENDIF}
*)

(* TODO GLB_SDL_IMAGE
{$IFDEF GLB_SDL_IMAGE}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// SDL Image Helper /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function glBitmapRWseek(context: PSDL_RWops; offset: Integer; whence: Integer): Integer; cdecl;
begin
result := TStream(context^.unknown.data1).Seek(offset, whence);
@@ -2162,7 +2162,6 @@ begin
result^.unknown.data1 := Stream;
end;
{$ENDIF}
*)

(* TODO LoadFuncs
function LoadTexture(Filename: String; var Texture: Cardinal{$IFDEF GLB_DELPHI}; LoadFromRes : Boolean; Instance: Cardinal{$ENDIF}): Boolean;
@@ -2366,25 +2365,25 @@ end;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//TglBitmapFormatDescriptor///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function TFormatDescriptor.GetRedMask: UInt64;
function TFormatDescriptor.GetRedMask: QWord;
begin
result := fRange.r shl fShift.r;
end;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function TFormatDescriptor.GetGreenMask: UInt64;
function TFormatDescriptor.GetGreenMask: QWord;
begin
result := fRange.g shl fShift.g;
end;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function TFormatDescriptor.GetBlueMask: UInt64;
function TFormatDescriptor.GetBlueMask: QWord;
begin
result := fRange.b shl fShift.b;
end;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function TFormatDescriptor.GetAlphaMask: UInt64;
function TFormatDescriptor.GetAlphaMask: QWord;
begin
result := fRange.a shl fShift.a;
end;
@@ -2447,7 +2446,7 @@ begin
end;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function TFormatDescriptor.MaskMatch(const aRedMask, aGreenMask, aBlueMask, aAlphaMask: UInt64): Boolean;
function TFormatDescriptor.MaskMatch(const aRedMask, aGreenMask, aBlueMask, aAlphaMask: QWord): Boolean;
begin
result := false;

@@ -3781,31 +3780,31 @@ end;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//TBitfieldFormat/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure TbmpBitfieldFormat.SetRedMask(const aValue: UInt64);
procedure TbmpBitfieldFormat.SetRedMask(const aValue: QWord);
begin
Update(aValue, fRange.r, fShift.r);
end;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure TbmpBitfieldFormat.SetGreenMask(const aValue: UInt64);
procedure TbmpBitfieldFormat.SetGreenMask(const aValue: QWord);
begin
Update(aValue, fRange.g, fShift.g);
end;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure TbmpBitfieldFormat.SetBlueMask(const aValue: UInt64);
procedure TbmpBitfieldFormat.SetBlueMask(const aValue: QWord);
begin
Update(aValue, fRange.b, fShift.b);
end;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure TbmpBitfieldFormat.SetAlphaMask(const aValue: UInt64);
procedure TbmpBitfieldFormat.SetAlphaMask(const aValue: QWord);
begin
Update(aValue, fRange.a, fShift.a);
end;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure TbmpBitfieldFormat.Update(aMask: UInt64; out aRange: Cardinal; out
procedure TbmpBitfieldFormat.Update(aMask: QWord; out aRange: Cardinal; out
aShift: Byte);
begin
aShift := 0;
@@ -3829,10 +3828,8 @@ end;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure TbmpBitfieldFormat.Map(const aPixel: TglBitmapPixelData; var aData: PByte; var aMapData: Pointer);
var
data: UInt64;
data: QWord;
s: Integer;
type
PUInt64 = ^UInt64;
begin
data :=
((aPixel.Data.r and fRange.r) shl fShift.r) or
@@ -3844,7 +3841,7 @@ begin
1: aData^ := data;
2: PWord(aData)^ := data;
4: PCardinal(aData)^ := data;
8: PUInt64(aData)^ := data;
8: PQWord(aData)^ := data;
else
raise EglBitmapException.CreateFmt('invalid pixel size: %.1f', [fPixelSize]);
end;
@@ -3854,17 +3851,15 @@ end;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure TbmpBitfieldFormat.Unmap(var aData: PByte; out aPixel: TglBitmapPixelData; var aMapData: Pointer);
var
data: UInt64;
data: QWord;
s, i: Integer;
type
PUInt64 = ^UInt64;
begin
s := Round(fPixelSize);
case s of
1: data := aData^;
2: data := PWord(aData)^;
4: data := PCardinal(aData)^;
8: data := PUInt64(aData)^;
8: data := PQWord(aData)^;
else
raise EglBitmapException.CreateFmt('invalid pixel size: %.1f', [fPixelSize]);
end;
@@ -3956,10 +3951,8 @@ end;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure TbmpColorTableFormat.Unmap(var aData: PByte; out aPixel: TglBitmapPixelData; var aMapData: Pointer);
type
PUInt64 = ^UInt64;
var
idx: UInt64;
idx: QWord;
s: Integer;
bits: Byte;
f: Single;
@@ -3972,7 +3965,7 @@ begin
1: idx := aData^;
2: idx := PWord(aData)^;
4: idx := PCardinal(aData)^;
8: idx := PUInt64(aData)^;
8: idx := PQWord(aData)^;
else
raise EglBitmapException.CreateFmt('invalid pixel size: %.3f', [fPixelSize]);
end;
@@ -4227,7 +4220,7 @@ begin
if fFormat = aValue then
exit;
if TFormatDescriptor.Get(Format).PixelSize <> TFormatDescriptor.Get(aValue).PixelSize then
raise EglBitmapUnsupportedFormatFormat.Create('SetInternalFormat - ' + UNSUPPORTED_FORMAT);
raise EglBitmapUnsupportedFormat.Create('SetFormat');
SetDataPointer(Data, aValue, Width, Height);
end;

@@ -4603,42 +4596,37 @@ var
Row, RowSize: Integer;
SourceData, TmpData: PByte;
TempDepth: Integer;
Pix: TglBitmapPixelData;
FormatDesc: TglBitmapFormatDescriptor;
FormatDesc: TFormatDescriptor;

function GetRowPointer(Row: Integer): pByte;
begin
result := Surface.pixels;
result := aSurface.pixels;
Inc(result, Row * RowSize);
end;

begin
result := false;

(* TODO
if not FormatIsUncompressed(InternalFormat) then
raise EglBitmapUnsupportedInternalFormat.Create('AssignToSurface - ' + UNSUPPORTED_INTERNAL_FORMAT);
*)
FormatDesc := TFormatDescriptor.Get(Format);
if FormatDesc.IsCompressed then
raise EglBitmapUnsupportedFormat.Create('AssignToSurface');

FormatDesc := FORMAT_DESCRIPTORS[Format];
if Assigned(Data) then begin
case Trunc(FormatDesc.GetSize) of
case Trunc(FormatDesc.PixelSize) of
1: TempDepth := 8;
2: TempDepth := 16;
3: TempDepth := 24;
4: TempDepth := 32;
else
raise EglBitmapException.Create('AssignToSurface - ' + UNSUPPORTED_INTERNAL_FORMAT);
raise EglBitmapUnsupportedFormat.Create('AssignToSurface');
end;
FormatDesc.PreparePixel(Pix);
with Pix.PixelDesc do
Surface := SDL_CreateRGBSurface(SDL_SWSURFACE, Width, Height, TempDepth,
RedRange shl RedShift, GreenRange shl GreenShift, BlueRange shl BlueShift, AlphaRange shl AlphaShift);

aSurface := SDL_CreateRGBSurface(SDL_SWSURFACE, Width, Height, TempDepth,
FormatDesc.RedMask, FormatDesc.GreenMask, FormatDesc.BlueMask, FormatDesc.AlphaMask);
SourceData := Data;
RowSize := Ceil(FileWidth * FormatDesc.GetSize);
RowSize := FormatDesc.GetSize(FileWidth, 1);

for Row := 0 to FileHeight -1 do begin
for Row := 0 to FileHeight-1 do begin
TmpData := GetRowPointer(Row);
if Assigned(TmpData) then begin
Move(SourceData^, TmpData^, RowSize);
@@ -4654,34 +4642,31 @@ function TglBitmap.AssignFromSurface(const aSurface: PSDL_Surface): Boolean;
var
pSource, pData, pTempData: PByte;
Row, RowSize, TempWidth, TempHeight: Integer;
IntFormat, f: TglBitmapInternalFormat;
FormatDesc: TglBitmapFormatDescriptor;
IntFormat: TglBitmapFormat;
FormatDesc: TFormatDescriptor;

function GetRowPointer(Row: Integer): pByte;
begin
result := Surface^.pixels;
result := aSurface^.pixels;
Inc(result, Row * RowSize);
end;

begin
result := false;
if (Assigned(Surface)) then begin
with Surface^.format^ do begin
IntFormat := tfEmpty;
for f := Low(f) to High(f) do begin
if FORMAT_DESCRIPTORS[f].MaskMatch(RMask, GMask, BMask, AMask) then begin
IntFormat := f;
if (Assigned(aSurface)) then begin
with aSurface^.format^ do begin
for IntFormat := High(TglBitmapFormat) to Low(TglBitmapFormat) do begin
FormatDesc := TFormatDescriptor.Get(IntFormat);
if (FormatDesc.MaskMatch(RMask, GMask, BMask, AMask)) then
break;
end;
end;
if (IntFormat = tfEmpty) then
raise EglBitmapException.Create('AssignFromSurface - Invalid Pixelformat.');
end;

FormatDesc := FORMAT_DESCRIPTORS[IntFormat];
TempWidth := Surface^.w;
TempHeight := Surface^.h;
RowSize := Trunc(TempWidth * FormatDesc.GetSize);
TempWidth := aSurface^.w;
TempHeight := aSurface^.h;
RowSize := FormatDesc.GetSize(TempWidth, 1);
GetMem(pData, TempHeight * RowSize);
try
pTempData := pData;
@@ -4721,9 +4706,9 @@ begin

AlphaInterleave := 0;
case Format of
ifLuminance8Alpha8:
tfLuminance8Alpha8:
AlphaInterleave := 1;
ifBGRA8, ifRGBA8:
tfBGRA8, tfRGBA8:
AlphaInterleave := 3;
end;

@@ -4745,14 +4730,14 @@ begin
end;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function TglBitmap.AddAlphaFromSurface(const aSurface: PSDL_Surface; const aFunc: TglBitmapFunction; const aArgs: PtrInt): Boolean;
function TglBitmap.AddAlphaFromSurface(const aSurface: PSDL_Surface; const aFunc: TglBitmapFunction = nil; const aArgs: Pointer = nil): Boolean;
var
bmp: TglBitmap2D;
begin
bmp := TglBitmap2D.Create;
try
bmp.AssignFromSurface(Surface);
result := AddAlphaFromGlBitmap(bmp, Func, CustomData);
bmp.AssignFromSurface(aSurface);
result := AddAlphaFromGlBitmap(bmp, aFunc, aArgs);
finally
bmp.Free;
end;
@@ -5147,7 +5132,7 @@ begin
FormatDesc := TFormatDescriptor.Get(Format);
if Assigned(Data) then begin
if FormatDesc.IsCompressed or not FormatDesc.HasAlpha then
raise EglBitmapUnsupportedFormatFormat.Create('RemoveAlpha - ' + UNSUPPORTED_FORMAT);
raise EglBitmapUnsupportedFormat.Create('RemoveAlpha');
result := ConvertTo(FormatDesc.WithoutAlpha);
end;
end;
@@ -5522,7 +5507,7 @@ begin
Surface := IMG_LoadPNG_RW(RWops);
try
AssignFromSurface(Surface);
Rresult := true;
result := true;
finally
SDL_FreeSurface(Surface);
end;
@@ -5922,40 +5907,6 @@ type
DestBuffer: array [1..4096] of byte;
end;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
{
procedure glBitmap_libJPEG_error_exit(cinfo: j_common_ptr); cdecl;
var
Msg: String;
begin
SetLength(Msg, 256);
cinfo^.err^.format_message(cinfo, pChar(Msg));
Writeln('ERROR [' + IntToStr(cinfo^.err^.msg_code) + '] ' + Msg);
cinfo^.global_state := 0;
jpeg_abort(cinfo);
end;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
{
procedure glBitmap_libJPEG_output_message(cinfo: j_common_ptr); cdecl;
var
Msg: String;
begin
SetLength(Msg, 256);
cinfo^.err^.format_message(cinfo, pChar(Msg));
Writeln('OUTPUT [' + IntToStr(cinfo^.err^.msg_code) + '] ' + Msg);
cinfo^.global_state := 0;
end;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
{
procedure glBitmap_libJPEG_init_source(cinfo: j_decompress_ptr); cdecl;
begin
end;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function glBitmap_libJPEG_fill_input_buffer(cinfo: j_decompress_ptr): boolean; cdecl;
var
@@ -5997,20 +5948,6 @@ begin
end;
end;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
{
procedure glBitmap_libJPEG_term_source(cinfo: j_decompress_ptr); cdecl;
begin
end;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
{
procedure glBitmap_libJPEG_init_destination(cinfo: j_compress_ptr); cdecl;
begin
end;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function glBitmap_libJPEG_empty_output_buffer(cinfo: j_compress_ptr): boolean; cdecl;
var
@@ -6062,7 +5999,7 @@ var
begin
result := false;

RWops := glBitmapCreateRWops(Stream);
RWops := glBitmapCreateRWops(aStream);
try
if IMG_isJPG(RWops) > 0 then begin
Surface := IMG_LoadJPG_RW(RWops);
@@ -6622,7 +6559,7 @@ var

begin
if not (ftBMP in FormatGetSupportedFiles(Format)) then
raise EglBitmapUnsupportedFormatFormat.Create('SaveBMP - ' + UNSUPPORTED_FORMAT);
raise EglBitmapUnsupportedFormat.Create('SaveBMP');

Converter := nil;
FormatDesc := TFormatDescriptor.Get(Format);
@@ -6687,7 +6624,7 @@ begin
Info.biCompression := BMP_COMP_BITFIELDS;
end;
else
raise EglBitmapUnsupportedFormatFormat.Create('SaveBMP - ' + UNSUPPORTED_FORMAT);
raise EglBitmapUnsupportedFormat.Create('SaveBMP - ' + UNSUPPORTED_FORMAT);
end;
Info.biXPelsPerMeter := 2835;
Info.biYPelsPerMeter := 2835;
@@ -6804,7 +6741,7 @@ const
function TglBitmap.LoadTGA(const aStream: TStream): Boolean;
var
Header: TTGAHeader;
ImageData: PByte;
ImageData: System.PByte;
StartPosition: Int64;
PixelSize, LineSize: Integer;
tgaFormat: TglBitmapFormat;
@@ -6822,7 +6759,7 @@ const
procedure ReadUncompressed;
var
i, j: Integer;
buf, tmp1, tmp2: PByte;
buf, tmp1, tmp2: System.PByte;
begin
buf := nil;
if (Counter.X.dir < 0) then
@@ -6856,7 +6793,7 @@ const

/////////////////////////////////////////////////////////////////
var
TmpData: PByte;
TmpData: System.PByte;
LinePixelsRead: Integer;
procedure CheckLine;
begin
@@ -7083,7 +7020,7 @@ var
Converter: TFormatDescriptor;
begin
if not (ftTGA in FormatGetSupportedFiles(Format)) then
raise EglBitmapUnsupportedFormatFormat.Create('SaveTGA - ' + UNSUPPORTED_FORMAT);
raise EglBitmapUnsupportedFormat.Create('SaveTGA');

//prepare header
FillChar(Header{%H-}, SizeOf(Header), 0);
@@ -7296,7 +7233,7 @@ var
var
StreamPos: Int64;
x, y, LineSize, RowSize, Magic: Cardinal;
NewImage, TmpData, RowData, SrcData: PByte;
NewImage, TmpData, RowData, SrcData: System.PByte;
SourceMD, DestMD: Pointer;
Pixel: TglBitmapPixelData;
ddsFormat: TglBitmapFormat;
@@ -7399,7 +7336,7 @@ var
FormatDesc: TFormatDescriptor;
begin
if not (ftDDS in FormatGetSupportedFiles(Format)) then
raise EglBitmapUnsupportedFormatFormat.Create('SaveDDS - ' + UNSUPPORTED_FORMAT);
raise EglBitmapUnsupportedFormat.Create('SaveDDS');

FormatDesc := TFormatDescriptor.Get(Format);

@@ -7542,7 +7479,7 @@ var
begin
FormatDesc := TFormatDescriptor.Get(Format);
if FormatDesc.IsCompressed then
raise EglBitmapUnsupportedFormatFormat.Create('TglBitmap2D.GrabScreen - ' + UNSUPPORTED_FORMAT);
raise EglBitmapUnsupportedFormat.Create('TglBitmap2D.GrabScreen');

w := aRight - aLeft;
h := aBottom - aTop;


Loading…
Cancel
Save