uses
Math, syncobjs, typinfo
- {$IFDEF GLB_DELPHI}, Types{$ENDIF};
+ {$IFDEF GLB_DELPHI}, Types{$ENDIF}
+ {$IF DEFINED(GLB_SUPPORT_JPEG_READ) AND DEFINED(GLB_LAZ_JPEG)}, FPReadJPEG{$IFEND};
type
{$IFNDEF fpc}
var
jpeg: TJPEGImage;
intf: TLazIntfImage;
+ reader: TFPReaderJPEG;
StreamPos: Int64;
magic: String[MAGIC_LEN];
begin
exit;
end;
- jpeg := TJPEGImage.Create;
+ reader := TFPReaderJPEG.Create;
+ intf := TLazIntfImage.Create(0, 0);
try try
- jpeg.LoadFromStream(aStream);
- intf := TLazIntfImage.Create(0, 0);
- try try
- intf.LoadFromBitmap(jpeg.BitmapHandle, jpeg.MaskHandle);
- AssignFromLazIntfImage(intf);
- except
- result := false;
- aStream.Position := StreamPos;
- exit;
- end;
- finally
- intf.Free;
- end;
+ intf.DataDescription := GetDescriptionFromDevice(0, 0, 0);
+ reader.ImageRead(aStream, intf);
+ AssignFromLazIntfImage(intf);
except
result := false;
aStream.Position := StreamPos;
exit;
end;
finally
- jpeg.Free;
+ reader.Free;
+ intf.Free;
end;
end;