Show / Hide Table of Contents

Struct ColorFormat

Defines the ColorFormat component of a GraphicsMode.

Implements
IComparable<ColorFormat>
IEquatable<ColorFormat>
Inherited Members
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetType()
Namespace: OpenTK.Graphics
Assembly: OpenTK.dll
Syntax
public struct ColorFormat : IComparable<ColorFormat>, IEquatable<ColorFormat>
Remarks

A ColorFormat contains Red, Green, Blue and Alpha components that descibe the allocated bits per pixel for the corresponding color.

Constructors

ColorFormat(Int32)

Constructs a new ColorFormat with the specified aggregate bits per pixel.

Declaration
public ColorFormat(int bpp)
Parameters
Type Name Description
Int32 bpp

The bits per pixel sum for the Red, Green, Blue and Alpha color channels.

ColorFormat(Int32, Int32, Int32, Int32)

Constructs a new ColorFormat with the specified bits per pixel for the Red, Green, Blue and Alpha color channels.

Declaration
public ColorFormat(int red, int green, int blue, int alpha)
Parameters
Type Name Description
Int32 red

Bits per pixel for the Red color channel.

Int32 green

Bits per pixel for the Green color channel.

Int32 blue

Bits per pixel for the Blue color channel.

Int32 alpha

Bits per pixel for the Alpha color channel.

Fields

Empty

Defines an empty ColorFormat, where all properties are set to zero.

Declaration
public static readonly ColorFormat Empty
Field Value
Type Description
ColorFormat

Properties

Alpha

Gets the bits per pixel for the Alpha channel.

Declaration
public int Alpha { get; }
Property Value
Type Description
Int32

BitsPerPixel

Gets the sum of Red, Green, Blue and Alpha bits per pixel.

Declaration
public int BitsPerPixel { get; }
Property Value
Type Description
Int32

Blue

Gets the bits per pixel for the Blue channel.

Declaration
public int Blue { get; }
Property Value
Type Description
Int32

Green

Gets the bits per pixel for the Green channel.

Declaration
public int Green { get; }
Property Value
Type Description
Int32

IsIndexed

Gets a System.Boolean indicating whether this ColorFormat is indexed.

Declaration
public bool IsIndexed { get; }
Property Value
Type Description
Boolean

Red

Gets the bits per pixel for the Red channel.

Declaration
public int Red { get; }
Property Value
Type Description
Int32

Methods

CompareTo(ColorFormat)

Compares two instances.

Declaration
public int CompareTo(ColorFormat other)
Parameters
Type Name Description
ColorFormat other

The other instance.

Returns
Type Description
Int32

Zero if this instance is equal to other; a positive value if this instance is greater than other; a negative value otherwise.

Equals(ColorFormat)

Compares whether this ColorFormat structure is equal to the specified ColorFormat.

Declaration
public bool Equals(ColorFormat other)
Parameters
Type Name Description
ColorFormat other

The ColorFormat structure to compare to.

Returns
Type Description
Boolean

True if both ColorFormat structures contain the same components; false otherwise.

Equals(Object)

Indicates whether this instance and a specified object are equal.

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
Object obj

Another object to compare to.

Returns
Type Description
Boolean

True if this instance is equal to obj; false otherwise.

Overrides
ValueType.Equals(Object)

GetHashCode()

Returns the hash code for this instance.

Declaration
public override int GetHashCode()
Returns
Type Description
Int32

A System.Int32 with the hash code of this instance.

Overrides
ValueType.GetHashCode()

ToString()

Returns a String that describes this instance.

Declaration
public override string ToString()
Returns
Type Description
String

A String that describes this instance.

Overrides
ValueType.ToString()

Operators

Equality(ColorFormat, ColorFormat)

Compares two instances for equality.

Declaration
public static bool operator ==(ColorFormat left, ColorFormat right)
Parameters
Type Name Description
ColorFormat left

The left operand.

ColorFormat right

The right operand.

Returns
Type Description
Boolean

True if both instances are equal; false otherwise.

GreaterThan(ColorFormat, ColorFormat)

Compares two instances for inequality.

Declaration
public static bool operator>(ColorFormat left, ColorFormat right)
Parameters
Type Name Description
ColorFormat left

The left operand.

ColorFormat right

The right operand.

Returns
Type Description
Boolean

True if left is greater than right; false otherwise.

GreaterThanOrEqual(ColorFormat, ColorFormat)

Compares two instances for inequality.

Declaration
public static bool operator >=(ColorFormat left, ColorFormat right)
Parameters
Type Name Description
ColorFormat left

The left operand.

ColorFormat right

The right operand.

Returns
Type Description
Boolean

True if left is greater than or equal to right; false otherwise.

Implicit(Int32 to ColorFormat)

Converts the specified bpp into a new ColorFormat.

Declaration
public static implicit operator ColorFormat(int bpp)
Parameters
Type Name Description
Int32 bpp

The bits per pixel to convert.

Returns
Type Description
ColorFormat

A ColorFormat with the specified bits per pixel.

Inequality(ColorFormat, ColorFormat)

Compares two instances for inequality.

Declaration
public static bool operator !=(ColorFormat left, ColorFormat right)
Parameters
Type Name Description
ColorFormat left

The left operand.

ColorFormat right

The right operand.

Returns
Type Description
Boolean

True if both instances are not equal; false otherwise.

LessThan(ColorFormat, ColorFormat)

Compares two instances for inequality.

Declaration
public static bool operator <(ColorFormat left, ColorFormat right)
Parameters
Type Name Description
ColorFormat left

The left operand.

ColorFormat right

The right operand.

Returns
Type Description
Boolean

True if left is less than right; false otherwise.

LessThanOrEqual(ColorFormat, ColorFormat)

Compares two instances for inequality.

Declaration
public static bool operator <=(ColorFormat left, ColorFormat right)
Parameters
Type Name Description
ColorFormat left

The left operand.

ColorFormat right

The right operand.

Returns
Type Description
Boolean

True if left is less than or equal to right; false otherwise.

Implements

System.IComparable<T>
System.IEquatable<T>
In This Article
Back to top Generated by DocFX