Manuel Lopez-Michelone
asked on
stretchdraw ... how to use it?
Guys,
I want to copy a region of a timage to another timage, but I want that region of timage fit completely into the second timage. I am sure i have to use stretchdraw, but i can't figure out how to do this. Any help?
best wishes,
Manuel Lopez (lopem)
I want to copy a region of a timage to another timage, but I want that region of timage fit completely into the second timage. I am sure i have to use stretchdraw, but i can't figure out how to do this. Any help?
best wishes,
Manuel Lopez (lopem)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks a lot!
great job
Manuel Lopez (lopem)
great job
Manuel Lopez (lopem)
{Image1 and Image2 are TImages, Image1 is 250 wide and 150 tall, ,
Image2 is 120 wide and 50 tall}
procedure TForm1.CopyRectOfImage;
var
TempBit: TBitmap;
CopyRect: TRect;
begin
TempBit := TBitmap.Create;
// define the Rect that will be copied from Image1
CopyRect := := Rect(17,36,117,136);
// Set the width and height of TempBit to equal CopyRect
TempBit.Height := CopyRect.Bottom - CopyRect.Top;
TempBit.Width := CopyRect.Right - CopyRect.Left;
// Copy the Rect to Tempbit
Tempbit.Canvas.CopyRect(Re
// StretchDraw the Tempbit to fill Image2
Image2.Canvas.StretchDraw(
Tempbit.Free;
end;
the new image in Image2 will be stretched and distorted. . . if you don't want it to be distorted then set the CopyRect to the width and height of Image2