Graphics.DrawImage Method (Bitmap, RectangleF, Single)

Draws the specified Bitmap at the specified location and with the specified size.

Namespace: Aurigma.GraphicsMill.AdvancedDrawing
Assembly: Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)

Syntax

C#
public void DrawImage(
	Bitmap bitmap,
	RectangleF dstRect,
	float opacity
)

Parameters

bitmap

Type: Aurigma.GraphicsMill.Bitmap

The Bitmap to draw.
dstRect

Type: System.Drawing.RectangleF

A RectangleF structure that specifies the location and size of the drawn image. The image is scaled to fit the rectangle.
opacity

Type: System.Single

The opacity of the image in range [0, 1]. If 0, image is completely transparent, if 1, image is completely opaque.

Remarks

The Bitmap is drawn to destination rectangle on this Graphics. If the current image dimensions differ from dimensions of the destination rectangle, the image will be resized to have the same size as the destination rectangle.

If you want this method to calculate width and/or height automatically, you can pass 0s as the dstRect rectangle dimensions. The image dimensions will be calculated with the following way:

  1. If both width and heigth are 0, the source image dimensions (Width and Height) will be taken. This way the image will not be resized during drawing.
  2. If only one of arguments is 0, this argument will be calculated as to save image proportion. For example, the source image is 800x600, and you pass 400 as width and 0 as height. Height will be calculated to preserve aspect ratio of the image, i.e. it will be 300.

See Also

Reference

Manual