PixelFormatInfo Structure

Represents a pixel format in a technology-agnostic way. Can be used to specify custom pixel formats for the CreateBitmapData method overloads with a PixelFormatInfo, CustomBitmapDataConfig or CustomIndexedBitmapDataConfig parameter.

Definition

Namespace: KGySoft.Drawing.Imaging
Assembly: KGySoft.Drawing.Core (in KGySoft.Drawing.Core.dll) Version: 8.1.0
C#
public struct PixelFormatInfo : IEquatable<PixelFormatInfo>
Inheritance
Object    ValueType    PixelFormatInfo
Implements
IEquatablePixelFormatInfo

Constructors

PixelFormatInfo(Byte) Initializes a new instance of the PixelFormatInfo struct.
PixelFormatInfo(KnownPixelFormat) Initializes a new instance of the PixelFormatInfo struct.

Properties

BitsPerPixel Gets or sets the bits per pixel value of this PixelFormatInfo. Supported range is 1..128 (or 1..16 for Indexed formats). Typical values are powers of two but any value is supported.
Grayscale Gets or sets whether the represented pixel format is a grayscale one. For Indexed formats this property can be because grayscale nature is determined by the current palette. Setting this property for non-indexed custom grayscale formats helps to auto select the preferable strategy for some operations such as dithering.
HasAlpha Gets or sets whether the represented pixel format has an alpha channel (transparency). For Indexed formats this property can be because alpha support is determined by the current palette. Setting this property to resets also the HasPremultipliedAlpha and HasSingleBitAlpha properties.
HasPremultipliedAlpha Gets or sets whether the represented pixel format uses premultiplied alpha. Setting this property to sets also the HasAlpha property.
HasSingleBitAlpha Gets or sets whether the represented pixel format supports single-bit alpha only (a pixel is either completely transparent or completely opaque). Setting this property to sets also the HasAlpha property. It is not mandatory to set this property for custom single-bit alpha formats but it helps optimizing some drawing operations.
Indexed Gets or sets whether the represented pixel format is an indexed one. An indexed format is not expected to have more than 16 BitsPerPixel (up to 65536 color entries).
IsCustomFormat Gets whether the represented pixel format is a custom one. That is, when this PixelFormatInfo was not instantiated by its constructor with a KnownPixelFormat parameter or one of its properties have been set since then.
LinearGamma Gets or sets whether the represented pixel format has linear gamma. For Indexed formats this property should be because it can be configured at the Palette constructors and factory methods whether the palette should work in the linear color space. If the IBitmapData.WorkingColorSpace property returns Default, then the value of this property may affect the selected color space of some operations.
Prefers128BitColors Gets or sets whether the represented pixel format prefers 128-bit colors (ColorF, or PColorF if HasPremultipliedAlpha is also set) when getting or setting pixels. Some operations may consider the value of this property. Setting this property to resets the Prefers64BitColors property.
Prefers64BitColors Gets or sets whether the represented pixel format prefers 64-bit colors (Color64, or PColor64 if HasPremultipliedAlpha is also set) when getting or setting pixels. Some operations may consider the value of this property. Setting this property to resets the Prefers128BitColors property. If LinearGamma is also set, then some writing operations may prefer using ColorF or PColorF types regardless of this property.

Methods

Equals(Object) Determines whether the specified Object is equal to this PixelFormatInfo instance.
(Overrides ValueTypeEquals(Object))
Equals(PixelFormatInfo) Determines whether the current PixelFormatInfo instance is equal to another one.
GetHashCode Returns a hash code for this instance.
(Overrides ValueTypeGetHashCode)
ToKnownPixelFormat Converts this PixelFormatInfo to a KnownPixelFormat representing a compatible pixel format.
ToString Gets the string representation of this PixelFormatInfo instance.
(Overrides ValueTypeToString)

Operators

Equality(PixelFormatInfo, PixelFormatInfo) Gets whether two PixelFormatInfo structures are equal.
Inequality(PixelFormatInfo, PixelFormatInfo) Gets whether two PixelFormatInfo structures are different.

See Also