Board index » cppbuilder » TImage compression and drawings

TImage compression and drawings


2006-09-02 05:04:14 PM
cppbuilder62
I am dynamically loading bitmap pictures on a TImage control. Larger images are compressed by setting the property TImage->Proportional = true. Afterwards I am drawing polygons on the image canvas. The problem is, when the images are large, the polygons are also getting compressed. I do not want this to happen. The image should get compressed, but not the drawings. Could you please suggest some solutions?
 
 

Re:TImage compression and drawings

"Harish" < XXXX@XXXXX.COM >wrote:
Quote

Please wrap your lines when you post. Your editor may visually
wrap them for you but you need to enter a hard return at the
end of each line. If you're using a Reader, then you need to
set it line length.
Quote
I am dynamically loading bitmap pictures on a TImage control.
Larger images are compressed by setting the property
TImage->Proportional = true. Afterwards I am drawing
polygons on the image canvas. The problem is, when the
images are large, the polygons are also getting compressed.
It's unclear to me what you mean - exactly. However, I do
understand that you have a scaling issue with the glyph and
the polygons.
The only thing that I can suggest at this point is to not use
the TImage. Use a TBitmap instead and assume responsibility
for painting it.
The easiest way to paint the bitmap is to use a TPaintBox
with an OnPaint event where all you do is call it's Canvas's
StretchDraw method to scale the bitmap to the desired size
and location. Note that all drawing done to the bitmap's
Canvas would be static while drawing to the TPaintBox's
Canvas would need to be done every time the control is
repainted.
If you add a TScrollBox and place the TPaintBox inside it,
then you wouldn't need to scale it at all because the
TScrollBox will allow the user to scroll the TBitmap.
~ JD
 

Re:TImage compression and drawings

Hi,
Another (similar) approach is to use two identical TImage surfaces
with the polygons being drawn an the surface of the TImage on 'top'
(in 'Z' order). This TImage surface being otherwise transparent.
JD's suggestion probably covers the most likely needs, and has
advantages, it depends on what you really need to do...
You can pile these things up in stacks for that matter but it can
become ah, more complex...
Bruce Larrabee
 

{smallsort}

Re:TImage compression and drawings

This solution worked.
Thank you very much.
-Harish