 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Samson Fu Guest
|
Posted: Wed Jun 02, 2004 8:22 am Post subject: How to read Image from stream using GDIplus? |
|
|
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
|
Posted: Wed Jun 02, 2004 10:26 am Post subject: Re: How to read Image from stream using GDIplus? |
|
|
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
|
Posted: Wed Jun 02, 2004 5:45 pm Post subject: Re: How to read Image from stream using GDIplus? |
|
|
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
|
Posted: Thu Jun 03, 2004 2:32 am Post subject: Re: How to read Image from stream using GDIplus? |
|
|
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 |
|
 |
|
|
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
|
|