 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Mon May 21, 2007 4:05 pm Post subject: Gdi+ and png |
|
|
Hello,
I can not load a png file from TMemoryStream. If the file format is
jpg, the code below is ok, but if the file is png, it raise a error.
Who can tell me the reason and how to deal with it.
Thanks.
var
PicStream:TStream;
StreamAdapter:TStreamAdapter;
FBitmap:TGPBitmap;
g:TGPGraphics;
begin
PicStream:=TMemoryStream.Create;
TMemoryStream(PicStream).LoadFromFile('d:\1\1.png');
PicStream.Seek(0,sobeginning);
StreamAdapter:=TStreamAdapter.Create(PicStream,soReference);
FBitmap:=TGPBitmap.Create(StreamAdapter);
g:=TGPGraphics.Create(self.Canvas.Handle);
g.DrawImage(FBitmap,0,0);
g.Free;
PicStream.Free;
FBitmap.Free;
end; |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|