Table of Contents

Class Color

Namespace
iText.Kernel.Colors
Assembly
itext.kernel.dll

Represents a color

public class Color
Inheritance
Color
Derived
Inherited Members

Constructors

Color(PdfColorSpace, float[])

Creates a Color of certain color space and color value.

protected Color(PdfColorSpace colorSpace, float[] colorValue)

Parameters

colorSpace PdfColorSpace

the color space to which the created Color object relates

colorValue float[]

the color value of the created Color object

Remarks

Creates a Color of certain color space and color value. If color value is set in null, all value components will be initialised with zeroes.

Fields

colorSpace

The color space of the color

protected PdfColorSpace colorSpace

Field Value

PdfColorSpace

colorValue

The color value of the color

protected float[] colorValue

Field Value

float[]

Methods

ConvertCmykToRgb(DeviceCmyk)

Converts DeviceCmyk color to DeviceRgb color

public static DeviceRgb ConvertCmykToRgb(DeviceCmyk cmykColor)

Parameters

cmykColor DeviceCmyk

the DeviceCmyk color which will be converted to DeviceRgb color

Returns

DeviceRgb

converted color

ConvertRgbToCmyk(DeviceRgb)

Converts DeviceRgb color to DeviceCmyk color

public static DeviceCmyk ConvertRgbToCmyk(DeviceRgb rgbColor)

Parameters

rgbColor DeviceRgb

the DeviceRgb color which will be converted to DeviceCmyk color

Returns

DeviceCmyk

converted color

CreateColorWithColorSpace(float[])

Creates a color object based on the passed through values.

public static Color CreateColorWithColorSpace(float[] colorValue)

Parameters

colorValue float[]

the float array with the values

The number of array elements determines the colour space in which the colour shall be defined: 0 - No colour; transparent 1 - DeviceGray 3 - DeviceRGB 4 - DeviceCMYK

Returns

Color

Color the color or null if it's invalid

Remarks

Creates a color object based on the passed through values.

Equals(object)

Indicates whether the color is equal to the given color.

public override bool Equals(object o)

Parameters

o object

Returns

bool

Remarks

Indicates whether the color is equal to the given color. The color space and color value are considered during the comparison.

GetColorSpace()

Returns the color space to which the color is related.

public virtual PdfColorSpace GetColorSpace()

Returns

PdfColorSpace

the color space of the color

GetColorValue()

Returns the color value of the color

public virtual float[] GetColorValue()

Returns

float[]

the color value

GetHashCode()

public override int GetHashCode()

Returns

int

GetNumberOfComponents()

Returns the number of color value components

public virtual int GetNumberOfComponents()

Returns

int

the number of color value components

MakeColor(PdfColorSpace)

Makes a Color of certain color space.

public static Color MakeColor(PdfColorSpace colorSpace)

Parameters

colorSpace PdfColorSpace

the color space to which the returned Color object relates

Returns

Color

the created Color object.

Remarks

Makes a Color of certain color space. All color value components will be initialised with zeroes.

MakeColor(PdfColorSpace, float[])

Makes a Color of certain color space and color value.

public static Color MakeColor(PdfColorSpace colorSpace, float[] colorValue)

Parameters

colorSpace PdfColorSpace

the color space to which the returned Color object relates

colorValue float[]

the color value of the returned Color object

Returns

Color

the created Color object.

Remarks

Makes a Color of certain color space and color value. If color value is set in null, all value components will be initialised with zeroes.

SetColorValue(float[])

Sets the color value of the color

public virtual void SetColorValue(float[] value)

Parameters

value float[]

new color value