Gjsify LogoGjsify Logo

A structure for holding a color definition. The contents of the CoglColor structure are private and should never by accessed directly.

record

Hierarchy

  • Color

Index

Constructors

Properties

name: string

Methods

  • free(): void
  • get_alpha(): number
  • get_alpha_byte(): number
  • get_alpha_float(): number
  • get_blue(): number
  • get_blue_byte(): number
  • get_blue_float(): number
  • get_green(): number
  • get_green_byte(): number
  • get_green_float(): number
  • get_red(): number
  • get_red_byte(): number
  • get_red_float(): number
  • init_from_4f(red: number, green: number, blue: number, alpha: number): void
  • Sets the values of the passed channels into a #CoglColor

    Parameters

    • red: number

      value of the red channel, between 0 and 1.0

    • green: number

      value of the green channel, between 0 and 1.0

    • blue: number

      value of the blue channel, between 0 and 1.0

    • alpha: number

      value of the alpha channel, between 0 and 1.0

    Returns void

  • init_from_4fv(color_array: number): void
  • Sets the values of the passed channels into a #CoglColor

    Parameters

    • color_array: number

      a pointer to an array of 4 float color components

    Returns void

  • init_from_4ub(red: number, green: number, blue: number, alpha: number): void
  • Sets the values of the passed channels into a #CoglColor.

    Parameters

    • red: number

      value of the red channel, between 0 and 255

    • green: number

      value of the green channel, between 0 and 255

    • blue: number

      value of the blue channel, between 0 and 255

    • alpha: number

      value of the alpha channel, between 0 and 255

    Returns void

  • premultiply(): void
  • Converts a non-premultiplied color to a pre-multiplied color. For example, semi-transparent red is (1.0, 0, 0, 0.5) when non-premultiplied and (0.5, 0, 0, 0.5) when premultiplied.

    Returns void

  • set_alpha(alpha: number): void
  • Sets the alpha channel of color to alpha.

    Parameters

    • alpha: number

      a float value between 0.0f and 1.0f

    Returns void

  • set_alpha_byte(alpha: number): void
  • Sets the alpha channel of color to alpha.

    Parameters

    • alpha: number

      a byte value between 0 and 255

    Returns void

  • set_alpha_float(alpha: number): void
  • Sets the alpha channel of color to alpha.

    Parameters

    • alpha: number

      a float value between 0.0f and 1.0f

    Returns void

  • set_blue(blue: number): void
  • Sets the blue channel of color to blue.

    Parameters

    • blue: number

      a float value between 0.0f and 1.0f

    Returns void

  • set_blue_byte(blue: number): void
  • Sets the blue channel of color to blue.

    Parameters

    • blue: number

      a byte value between 0 and 255

    Returns void

  • set_blue_float(blue: number): void
  • Sets the blue channel of color to blue.

    Parameters

    • blue: number

      a float value between 0.0f and 1.0f

    Returns void

  • set_from_4f(red: number, green: number, blue: number, alpha: number): void
  • Sets the values of the passed channels into a #CoglColor

    Parameters

    • red: number

      value of the red channel, between 0 and %1.0

    • green: number

      value of the green channel, between 0 and %1.0

    • blue: number

      value of the blue channel, between 0 and %1.0

    • alpha: number

      value of the alpha channel, between 0 and %1.0

    Returns void

  • set_from_4ub(red: number, green: number, blue: number, alpha: number): void
  • Sets the values of the passed channels into a #CoglColor.

    Parameters

    • red: number

      value of the red channel, between 0 and 255

    • green: number

      value of the green channel, between 0 and 255

    • blue: number

      value of the blue channel, between 0 and 255

    • alpha: number

      value of the alpha channel, between 0 and 255

    Returns void

  • set_green(green: number): void
  • Sets the green channel of color to green.

    Parameters

    • green: number

      a float value between 0.0f and 1.0f

    Returns void

  • set_green_byte(green: number): void
  • Sets the green channel of color to green.

    Parameters

    • green: number

      a byte value between 0 and 255

    Returns void

  • set_green_float(green: number): void
  • Sets the green channel of color to green.

    Parameters

    • green: number

      a float value between 0.0f and 1.0f

    Returns void

  • set_red(red: number): void
  • Sets the red channel of color to red.

    Parameters

    • red: number

      a float value between 0.0f and 1.0f

    Returns void

  • set_red_byte(red: number): void
  • set_red_float(red: number): void
  • Sets the red channel of color to red.

    Parameters

    • red: number

      a float value between 0.0f and 1.0f

    Returns void

  • to_hsl(): [number, number, number]
  • Converts color to the HLS format.

    The hue value is in the 0 .. 360 range. The luminance and saturation values are in the 0 .. 1 range.

    Returns [number, number, number]

  • unpremultiply(): void
  • Converts a pre-multiplied color to a non-premultiplied color. For example, semi-transparent red is (0.5, 0, 0, 0.5) when premultiplied and (1.0, 0, 0, 0.5) when non-premultiplied.

    Returns void

  • equal(v1: object, v2: object): number
  • Compares two #CoglColors and checks if they are the same.

    This function can be passed to g_hash_table_new() as the key_equal_func parameter, when using #CoglColors as keys in a #GHashTable.

    Parameters

    • v1: object

      a #CoglColor

    • v2: object

      a #CoglColor

    Returns number

  • init_from_hsl(hue: number, saturation: number, luminance: number): Cogl.Color
  • Converts a color expressed in HLS (hue, luminance and saturation) values into a #CoglColor.

    Parameters

    • hue: number

      hue value, in the 0 .. 360 range

    • saturation: number

      saturation value, in the 0 .. 1 range

    • luminance: number

      luminance value, in the 0 .. 1 range

    Returns Cogl.Color

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method