Class: LiteRGSS::Tone

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

Overview

Class that describe tones (added/modified colors to the surface)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(red, green, blue, gray = 255) ⇒ Tone

Create a new tone

Parameters:

  • red (Integer, nil)

    between -255 and 255

  • green (Integer, nil)

    between -255 and 255

  • blue (Integer, nil)

    between -255 and 255

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

    between 0 and 255 (default : 255)

Instance Attribute Details

#blueInteger

The blue value of the tone

Returns:

  • (Integer)

#grayInteger

The gray modifier of the tone (255 => grayscale)

Returns:

  • (Integer)

#greenInteger

The green value of the tone

Returns:

  • (Integer)

#redInteger

The red value of the tone

Returns:

  • (Integer)

Class Method Details

._load(str) ⇒ Tone

Load a tone from a serialized tone

Parameters:

  • str (String)

    the serialized tone

Returns:

Instance Method Details

#_dump(limit) ⇒ String

Serialize the tone

Parameters:

  • limit (Object)

    ignored

Returns:

  • (String)

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

Test if the Tone is equal to an other Tone

Parameters:

  • tone (Tone)

    the other tone

Returns:

  • (Boolean)

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

Set the tone parameters

Parameters:

  • red (Integer, nil)

    between -255 and 255

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

    between -255 and 255

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

    between -255 and 255

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

    between 0 and 255

Returns:

  • (self)

#to_sString Also known as: inspect

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

Returns:

  • (String)

    (r, g, b, a)