[Lazarus] Canvas.CopyRect query...

Mattias Gaertner nc-gaertnma at netcologne.de
Tue Oct 28 19:44:09 CET 2008


On Mon, 27 Oct 2008 20:59:09 -0400
<dominique at savagesoftware.com.au> wrote:

> Oops I cut and pasted a typo.
> 
> x:= x + xx should be x := x + ww;
> 
> But that still does not fix the problem.
> 
> On Mon, 27 Oct 2008 20:36:55 -0400, <dominique at savagesoftware.com.au>
> wrote:
> > I'm using the following code to copy a portion of one TImage to a
> > second TImage
> > 
> > procedure TForm1.Button2Click(Sender: TObject);
> > var
> >   i, x, xx, yy, ww, hh, pos : integer;
> >   s : string;
> > begin
> >   x := 0;
> >   for i := 1 to Length ( Edit1.Text ) do
> >   begin
> >     pos := Ord(  Edit1.Text[ i ] );
> >     s := Edit1.Text[ i ];
> >     xx := s_x[ pos ];
> >     yy := s_y[ pos ];
> >     ww := s_w[ pos ];
> >     hh := s_h[ pos ];
> >     Image2.Canvas.CopyRect( Classes.Rect( x, 0, ww, hh ) ,
> > Image1.Canvas, Classes.Rect( xx, yy, ww, hh ) );
> >     x := x + xx;
> >   end;
> > end;
> > 
> > But the result in Image2 looks stretched. Am I using CopyRect
> > correctly? I'm using this under Mac OS X ( 10.4.11 ), if that makes
> > any difference.


Replace Classes.Rect with Classes.Bounds


Mattias



More information about the Lazarus mailing list