This documentation is for the old version. Go to the latest Graphics Mill docs

Bitmap Constructor (Int32, Int32, PixelFormat)

Creates new Bitmap instance of given dimensions and pixel format.

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

Syntax

Visual Basic
Public Sub New ( _
	width As Integer, _
	height As Integer, _
	format As PixelFormat _
)
C#
public Bitmap(
	int width,
	int height,
	PixelFormat format
)

Parameters

width

Type: System.Int32

Width of new bitmap (in pixels).
height

Type: System.Int32

Height of new bitmap (in pixels).
format

Type: Aurigma.GraphicsMill.PixelFormat

Pixel format of new bitmap. If you specify indexed pixel format, uninitialized palette will be generated. You must fill entries yourself. Palette will have maximum possible for given pixel format colors number (2 colors for 1-bit images, 16 colors for 4-bit images, and 256 colors for 8-bit images).

Remarks

All pixel data are filled with 0. So if pixel format:
  • supports alpha channel image is fully transparent
  • is RGB image is filled with black color
  • is CMYK image is filled with white color
  • is indexed image has color of the first palette entry

Examples

Visual Basic
'Create bitmap with transparent background
Dim bitmapText As New Aurigma.GraphicsMill.Bitmap(150, 30, _
    Aurigma.GraphicsMill.PixelFormat.Format32bppArgb)

Dim graphics As System.Drawing.Graphics = bitmapText.GetGdiplusGraphics()

'Set text output properties
Dim font As New System.Drawing.Font("Arial", 22, FontStyle.Bold)
Dim brush As New System.Drawing.SolidBrush(System.Drawing.Color.Red)

'Draw text
graphics.DrawString("Sample text", font, brush, 5, 5)

'Apply shadow effect on text
bitmapText.Transforms.Shadow(Aurigma.GraphicsMill.RgbColor.Black, 2, 2, 4, False)

'Apply glow effect on text
'bitmapText.Transforms.Glow(Aurigma.GraphicsMill.RgbColor.Blue, 1, 4, False)

'Convert to 24 bit images (merge alpha channel with white background)
bitmapText.Channels.DiscardAlpha(Aurigma.GraphicsMill.RgbColor.White)
C#
//Create bitmap with transparent background
Aurigma.GraphicsMill.Bitmap bitmapText = new Aurigma.GraphicsMill.Bitmap(150, 30, 
    Aurigma.GraphicsMill.PixelFormat.Format32bppArgb);

System.Drawing.Graphics graphics = bitmapText.GetGdiplusGraphics();

//Set text output properties
System.Drawing.Font font = new System.Drawing.Font("Arial", 22, FontStyle.Bold);
System.Drawing.SolidBrush brush = new System.Drawing.SolidBrush(System.Drawing.Color.Red);

//Draw text
graphics.DrawString("Sample text", font, brush, 5, 5);

//Apply shadow effect on text
bitmapText.Transforms.Shadow(Aurigma.GraphicsMill.RgbColor.Black, 2, 2, 4, false);

//Apply glow effect on text
//bitmapText.Transforms.Glow(Aurigma.GraphicsMill.RgbColor.Blue, 1, 4, false);

//Convert to 24 bit images (merge alpha channel with white background)
bitmapText.Channels.DiscardAlpha(Aurigma.GraphicsMill.RgbColor.White);

See Also

Reference