[Lazarus] TImage - Getting image properties in 'canvas space'

Mattias Gaertner nc-gaertnma at netcologne.de
Tue Apr 17 12:27:09 CEST 2012


On Tue, 17 Apr 2012 12:12:21 +0200
Marc Weustink <marc.weustink at cuperus.nl> wrote:

> Mattias Gaertner wrote:
> >
> > Reimar Grabowski <reimgrab at web.de> hat am 16. April 2012 um 16:42
> > geschrieben:
> >
> >  > Hi,
> >  >
> >  > I load a TLazIntfImage from disk, manipulate it and show it on my
> > form in a TImage. Center, Proportional and Stretch properties of the
> > TImage are set to true.
> >  > Now I want to draw some overlays onto it (drawing to the canvas in
> > the OnPaint event). Therefor I obviously need the origin and dimensions
> > of the loaded image in 'canvas space', but I did not find a way to
> > retrieve this information. Do I have to calculate them myself or can the
> > TImage give me the needed information?
> >
> > The image is painted to the area defined by the protected method DestRect.
> >
> > Maybe this can be made public.
> >
> > At the moment you have to descend your own TImage class to access it or
> > write a hack class (e.g. via a class helper).
> 
> TImage is not meant to draw to. If you want to custom paint your image, 
> use a TPaintbox
> 
> A TImage is for display only.

TImage has a published OnPaint event. Painting some overlays makes
sense. And for this you need to know where the image is on the canvas.


Mattias




More information about the Lazarus mailing list