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

Bitmap Class

This class represents bitmap, i.e. object which stores raster data.

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

Syntax

Visual Basic
<SerializableAttribute> _
Public Class Bitmap _
	Inherits UnitConverterObject _
	Implements ICloneable, ISerializable, IStateNavigable

Remarks

This is the most essential class of Graphics Mill for .NET. It incapsulates raster image and stores bitmap as well as other related data.

To load bitmap, you can either format reader returned from FormatManager, or just pass filename into Load(String) or constructor. Also you create new empty bitmap with Create(Single, Single, PixelFormat) method.

Using appropriate properties you can get such details about loaded image as Width, Height, PixelFormat, ColorSpace, BitsPerPixel, etc.

To apply some effect or transform, you should pass this bitmap into ApplyTransform(Bitmap) method of appropriate BitmapTransform class descendant. Alternatively you can use methods exposed in ColorAdjustment and Transforms properties. It is less flexible, but has shorter syntax. You can undo or redo any operation with Undo()/Redo() methods.

Let's assume you need to work with bitmap channels: split channels into several grayscale bitmaps, replace some channel with grayscale image, swap channels, add/remove alpha channel, etc. In this case you should use methods exposed by Channels property.

If standard imaging features of Graphics Mill for .NET are not enough to you, you can use LockBits() method which returns a BitmapData object. This object gives you direct access to the bitmap pixels. If you need just get/set the single pixel value, you can use easy-to-use pair of methods GetPixel(Int32, Int32)/SetPixel(Int32, Int32, Color).

To save result to file you also can either use format writers or the Save(String) method.

This class also provides a number of useful events. Event Progress allows you creating progress bar. Using events Undone and Redone you can enable or disable appropriate menu items. Event Changed fires when some operation has changed the bitmap. In event Changing you can cancel the operation which is going to modify the bitmap. The similar pair of events is available for bitmap saving: Saving fires before the bitmap is saved, Saved - after. Saving event is convenient to set encoder parameters at: it passes EncoderOptions object which you can initialize and these settings will be applied during encoding. Therefore it is convenient place to put a save parameters dialogs at.

Examples

Visual Basic
Dim bitmap As New Aurigma.GraphicsMill.Bitmap("c:\mountain.jpg")
C#
Aurigma.GraphicsMill.Bitmap bitmap = new Aurigma.GraphicsMill.Bitmap(@"c:\mountain.jpg");

Inheritance Hierarchy

Thread Safety

Static members of this type are safe for multi-threaded operations. Instance members of this type are safe for multi-threaded operations.

Object Model


















See Also

Reference