StretchDraw confusion lazarus / 39-Graphics ---------------------------------------------------------------------- Pi · 2011-11-01 02:13 I'm trying to use StretchDraw, but I must be calling it wrong or doing something wrong... Code: [Select]// the following line works as expected (and x=476, y=97) : form1.image1.Canvas.Draw(x,y,the_bitmap); // but the following line, with x and y the same (still x=476 and y=97), draws the bitmap a lot further to the left and stretched taller but not as wide  form1.image1.Canvas.StretchDraw(Rect(x,y,the_Bitmap.Width,the_bitmap. Height),the_bitmap);  I don't understand what I'm doing wrong with the above StretchDraw line.  I'm passing the top left coordinates to start drawing the bitmap (x and y), and I'm passing the width and height (in this case the bitmap's width & height so it should show it normal size at this point?), then the bitmap. ---------------------------------------------------------------------- typo · 2011-11-01 02:39 Code: [Select]Image2.Canvas.StretchDraw((Image2.ClientRect), Image1.Picture.Bitmap); ---------------------------------------------------------------------- Pi · 2011-11-01 03:09 Quote from: typo on November 01, 2011, 03:39:09 amCode: [Select]Image2.Canvas.StretchDraw((Image2.ClientRect), Image1.Picture.Bitmap); Thanks, I've just tried that, I've just added an image2 to the form and added: Code: [Select]form1.Image2.Canvas.StretchDraw((form1.Image2.ClientRect), form1.Image1.Picture.Bitmap);      and run that, and I get a copy of the whole of what was image1 into image2 (though smaller, because image2 is smaller than image1).  I only wanted "the_bitmap" to be displayed (overlayed into the main image - at various sizes - though in my initial post I was trying to display it a normal size to check). Basically this is what I wanted to do: image1 is my big, main image (taking up a big portion of the screen), and I wanted to use StretchDraw to draw "the_bitmap" (a smaller bitmap) at various positions and sizes within image1.  eg. I want to animate it moving across the image1, with this bitmap (the_bitmap) getting smaller as it moves across the screen. ---------------------------------------------------------------------- User137 · 2011-11-01 06:38 I think its case of mixup with function parameters. You used Rect() with parameters that Bounds() normally use. Rect(x1, y1, x2, y2) Here x2, y2 are exact bottom right corner coordinates. Bounds(x, y, width, height) ---------------------------------------------------------------------- Pi · 2011-11-01 08:09 Quote from: User137 on November 01, 2011, 07:38:13 amI think its case of mixup with function parameters. You used Rect() with parameters that Bounds() normally use. Rect(x1, y1, x2, y2) Here x2, y2 are exact bottom right corner coordinates. Bounds(x, y, width, height) Thanks a lot, you were right! I'd put just the width & height as the 3rd & 4th parameters in there because I'm sure I saw code on some site doing that. If I now put x+ the bitmap width and y+the bitmap height, it puts it the same as the normal draw command, and now I know what to change to get it to reduce/enlarge and get shown at that size at the positions I want. Thanks again