summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@gmail.com>2013-04-08 09:04:35 +0100
committerDavid Laurence Emerson <dle3ab@angelbase.com>2013-05-28 00:42:52 -0700
commit7d5c05e08c7728dc86339cdd9903ce395935f86d (patch)
tree304bc8a66d7042254da029a5908c1644fea8c1ca /src
parentc8fd343228367e477fbc313570b342e9292b10c5 (diff)
downloadfpGUI-7d5c05e08c7728dc86339cdd9903ce395935f86d.tar.xz
New overloaded LoadImage_PNG()
This allows us to read the image from a byte array, just like we do with BMP images.
Diffstat (limited to 'src')
-rw-r--r--src/corelib/fpg_imgfmt_png.pas16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/corelib/fpg_imgfmt_png.pas b/src/corelib/fpg_imgfmt_png.pas
index c0659d2e..c95150e4 100644
--- a/src/corelib/fpg_imgfmt_png.pas
+++ b/src/corelib/fpg_imgfmt_png.pas
@@ -1,7 +1,7 @@
{
fpGUI - Free Pascal GUI Toolkit
- Copyright (C) 2006 - 2012 See the file AUTHORS.txt, included in this
+ Copyright (C) 2006 - 2013 See the file AUTHORS.txt, included in this
distribution, for details of the copyright.
See the file COPYING.modifiedLGPL, included in this distribution,
@@ -31,6 +31,7 @@ uses
function LoadImage_PNG(const AFileName: TfpgString): TfpgImage; overload;
function LoadImage_PNG(AStream: TStream): TfpgImage; overload;
+function LoadImage_PNG(const AImageData: Pointer; const AImageDataSize: LongWord): TfpgImage; overload;
function LoadImage_PNG(AInstance: THandle; const AResName: String; AResType: PChar): TfpgImage; overload;
function LoadImage_PNGcrop(const AMaxWidth, AMaxHeight: integer; const AFileName: TfpgString): TfpgImage;
@@ -114,6 +115,19 @@ begin
end;
end;
+function LoadImage_PNG(const AImageData: Pointer; const AImageDataSize: LongWord): TfpgImage;
+var
+ s: TMemoryStream;
+begin
+ s := TMemoryStream.Create;
+ try
+ s.Write(AImageData^, AImageDataSize);
+ Result := LoadImage_PNG(s);
+ finally
+ s.Free;
+ end;
+end;
+
function LoadImage_PNG(AInstance: THandle; const AResName: String; AResType: PChar): TfpgImage;
var
res: TResourceStream;