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

Bitmap Constructor (Color, Int32, Int32, PixelFormat)

Creates new Bitmap instance of given dimensions and pixel format. Background color is specified.

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

Syntax

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

Parameters

background

Type: Aurigma.GraphicsMill.Color

Background color to fill the bitmap with.
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

If color space of the color does not fit color space of the pixel format, color is converted to necessary color space.

Examples

Visual Basic
Dim bitmap As New Aurigma.GraphicsMill.Bitmap( _
 Aurigma.GraphicsMill.RgbColor.White, 300, 30, _
 Aurigma.GraphicsMill.PixelFormat.Format24bppRgb)

Dim graphics As Aurigma.GraphicsMill.Drawing.GdiGraphics = bitmap.GetGdiGraphics

'Draw text
Dim font As New Aurigma.GraphicsMill.Drawing.Font("Futura Md BT", 20)
font.Bold = False
font.Italic = True
font.Underline = True
font.Strikeout = False
font.HorizontalAlignment = Aurigma.GraphicsMill.Drawing.HorizontalAlignment.Center

Dim brush As New Aurigma.GraphicsMill.Drawing.SolidBrush( _
 Aurigma.GraphicsMill.RgbColor.Red)

graphics.DrawString("Sample text", font, brush, 150, 0)
C#
Aurigma.GraphicsMill.Bitmap bitmap = new Aurigma.GraphicsMill.Bitmap(
    Aurigma.GraphicsMill.RgbColor.White, 300, 30, 
    Aurigma.GraphicsMill.PixelFormat.Format24bppRgb);

Aurigma.GraphicsMill.Drawing.GdiGraphics graphics = bitmap.GetGdiGraphics();

//Draw text
Aurigma.GraphicsMill.Drawing.Font font = 
    new Aurigma.GraphicsMill.Drawing.Font("Futura Md BT", 20);
font.Bold = false;
font.Italic = true;
font.Underline = true;
font.Strikeout = false;
font.HorizontalAlignment = Aurigma.GraphicsMill.Drawing.HorizontalAlignment.Center;

Aurigma.GraphicsMill.Drawing.SolidBrush brush = 
    new Aurigma.GraphicsMill.Drawing.SolidBrush(Aurigma.GraphicsMill.RgbColor.Red);

graphics.DrawString("Sample text", font, brush, 150, 0);

See Also

Reference