// PNG /////////////////////////////////////////////////////////////////////////////////////////////
// activate to enable png support with the unit pngimage -> http://pngdelphi.sourceforge.net/
// if you enable pngimage the libPNG will be ignored
// PNG /////////////////////////////////////////////////////////////////////////////////////////////
// activate to enable png support with the unit pngimage -> http://pngdelphi.sourceforge.net/
// if you enable pngimage the libPNG will be ignored
// activate to use the libPNG -> http://www.libpng.org/
// You will need an aditional header -> http://www.opengl24.de/index.php?cat=header&file=libpng
// activate to use the libPNG -> http://www.libpng.org/
// You will need an aditional header -> http://www.opengl24.de/index.php?cat=header&file=libpng
// activate to use the libJPEG -> http://www.ijg.org/
// You will need an aditional header -> http://www.opengl24.de/index.php?cat=header&file=libjpeg
// activate to use the libJPEG -> http://www.ijg.org/
// You will need an aditional header -> http://www.opengl24.de/index.php?cat=header&file=libjpeg
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
constructor EglBitmapUnsupportedFormat.Create(const aFormat: TglBitmapFormat);
begin
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
constructor EglBitmapUnsupportedFormat.Create(const aFormat: TglBitmapFormat);
begin
Row, Col, PixSize, LineSize: Integer;
NewImage, pSource, pDest, pAlpha: pByte;
Row, Col, PixSize, LineSize: Integer;
NewImage, pSource, pDest, pAlpha: pByte;
- PngHeader: Array[0..7] of Byte = (#137, #80, #78, #71, #13, #10, #26, #10);
+ PngHeader: String[8] = #137#80#78#71#13#10#26#10;
- StreamPos := Stream.Position;
- Stream.Read(Header[0], SizeOf(Header));
- Stream.Position := StreamPos;
+ StreamPos := aStream.Position;
+ aStream.Read(Header[0], SizeOf(Header));
+ aStream.Position := StreamPos;
{Test if the header matches}
if Header = PngHeader then begin
Png := TPNGObject.Create;
try
{Test if the header matches}
if Header = PngHeader then begin
Png := TPNGObject.Create;
try
- PixSize := Trunc(FormatGetSize(Format));
- LineSize := Integer(Png.Header.Width) * PixSize;
+ FormatDesc := TFormatDescriptor.Get(PngFormat);
+ PixSize := Round(FormatDesc.PixelSize);
+ LineSize := FormatDesc.GetSize(Png.Header.Width, 1);
- SetDataPointer(NewImage, Format, Png.Header.Width, Png.Header.Height);
+ SetDataPointer(NewImage, PngFormat, Png.Header.Width, Png.Header.Height);
- if not (ftPNG in FormatGetSupportedFiles (InternalFormat)) then
- raise EglBitmapUnsupportedInternalFormat.Create('SavePng - ' + UNSUPPORTED_INTERNAL_FORMAT);
+ if not (ftPNG in FormatGetSupportedFiles (Format)) then
+ raise EglBitmapUnsupportedFormat.Create(Format);
end;
Png := TPNGObject.CreateBlank(ColorType, 8, Width, Height);
end;
Png := TPNGObject.CreateBlank(ColorType, 8, Width, Height);
pTemp := png.ScanLine[Y];
for X := 0 to Width -1 do begin
Temp := pByteArray(pTemp)^[0];
pTemp := png.ScanLine[Y];
for X := 0 to Width -1 do begin
Temp := pByteArray(pTemp)^[0];