{.$DEFINE GLB_DELPHI}
// activate to enable the support for TLazIntfImage from Lazarus
-{$DEFINE GLB_LAZARUS}
+{.$DEFINE GLB_LAZARUS}
// activate to enable Lazarus TPortableNetworkGraphic support
// if you enable this pngImage and libPNG will be ignored
-{$DEFINE GLB_LAZ_PNG}
+{.$DEFINE GLB_LAZ_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 enable Lazarus TJPEGImage support
// if you enable this delphi jpegs and libJPEG will be ignored
-{$DEFINE GLB_LAZ_JPEG}
+{.$DEFINE GLB_LAZ_JPEG}
// if you enable delphi jpegs the libJPEG will be ignored
{.$DEFINE GLB_DELPHI_JPEG}
uses
{$IFNDEF GLB_NATIVE_OGL} dglOpenGL, {$ENDIF}
{$IF DEFINED(GLB_WIN) AND
- DEFINED(GLB_NATIVE_OGL)} windows, {$IFEND}
+ (DEFINED(GLB_NATIVE_OGL) OR
+ DEFINED(GLB_DELPHI))} windows, {$IFEND}
{$IFDEF GLB_SDL} SDL, {$ENDIF}
{$IFDEF GLB_LAZARUS} IntfGraphics, GraphType, Graphics, {$ENDIF}
- {$IFDEF GLB_DELPHI} Dialogs, Graphics, {$ENDIF}
+ {$IFDEF GLB_DELPHI} Dialogs, Graphics, Types, {$ENDIF}
{$IFDEF GLB_SDL_IMAGE} SDL_image, {$ENDIF}
{$IFDEF GLB_PNGIMAGE} pngimage, {$ENDIF}
implementation
uses
- Math, syncobjs, typinfo;
+ Math, syncobjs, typinfo
+ {$IFDEF GLB_DELPHI}, Types{$ENDIF};
type
{$IFNDEF fpc}
rid.Width := Width;
rid.Height := Height;
- rid.Depth := CountSetBits(FormatDesc.Range.r or FormatDesc.Range.g or FormatDesc.Range.b or FormatDesc.Range.a);
+ rid.Depth := CountSetBits(FormatDesc.RedMask or FormatDesc.GreenMask or FormatDesc.BlueMask or FormatDesc.AlphaMask);
rid.BitOrder := riboBitsInOrder;
rid.ByteOrder := riboLSBFirst;
rid.LineOrder := riloTopToBottom;
var
png: TPortableNetworkGraphic;
intf: TLazIntfImage;
+ raw: TRawImage;
begin
png := TPortableNetworkGraphic.Create;
intf := TLazIntfImage.Create(0, 0);
try
if not AssignToLazIntfImage(intf) then
raise EglBitmap.Create('unable to create LazIntfImage from glBitmap');
- png.LoadFromIntfImage(intf);
+ intf.GetRawImage(raw);
+ png.LoadFromRawImage(raw, false);
png.SaveToStream(aStream);
finally
png.Free;
var
jpeg: TJPEGImage;
intf: TLazIntfImage;
+ raw: TRawImage;
begin
jpeg := TJPEGImage.Create;
intf := TLazIntfImage.Create(0, 0);
try
if not AssignToLazIntfImage(intf) then
raise EglBitmap.Create('unable to create LazIntfImage from glBitmap');
- jpeg.LoadFromIntfImage(intf);
+ intf.GetRawImage(raw);
+ jpeg.LoadFromRawImage(raw, false);
jpeg.SaveToStream(aStream);
finally
intf.Free;
finalization
TFormatDescriptor.Finalize;
+{$IFDEF GLB_NATIVE_OGL}
+ if Assigned(GL_LibHandle) then
+ glbFreeLibrary(GL_LibHandle);
+
{$IFDEF GLB_NATIVE_OGL_DYNAMIC}
+ if Assigned(GLU_LibHandle) then
+ glbFreeLibrary(GLU_LibHandle);
FreeAndNil(InitOpenGLCS);
{$ENDIF}
+{$ENDIF}
end.