Class: LiteRGSS::Color

Inherits:
Object
  • Object
show all
Defined in:
LiteRGSS.rb

Overview

Class that describes RGBA colors

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(red, green, blue, alpha = 255) ⇒ Color

Create a new color

Parameters:

  • red (Integer, nil)

    between 0 and 255

  • green (Integer, nil)

    between 0 and 255

  • blue (Integer, nil)

    between 0 and 255

  • alpha (Integer, nil) (defaults to: 255)

    between 0 and 255 (default : 255)

Instance Attribute Details

#alphaInteger

The alpha opacity of the color

Returns:

  • (Integer)

#blueInteger

The blue value of the color

Returns:

  • (Integer)

#greenInteger

The green value of the color

Returns:

  • (Integer)

#redInteger

The red value of the color

Returns:

  • (Integer)

Class Method Details

._load(str) ⇒ Color

Load a color from a serialized color

Parameters:

  • str (String)

    the serialized color

Returns:

Instance Method Details

#_dump(limit) ⇒ String

Serialize the color

Parameters:

  • limit (Object)

    ignored

Returns:

  • (String)

#eql?(color) ⇒ Boolean Also known as: ==, ===

Test if the Color is equal to an other Color

Parameters:

  • color (Color)

    the other color

Returns:

  • (Boolean)

#set(red, green = nil, blue = nil, alpha = nil) ⇒ self

Set the color parameters

Parameters:

  • red (Integer, nil)

    between 0 and 255

  • green (Integer, nil) (defaults to: nil)

    between 0 and 255

  • blue (Integer, nil) (defaults to: nil)

    between 0 and 255

  • alpha (Integer, nil) (defaults to: nil)

    between 0 and 255

Returns:

  • (self)

#to_sString Also known as: inspect

Convert the color to a string that can be shown to the user

Returns:

  • (String)

    (r, g, b, a)