[]
Represents a bi-level transparency mask or an image containing two colors - black and white in either a white-is-zero or black-is-zero format.
public class BilevelBitmap : IImage, IDisposable
Initializes a new instance of the BilevelBitmap class and sets the existing pixel data to be read/modified in-place.
public BilevelBitmap(byte[] pixelData, int pixelWidth, int pixelHeight, bool lowerBitsFirst = false, bool transparencyMask = false, bool whiteIsZero = false, float dpiX = 96, float dpiY = 96)
pixelData byte[]The pixel data to be attached to a BilevelBitmap.
pixelWidth intThe width of the image, in pixels.
pixelHeight intThe height of the image, in pixels.
lowerBitsFirst boolIf true, pixels are arranged within a byte such that pixels with lower column indices are stored in the lower-order bits of the byte.
transparencyMask boolIf true, the image is used to define an irregularly shaped region of another image.
whiteIsZero boolIf true, specifies that 0 represents white and 1 represents black.
dpiX floatThe horizontal dpi of the image.
dpiY floatThe vertical dpi of the image.
Initializes a new instance of the BilevelBitmap class.
public BilevelBitmap(int pixelWidth, int pixelHeight, bool lowerBitsFirst = false, bool transparencyMask = false, bool whiteIsZero = false, float dpiX = 96, float dpiY = 96)
pixelWidth intThe width of the image, in pixels.
pixelHeight intThe height of the image, in pixels.
lowerBitsFirst boolIf true, pixels are arranged within a byte such that pixels with lower column indices are stored in the lower-order bits of the byte.
transparencyMask boolIf true, the image is used to define an irregularly shaped region of another image.
whiteIsZero boolIf true, specifies that 0 represents white and 1 represents black.
dpiX floatThe horizontal dpi of the image.
dpiY floatThe vertical dpi of the image.
Initializes a new instance of the BilevelBitmap class and sets the existing pixel data to be read/modified in-place.
public BilevelBitmap(IntPtr pixelData, int pixelWidth, int pixelHeight, bool lowerBitsFirst = false, bool transparencyMask = false, bool whiteIsZero = false, float dpiX = 96, float dpiY = 96)
pixelData System.IntPtrThe pixel data to be attached to a BilevelBitmap.
pixelWidth intThe width of the image, in pixels.
pixelHeight intThe height of the image, in pixels.
lowerBitsFirst boolIf true, pixels are arranged within a byte such that pixels with lower column indices are stored in the lower-order bits of the byte.
transparencyMask boolIf true, the image is used to define an irregularly shaped region of another image.
whiteIsZero boolIf true, specifies that 0 represents white and 1 represents black.
dpiX floatThe horizontal dpi of the image.
dpiY floatThe vertical dpi of the image.
Gets the horizontal dpi of the bitmap.
public float DpiX { get; }
Gets the vertical dpi of the bitmap.
public float DpiY { get; }
Gets or sets an instance of ExifProfile with Exif metadata of the image.
public ExifProfile ExifProfile { get; set; }
Gets or sets the raw ICC profile data.
public byte[] IccProfileData { get; set; }
Gets a value indicating whether the BilevelBitmap has been disposed of.
public bool IsDisposed { get; }
Gets or sets a pixel value (true is 1, false is 0) at the specified coordinates.
public bool this[int x, int y] { get; set; }
x intThe X coordinate.
y intThe Y coordinate.
Gets or sets a value specifying whether pixels with lower column indices are stored in the lower-order bits of the byte.
Setting this property causes an update to the pixel data.
public bool LowerBitsFirst { get; set; }
Gets the pixel height of the image.
public int PixelHeight { get; }
Gets the pixel width of the image.
public int PixelWidth { get; }
Gets a pointer to the internal binary data.
public IntPtr RawData { get; }
Gets the flip and rotate transformations that must be applied to the image.
public FlipRotateAction Rotation { get; }
Gets the number of bytes in one scan line.
public int ScanLineLength { get; }
Gets or sets a value indicating whether the image is used to define an irregularly shaped region of another image.
public bool TransparencyMask { get; set; }
Gets or sets a value indicating whether 0 represents white and 1 represents black (if true) or vice versa (if false).
public bool WhiteIsZero { get; set; }
Applies a license key to an instance of BilevelBitmap.
public void ApplyLicenseKey(string key)
key stringThe license key to set.
Clears the BilevelBitmap with the specified value (true is 1, false is 0).
public void Clear(bool value, Rectangle rect)
value boolThe value to fill the image (true is 1, false is 0).
rect System.Drawing.RectangleThe target rectangle of the BilevelBitmap.
Clears the BilevelBitmap with the specified value (true is 1, false is 0).
public void Clear(bool value)
value boolThe value to fill the image (true is 1, false is 0).
Creates a new BilevelBitmap with a fragment of the image.
public BilevelBitmap Clip(Rectangle rect, bool metadataOnly = false)
rect System.Drawing.RectangleClipping rectangle of the source image to be extracted as a new BilevelBitmap.
metadataOnly boolSpecifies whether to copy the image metadata only, not actual pixel data. If false, the corresponding pixel data will be copied from the current BilevelBitmap. If true, the pixel data of the resulting BilevelBitmap remain uninitialized.
Creates a new BilevelBitmap with a copy of the image.
public BilevelBitmap Clone(bool cloneExif = false, bool metadataOnly = false)
cloneExif boolSpecifies whether the Exif metadata should be cloned (if exist), not just copied as a reference.
metadataOnly boolSpecifies whether to copy the image metadata only, not actual pixel data. If false, the pixel data will be copied from the current BilevelBitmap. If true, the pixel data of the resulting BilevelBitmap remain uninitialized.
Clean up any resources being used.
public void Dispose()
Performs cleanup operations on managed and unmanaged resources.
protected virtual void Dispose(bool disposing)
disposing boolPerforms cleanup operations on unmanaged resources.
protected ~BilevelBitmap()
Inverts all black pixels to white and all white pixels to black.
public void InvertColors()
Changes the physical resolution of the image.
public void SetDpi(float dpiX, float dpiY)
dpiX floatThe horizontal resolution.
dpiY floatThe vertical resolution.
Changes the physical resolution of the image.
public void SetDpi(float dpi)
dpi floatThe horizontal and vertical resolution.
Creates an instance of the GcBitmap class from the current BilevelBitmap.
public GcBitmap ToGcBitmap()
Copies the image into an existing instance of GcBitmap.
public void ToGcBitmap(GcBitmap bmp, bool cloneExif)