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 

TImage subclass

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Graphics)
View previous topic :: View next topic  
Author Message
Gianstefano Monni
Guest





PostPosted: Tue Jul 01, 2003 3:04 pm    Post subject: TImage subclass Reply with quote



Hi,
I hope this is the right newsgroup to post my question.
We've developed a medical application, and we need to use a custom image
format (we call it "Zbi" format). Right now, we've developed a ZbiClass that
reads/writes bytes stream and we show them with StretchDIBits function, but
we'd like to have a "TZBIImage:TImage" class capable of reading/writing
images in Zbi format, and to show them in a form. I suppose I need to
subclass TImage, but I have no documentation on which methods I must
override, and so on... I would like to have some suggestions, links, ideas
Wink
Thanks in advance
Gianstefano Monni



Back to top
Damon Chandler (TeamB)
Guest





PostPosted: Sat Jul 05, 2003 3:33 am    Post subject: Re: TImage subclass Reply with quote



Gianstefano,
Quote:
We've developed a medical application, and we need to use a custom
image format [...] we'd like to have a "TZBIImage:TImage" class capable
of reading/writing images in Zbi format, and to show them in a form.

If you need only to display the Zbi images at run time, then all you need to
do is convert from your format to a bitmap; specifically, you'd create a
TBitmap object of the correct dimensions, and then use the TBitmap::ScanLine
property to copy your raw array to the pixels of the bitmap--see the
ConstructBMP() function in this post http://tinyurl.com/g2g9. (You may also
need to use the SetDIBColorTable() Win32 function if the pixel values denote
color-table indices.) Instead of ScanLine, you could alternatively write to
a stream a properly initialized BITMAPFILEHEADER struct followed by your DIB
data (BITMAPINFO data + pixels), and then you'd use the
TBitmap::LoadFromStream() method to construct the bitmap--see
http://tinyurl.com/g2g4.

If you need to display your Zbi images at design time, then you'll need to
use the TPicture::RegisterFileFormat() member function. In this case, your
TZBIImage class should be a TGraphic descendant.

Good luck,
--
Damon (TeamB)
BCBCAQ - http://bcbcaq.bytamin-c.com

Back to top
Gianstefano Monni
Guest





PostPosted: Wed Jul 09, 2003 2:12 pm    Post subject: Re: TImage subclass Reply with quote



Hi,
thanks for your answer,I'm trying to sum up all the tips (I've posted the
question in vcl.componens.writing and graphics groups), and... I feel a bit
confused now Wink
I mean, now I know I've to subclass TGraphic, and I must override some
methods of the class: in particular I must override
1. Assign
2. LoadFromStream: I must load data from a stream, unzip it (right now I'm
using zlib and it works as expected)
3. SaveToStream: I must save bitmap data and other medical data in a stream
filtering them with zlib
Could you tell me if I must use a private buffer, or there's a kind of
standard buffer to save this data ? I mean, TImage class use Pixels property
and ScanLine abstraction, there's something similar to use with TGraphic
class or I must implement it on my own ?


I have to
"Damon Chandler (TeamB)" <dmc27 (AT) cornell (DOT) edu> ha scritto nel messaggio
news:3F0646FF.5CCB9664 (AT) cornell (DOT) edu...
Quote:
Gianstefano,
We've developed a medical application, and we need to use a custom
image format [...] we'd like to have a "TZBIImage:TImage" class capable
of reading/writing images in Zbi format, and to show them in a form.

If you need only to display the Zbi images at run time, then all you need
to
do is convert from your format to a bitmap; specifically, you'd create a
TBitmap object of the correct dimensions, and then use the
TBitmap::ScanLine
property to copy your raw array to the pixels of the bitmap--see the
ConstructBMP() function in this post http://tinyurl.com/g2g9. (You may
also
need to use the SetDIBColorTable() Win32 function if the pixel values
denote
color-table indices.) Instead of ScanLine, you could alternatively write
to
a stream a properly initialized BITMAPFILEHEADER struct followed by your
DIB
data (BITMAPINFO data + pixels), and then you'd use the
TBitmap::LoadFromStream() method to construct the bitmap--see
http://tinyurl.com/g2g4.

If you need to display your Zbi images at design time, then you'll need to
use the TPicture::RegisterFileFormat() member function. In this case,
your
TZBIImage class should be a TGraphic descendant.

Good luck,
--
Damon (TeamB)
BCBCAQ - http://bcbcaq.bytamin-c.com



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (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.