Board index » cppbuilder » Using TImage->Canvas to generate a BIG picture from scratch

Using TImage->Canvas to generate a BIG picture from scratch

I have placed a TImage component on a form, and am using numerous calls
to TImage->Canvas->Rectangle() to fill up the canvas with an image.  My
TImage component is in a scrollbox, as my images usually end up about
7000 pixels in width, and tens of thousands of pixels in height.
However, it seems that the bottom of my picture is getting cut off.  Is
there a limit to what size the picture can be in a TImage component?
How do I get around this?

Thanks

 

Re:Using TImage->Canvas to generate a BIG picture from scratch


I have placed a TImage component on a form, and am using numerous calls to
TImage->Canvas->Rectangle() to fill up the canvas with an image. My program
modifies the TImage->Height attribute at  runtime in order to accomodate
the image, and the whole thing is in a scrollbox, so that I can scroll to
see all of it.  My images are usually about 7000 pixels wide and tens of
thousands of pixels high.

Here is what I am having trouble with:

When I find that I am running out of room on my canvas, I modify the
Image->Height property.  However, after doing so, I find that further calls
to TImage->Canvas->Rectangle() no longer have any effect in the expanded
region.  I have tried modifying the ClipRect using API calls as follows:

     MyRgn =
     CreateRectRgn(TopEdgePos-PixelLoc-CounterInt,Lines,TopEdgePos-PixelLoc,Lines+AspectRatio);

     SelectClipRgn(Image->Canvas->Handle,MyRgn);

I have also tried using the FillRect() function instead of Rectangle():

     Image->Canvas->FillRect(Image->Canvas->ClipRect);

But to no avail.  It seems that whatever I define my Image->Height to be
before drawing a rectangle is how high my drawing region stays.  Here is
some further test code that confirms my point:

Just create a new app with an image component and make the image components
height to be less than 500.  Then put this code as the handler for a
buttonclick (for example).

     Image->Height = 500;
     Image->Canvas->Pen->Width = 5;
     Image->Canvas->Pen->Style = psSolid;
     Image->Canvas->Pen->Color = clRed;
     Image->Canvas->Brush->Color = clRed;
     Image->Canvas->Rectangle(0,0,500,500);
     Image->Invalidate();
     ShowMessage("TEST");
     Image->Height = 1000;
     Image->Canvas->Pen->Color = clBlue;
     Image->Canvas->Brush->Color = clBlue;
     Image->Canvas->Rectangle(501,501,750,750);
     Image->Invalidate();
     ShowMessage("TEST2");

Notice the Image->Height = XXX works the first time, but not the second.
Any suggestions?  Thanks.

Re:Using TImage->Canvas to generate a BIG picture from scratch


Quote
Victor Hannak wrote in message <38558BD4.75DE4...@nospam.kodak.com>...
>I have placed a TImage component on a form, and am using numerous calls to
>TImage->Canvas->Rectangle() to fill up the canvas with an image. My program
>modifies the TImage->Height attribute at  runtime in order to accomodate
>the image, and the whole thing is in a scrollbox, so that I can scroll to
>see all of it.  My images are usually about 7000 pixels wide and tens of
>thousands of pixels high.

This may be irrelevant to your problem, but anyway...
I was recently positioning  a component inside a scrolled window using
SetBounds
and i found that i could not exceed 32Kx32K pixels.
SetBounds calls Window's SetWindowPos() function which probably sets this
limit.

malc.

Re:Using TImage->Canvas to generate a BIG picture from scratch


You'll have to adjust the bitmap size at the same time.

Image->Height = 500;
Image->Picture->Bitmap->Height =500;

Rene
--
Ing.Buero R.Tschaggelar - http://www.ibrtses.com

Other Threads