Struct PixelFormat
Represents a pixel format that's used for RFB encodings.
Implements
Namespace: MarcusW.VncClient
Assembly: MarcusW.VncClient.dll
Syntax
public struct PixelFormat : IEquatable<PixelFormat>
Constructors
| Improve this Doc View SourcePixelFormat(String, Byte, Byte, Boolean, Boolean, Boolean, UInt16, UInt16, UInt16, UInt16, Byte, Byte, Byte, Byte)
Initializes a new instance of the PixelFormat structure.
Declaration
public PixelFormat(string name, byte bitsPerPixel, byte depth, bool bigEndian, bool trueColor, bool hasAlpha, ushort redMax, ushort greenMax, ushort blueMax, ushort alphaMax, byte redShift, byte greenShift, byte blueShift, byte alphaShift)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the pixel format. |
System.Byte | bitsPerPixel | The number of bits used for each pixel on the wire. |
System.Byte | depth | The number of useful bits in the pixel value. Must be greater than or equal to |
System.Boolean | bigEndian | True if multi-byte pixels are interpreted as big endian, otherwise false. |
System.Boolean | trueColor | True if the pixel value is composed from the color values, or false if the color values serve as indices into a color map. |
System.Boolean | hasAlpha | True if this pixel format contains an alpha channel, otherwise false. |
System.UInt16 | redMax | The maximum value for the color red. |
System.UInt16 | greenMax | The maximum value for the color green. |
System.UInt16 | blueMax | The maximum value for the color blue. |
System.UInt16 | alphaMax | The maximum value for the alpha value. |
System.Byte | redShift | The number of right-shifts needed to get the red value in a pixel. |
System.Byte | greenShift | The number of right-shifts needed to get the green value in a pixel. |
System.Byte | blueShift | The number of right-shifts needed to get the blue value in a pixel. |
System.Byte | alphaShift | The number of right-shifts needed to get the alpha value in a pixel. |
Fields
| Improve this Doc View SourcePlain
A very basic RGBA pixel format.
Declaration
public static readonly PixelFormat Plain
Field Value
Type | Description |
---|---|
PixelFormat |
Unknown
An invalid pixel format representing unknown values.
Declaration
public static readonly PixelFormat Unknown
Field Value
Type | Description |
---|---|
PixelFormat |
Properties
| Improve this Doc View SourceAlphaMax
Gets the maximum value for the alpha value.
Declaration
public ushort AlphaMax { get; }
Property Value
Type | Description |
---|---|
System.UInt16 |
AlphaShift
Gets the number of right-shifts needed to get the alpha value in a pixel.
Declaration
public byte AlphaShift { get; }
Property Value
Type | Description |
---|---|
System.Byte |
BigEndian
Gets if multi-byte pixels are interpreted as big endian.
Declaration
public bool BigEndian { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
BitsPerPixel
Gets the number of bits used for each pixel on the wire.
Declaration
public byte BitsPerPixel { get; }
Property Value
Type | Description |
---|---|
System.Byte |
BlueMax
Gets the maximum value for the color blue.
Declaration
public ushort BlueMax { get; }
Property Value
Type | Description |
---|---|
System.UInt16 |
BlueShift
Gets the number of right-shifts needed to get the blue value in a pixel.
Declaration
public byte BlueShift { get; }
Property Value
Type | Description |
---|---|
System.Byte |
BytesPerPixel
Gets the number of bytes used for each pixel on the wire.
Declaration
public byte BytesPerPixel { get; }
Property Value
Type | Description |
---|---|
System.Byte |
Depth
Gets the number of useful bits in the pixel value. Must be greater than or equal to BitsPerPixel.
Declaration
public byte Depth { get; }
Property Value
Type | Description |
---|---|
System.Byte |
GreenMax
Gets the maximum value for the color green.
Declaration
public ushort GreenMax { get; }
Property Value
Type | Description |
---|---|
System.UInt16 |
GreenShift
Gets the number of right-shifts needed to get the green value in a pixel.
Declaration
public byte GreenShift { get; }
Property Value
Type | Description |
---|---|
System.Byte |
HasAlpha
Gets whether this pixel format contains an alpha channel.
Declaration
public bool HasAlpha { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
LittleEndian
Gets if multi-byte pixels are interpreted as little endian.
Declaration
public bool LittleEndian { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Name
Gets the name of this pixel format.
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
System.String |
RedMax
Gets the maximum value for the color red.
Declaration
public ushort RedMax { get; }
Property Value
Type | Description |
---|---|
System.UInt16 |
RedShift
Gets the number of right-shifts needed to get the red value in a pixel.
Declaration
public byte RedShift { get; }
Property Value
Type | Description |
---|---|
System.Byte |
TrueColor
Gets whether the pixel value is composed from the color values (True), or if the color values serve as indices into a color map (False).
Declaration
public bool TrueColor { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
| Improve this Doc View SourceEquals(PixelFormat)
Declaration
public bool Equals(PixelFormat other)
Parameters
Type | Name | Description |
---|---|---|
PixelFormat | other |
Returns
Type | Description |
---|---|
System.Boolean |
Equals(Nullable<Object>)
Declaration
public override bool Equals(object? obj)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Object> | obj |
Returns
Type | Description |
---|---|
System.Boolean |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
IsBinaryCompatibleTo(PixelFormat, Boolean)
Checks if a pixel encoded using this pixel format would be binary compatible with one encoded using another one.
Declaration
public bool IsBinaryCompatibleTo(PixelFormat other, bool ignoreAlpha = false)
Parameters
Type | Name | Description |
---|---|---|
PixelFormat | other | The other pixel format. |
System.Boolean | ignoreAlpha | If true, the presence and encoding of the alpha channel will be ignored during this check. |
Returns
Type | Description |
---|---|
System.Boolean | True if they are binary compatible, otherwise false. |
Remarks
This method does not yet support comparisons because little-endian and big-endian pixel formats.
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
Operators
| Improve this Doc View SourceEquality(PixelFormat, PixelFormat)
Checks for equality between two PixelFormats.
Declaration
public static bool operator ==(PixelFormat left, PixelFormat right)
Parameters
Type | Name | Description |
---|---|---|
PixelFormat | left | The first pixel format. |
PixelFormat | right | The second pixel format. |
Returns
Type | Description |
---|---|
System.Boolean | True if the sizes are equal, otherwise false. |
Inequality(PixelFormat, PixelFormat)
Checks for inequality between two PixelFormats.
Declaration
public static bool operator !=(PixelFormat left, PixelFormat right)
Parameters
Type | Name | Description |
---|---|---|
PixelFormat | left | The first pixel format. |
PixelFormat | right | The second pixel format. |
Returns
Type | Description |
---|---|
System.Boolean | True if the sizes are unequal, otherwise false. |