Draws the bitmap to the DestCanvas at the rectangle specified by xDst, yDst, dxDst, dyDst. Filter specifies the filter if the image needs to be resampled. Gamma is the gamma correction. BackgroundColor specifies the background color when pixels aren't opaque. MaintainAR adjusts the passed destination values to ensure the image is not skewed (maintains its original aspect ratio).
Note: If RenderToCanvas is used with an image with an alpha channel, the image will be modified. Use RenderToCanvasWithAlpha if the source bitmap has an alpha channel that should be respected when drawing.
// Col 1 of a TStringGrid displays a thumbnail drawn from a TImageEnMView procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Longint; Rect: TRect; State: TGridDrawState); var aIEBitmap: IEBitmap; aCanvas: TCanvas; idx: Integer; begin // Col 1 contains thumbnail. Row 0 is fixed header row if (ACol <> 1) or (ARow = 0) then Exit;
idx := ARow; aCanvas := (Sender as TStringGrid).Canvas;
// Clear current cell rect aCanvas.FillRect( Rect );
// Get our image // Note: don't need to create or free the TIEBitmap aIEBitmap := ImageEnMView1.GetIEBitmap( idx );
// Adjust our rect to maintain the image aspect ratio Rect := GetImageRectWithinArea( Rect, aIEBitmap.Width, aIEBitmap.Height );