Meet us at PRINT 19. Chicago, IL. Oct. 3 - 5.
This documentation is for the old version. Go to the latest Graphics Mill docs

Bitmap.Draw Method (Bitmap, Single, Single, Single, Single, Single, Single, Single, Single, CombineMode, Single, InterpolationMode)

Draws current bitmap on another bitmap.

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

Syntax

Visual Basic
Public Sub Draw ( _
	destinationBitmap As Bitmap, _
	destinationX As Single, _
	destinationY As Single, _
	destinationWidth As Single, _
	destinationHeight As Single, _
	sourceX As Single, _
	sourceY As Single, _
	sourceWidth As Single, _
	sourceHeight As Single, _
	combine As CombineMode, _
	opacity As Single, _
	interpolationMode As InterpolationMode _
)
C#
public void Draw(
	Bitmap destinationBitmap,
	float destinationX,
	float destinationY,
	float destinationWidth,
	float destinationHeight,
	float sourceX,
	float sourceY,
	float sourceWidth,
	float sourceHeight,
	CombineMode combine,
	float opacity,
	InterpolationMode interpolationMode
)

Parameters

destinationBitmap

Type: Aurigma.GraphicsMill.Bitmap

Target (destination) bitmap (on which current bitmap should be drawn).
destinationX

Type: System.Single

Horizontal position of left-top corner of the destination rectangle.
destinationY

Type: System.Single

Vertical position of left-top corner of the destination rectangle.
destinationWidth

Type: System.Single

Width of the destination rectangle. You can pass 0 to indicate that method should calculate width automatically (see Remarks section for details).
destinationHeight

Type: System.Single

Height of the destination rectangle. You can pass 0 to indicate that method should calculate height automatically (see Remarks section for details).
sourceX

Type: System.Single

Horizontal position of left-top corner of the source rectangle.
sourceY

Type: System.Single

Vertical position of left-top corner of the source rectangle.
sourceWidth

Type: System.Single

Width of the source rectangle. You can pass 0 to indicate that method should calculate width automatically (see Remarks section for details).
sourceHeight

Type: System.Single

Height of the source rectangle. You can pass 0 to indicate that method should calculate height automatically (see Remarks section for details).
combine

Type: Aurigma.GraphicsMill.Transforms.CombineMode

Algorithm of images blending (plain pixels copying, alpha blending, bitwise operations, etc).
opacity

Type: System.Single

A number in range [0, 1] specifying total opacity of the image. If 0, image is completely transparent, if 1, image is completely opaque.
interpolationMode

Type: Aurigma.GraphicsMill.Transforms.InterpolationMode

Algorithm of resizing. Using this parameter you can select between speed and quality of resizing.

Remarks

Pixels from source rectangle of current bitmap are drawn to destination rectangle on the target bitmap. If source rectangle dimensions differ from dimensions of destination rectangle, pixels are resized to have the same size as destination rectangle.

Note

If pixel formats of bitmaps are different, the method may fail (for some pairs of pixel formats). So it is recommended to make sure that current bitmap pixel format is compatible with target bitmap (or, ideally, the same).

If you want method to calculate width and height automatically, you can pass 0 to these arguments. It will be calculated with the following way:

  1. If both width and heigth (both for source and destination rectangles) are 0, it will take source image dimensions (Width and Height properties). This way no resize will be done during drawing.
  2. If only one of arguments is 0, it will calculate this argument to save proportion. For example, 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 equal to 300.

All coordinates are measured in units specified with Unit property of the source bitmap.

See Also

Reference

Manual