[]
        
(Showing Draft Content)

GrapeCity.Documents.Imaging.BilevelBitmap

Class BilevelBitmap

Namespace
GrapeCity.Documents.Imaging
Assembly
GcDocs.Imaging.dll

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
Inheritance
object
BilevelBitmap
Implements
System.IDisposable
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()

Constructors

BilevelBitmap(byte[], int, int, bool, bool, bool, float, float)

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)

Parameters

pixelData byte[]

The pixel data to be attached to a BilevelBitmap.

pixelWidth int

The width of the image, in pixels.

pixelHeight int

The height of the image, in pixels.

lowerBitsFirst bool

If 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 bool

If true, the image is used to define an irregularly shaped region of another image.

whiteIsZero bool

If true, specifies that 0 represents white and 1 represents black.

dpiX float

The horizontal dpi of the image.

dpiY float

The vertical dpi of the image.

BilevelBitmap(int, int, bool, bool, bool, float, float)

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)

Parameters

pixelWidth int

The width of the image, in pixels.

pixelHeight int

The height of the image, in pixels.

lowerBitsFirst bool

If 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 bool

If true, the image is used to define an irregularly shaped region of another image.

whiteIsZero bool

If true, specifies that 0 represents white and 1 represents black.

dpiX float

The horizontal dpi of the image.

dpiY float

The vertical dpi of the image.

BilevelBitmap(IntPtr, int, int, bool, bool, bool, float, float)

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)

Parameters

pixelData System.IntPtr

The pixel data to be attached to a BilevelBitmap.

pixelWidth int

The width of the image, in pixels.

pixelHeight int

The height of the image, in pixels.

lowerBitsFirst bool

If 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 bool

If true, the image is used to define an irregularly shaped region of another image.

whiteIsZero bool

If true, specifies that 0 represents white and 1 represents black.

dpiX float

The horizontal dpi of the image.

dpiY float

The vertical dpi of the image.

Properties

DpiX

Gets the horizontal dpi of the bitmap.

public float DpiX { get; }

Property Value

float

DpiY

Gets the vertical dpi of the bitmap.

public float DpiY { get; }

Property Value

float

ExifProfile

Gets or sets an instance of ExifProfile with Exif metadata of the image.

public ExifProfile ExifProfile { get; set; }

Property Value

ExifProfile

IccProfileData

Gets or sets the raw ICC profile data.

public byte[] IccProfileData { get; set; }

Property Value

byte[]

IsDisposed

Gets a value indicating whether the BilevelBitmap has been disposed of.

public bool IsDisposed { get; }

Property Value

bool

this[int, int]

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; }

Parameters

x int

The X coordinate.

y int

The Y coordinate.

Property Value

bool

LowerBitsFirst

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; }

Property Value

bool

PixelHeight

Gets the pixel height of the image.

public int PixelHeight { get; }

Property Value

int

PixelWidth

Gets the pixel width of the image.

public int PixelWidth { get; }

Property Value

int

RawData

Gets a pointer to the internal binary data.

public IntPtr RawData { get; }

Property Value

System.IntPtr

Rotation

Gets the flip and rotate transformations that must be applied to the image.

public FlipRotateAction Rotation { get; }

Property Value

FlipRotateAction

ScanLineLength

Gets the number of bytes in one scan line.

public int ScanLineLength { get; }

Property Value

int

TransparencyMask

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; }

Property Value

bool

WhiteIsZero

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; }

Property Value

bool

Methods

ApplyLicenseKey(string)

Applies a license key to an instance of BilevelBitmap.

public void ApplyLicenseKey(string key)

Parameters

key string

The license key to set.

Clear(bool, Rectangle)

Clears the BilevelBitmap with the specified value (true is 1, false is 0).

public void Clear(bool value, Rectangle rect)

Parameters

value bool

The value to fill the image (true is 1, false is 0).

rect System.Drawing.Rectangle

The target rectangle of the BilevelBitmap.

Clear(bool)

Clears the BilevelBitmap with the specified value (true is 1, false is 0).

public void Clear(bool value)

Parameters

value bool

The value to fill the image (true is 1, false is 0).

Clip(Rectangle, bool)

Creates a new BilevelBitmap with a fragment of the image.

public BilevelBitmap Clip(Rectangle rect, bool metadataOnly = false)

Parameters

rect System.Drawing.Rectangle

Clipping rectangle of the source image to be extracted as a new BilevelBitmap.

metadataOnly bool

Specifies 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.

Returns

BilevelBitmap

Clone(bool, bool)

Creates a new BilevelBitmap with a copy of the image.

public BilevelBitmap Clone(bool cloneExif = false, bool metadataOnly = false)

Parameters

cloneExif bool

Specifies whether the Exif metadata should be cloned (if exist), not just copied as a reference.

metadataOnly bool

Specifies 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.

Returns

BilevelBitmap

Dispose()

Clean up any resources being used.

public void Dispose()

Dispose(bool)

Performs cleanup operations on managed and unmanaged resources.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

~BilevelBitmap()

Performs cleanup operations on unmanaged resources.

protected ~BilevelBitmap()

InvertColors()

Inverts all black pixels to white and all white pixels to black.

public void InvertColors()

SetDpi(float, float)

Changes the physical resolution of the image.

public void SetDpi(float dpiX, float dpiY)

Parameters

dpiX float

The horizontal resolution.

dpiY float

The vertical resolution.

SetDpi(float)

Changes the physical resolution of the image.

public void SetDpi(float dpi)

Parameters

dpi float

The horizontal and vertical resolution.

ToGcBitmap()

Creates an instance of the GcBitmap class from the current BilevelBitmap.

public GcBitmap ToGcBitmap()

Returns

GcBitmap

A new instance of the GcBitmap class.

ToGcBitmap(GcBitmap, bool)

Copies the image into an existing instance of GcBitmap.

public void ToGcBitmap(GcBitmap bmp, bool cloneExif)

Parameters

bmp GcBitmap

The target GcBitmap object.

cloneExif bool

Specifies whether the Exif metadata should be cloned (if exist), not just copied as a reference.