IBitmapData Interface

Represents the raw data of a bitmap. To create a managed instance use the BitmapDataFactory class. To obtain a readable or writable instance for platform specific bitmaps you can either use the specific GetReadableBitmapData, GetWritableBitmapData or GetReadWriteBitmapData extension methods when applicable (see the Remarks section of the KGySoft.Drawing namespace for a list about the supported platforms). Otherwise, you can use the members of the BitmapDataFactory class to create a bitmap data for any managed or unmanaged preallocated buffer of any bitmap implementation.
See the Remarks section of the BitmapExtensions.GetReadWriteBitmapData method for details and code samples. That method is for the GDI+ Bitmap type but the main principles apply for all sources.

Definition

Namespace: KGySoft.Drawing.Imaging
Assembly: KGySoft.Drawing.Core (in KGySoft.Drawing.Core.dll) Version: 7.2.0
C#
public interface IBitmapData : IDisposable
Implements
IDisposable

Properties

AlphaThreshold If this IBitmapData represents a bitmap with single bit alpha or with a palette that has a transparent color, then gets a threshold value for the Color32.A property, under which the color is considered transparent. If 0, then the pixels to be set will never be transparent.
BackColor When accessing pixels of indexed bitmaps, or setting pixels of bitmaps without alpha support, gets the color of the background. For example, when setting color values with alpha, which are considered opaque, they will be blended with this color before setting the pixel.
See the Remarks section of the GetReadWriteBitmapData extension method for details and examples.
Height Gets the height of the current IBitmapData instance in pixels.
IsDisposed Gets whether this IBitmapData instance is disposed.
Palette Gets a Palette instance representing the colors used in this IBitmapData if PixelFormat represents an indexed format. For indexed bitmaps Indexed property of PixelFormat returns .
PixelFormat Gets a PixelFormatInfo of the current IBitmapData instance.
RowSize Gets the size of a row in bytes, or zero, if this IBitmapData instance does not have an actual raw buffer to access.
Size Gets the size of the current IBitmapData instance in pixels.
Width Gets the width of the current IBitmapData instance in pixels.
WorkingColorSpace Gets the preferred working color space when dealing with the pixels of this IBitmapData instance. Some operations, such as setting pixels or drawing another bitmap data into this instance consider the value of this property. Operations that use an IQuantizer instance may override the value of this property.
Default value if not implemented: Default. (Only in .NET Core 3.0/.NET Standard 2.1 and above. In earlier targeted frameworks this member must be implemented.)

Extension Methods

GetPreferredColorSpace Gets a non-default WorkingColorSpace that can be used when working with the specified bitmapData.
(Defined by BitmapDataExtensions)

See Also