BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to read Image from stream using GDIplus?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics
View previous topic :: View next topic  
Author Message
Samson Fu
Guest





PostPosted: Wed Jun 02, 2004 8:22 am    Post subject: How to read Image from stream using GDIplus? Reply with quote



I try to read a resource image using GDIPlus, but failed. A CPU Debugger
popup, I don't know what to do with that..
I am using GDI+ classes from progdigy.

Here is my code:

var
ResStream: TResourceStream;
SA: TStreamAdapter;
begin
ResStream := TResourceStream.Create(HInstance, 'RADIOM', RT_RCDATA);
ResStream.Position:= 0;
SA:= TStreamAdapter.Create(ResStream);
P:= TGPImage.Create(SA as IStream); //// CPU window popup here~
SA.Free;
ResStream.Free;


Back to top
Samson Fu
Guest





PostPosted: Wed Jun 02, 2004 10:26 am    Post subject: Re: How to read Image from stream using GDIplus? Reply with quote



Oh, forget to say, my resources 'RADIOM' is a PNG data.

"Samson Fu" <samson_fu (AT) hotmail (DOT) com> wrote

Quote:
I try to read a resource image using GDIPlus, but failed. A CPU Debugger
popup, I don't know what to do with that..
I am using GDI+ classes from progdigy.

Here is my code:

var
ResStream: TResourceStream;
SA: TStreamAdapter;
begin
ResStream := TResourceStream.Create(HInstance, 'RADIOM', RT_RCDATA);
ResStream.Position:= 0;
SA:= TStreamAdapter.Create(ResStream);
P:= TGPImage.Create(SA as IStream); //// CPU window popup here~
SA.Free;
ResStream.Free;





Back to top
Peter Below (TeamB)
Guest





PostPosted: Wed Jun 02, 2004 5:45 pm    Post subject: Re: How to read Image from stream using GDIplus? Reply with quote



In article <40bd8e4b$1 (AT) newsgroups (DOT) borland.com>, Samson Fu wrote:
Quote:
I try to read a resource image using GDIPlus, but failed. A CPU Debugger
popup, I don't know what to do with that..
I am using GDI+ classes from progdigy.

Here is my code:

var
ResStream: TResourceStream;
SA: TStreamAdapter;
begin
ResStream := TResourceStream.Create(HInstance, 'RADIOM', RT_RCDATA);
ResStream.Position:= 0;
SA:= TStreamAdapter.Create(ResStream);
P:= TGPImage.Create(SA as IStream); //// CPU window popup here~

The problem is probably that the TGPImage class has no way to find out the
image type from the stream data. So it makes an assumption and that turns
out to be wrong. Result: instant mayhem <g>.

--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be



Back to top
Samson Fu
Guest





PostPosted: Thu Jun 03, 2004 2:32 am    Post subject: Re: How to read Image from stream using GDIplus? Reply with quote

Thank you~
I just found an old post discuss about this. The bug is borland does not
implement TStreamAdapter.Stat good enough, I post the solution link here for
anybody read this post:

http://groups.google.com.hk/groups?q=TStreamAdapter+gdi&hl=zh-TW&lr=&ie=UTF-8&selm=3f083d88%40newsgroups.borland.com&rnum=1

"Peter Below (TeamB)" <100113.1101 (AT) compuXXserve (DOT) com> wrote

Quote:
In article <40bd8e4b$1 (AT) newsgroups (DOT) borland.com>, Samson Fu wrote:
I try to read a resource image using GDIPlus, but failed. A CPU Debugger
popup, I don't know what to do with that..
I am using GDI+ classes from progdigy.

Here is my code:

var
ResStream: TResourceStream;
SA: TStreamAdapter;
begin
ResStream := TResourceStream.Create(HInstance, 'RADIOM', RT_RCDATA);
ResStream.Position:= 0;
SA:= TStreamAdapter.Create(ResStream);
P:= TGPImage.Create(SA as IStream); //// CPU window popup here~

The problem is probably that the TGPImage class has no way to find out the
image type from the stream data. So it makes an assumption and that turns
out to be wrong. Result: instant mayhem <g>.

--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be





Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.