de.mirell.m3d

class CColor

Object | +--de.mirell.m3d.CColor
Implemented Interfaces: IXMLSerializable

class CColor extends Object
Represents a RGB color
Various methods allow for manipulation of colors within the Mirell3D system.
  • Usage:
    myColor = new CColor(255,0,0); // Red Color
  • Author:
    Mirell Development
  • Version:
    1.0.0

Property Summary

public static Black: CColor (read-only)
public static Blue: CColor (read-only)
public static Cyan: CColor (read-only)
public static Green: CColor (read-only)
public static Magenta: CColor (read-only)
public static Red: CColor (read-only)
public static White: CColor (read-only)
public static Yellow: CColor (read-only)

Constructor

public CColor ( r: Number, g: Number, b: Number)
Constructs a new color object

Method Summary

public clone ( ): CColor
Returns an excact copy of this color
public fromXML ( value: XML ): Void
Unserializes XML into the object
public getBlue ( ): Number
Retrives the amount of red in the color
public getColor ( ): CColor
Returns a new color instance of this color
public getColorValue ( ): Number
Return the color as decimal value
public getGreen ( ): Number
Retrives the amount of green in the color
public getRed ( ): Number
Retrieves the amount of red in the color
public setBlue ( value: Number ): Void
Sets the amount of blue in the color
public setColor ( r: Number, g: Number, b: Number ): CColor
Sets this color's RGB amounts
public setColorValue ( value: Number ): CColor
Sets this color's RGB values using a decimal value
public setGreen ( value: Number ): Void
Sets the amount of green in the color
public setRed ( value: Number ): Void
Sets the amount of red in the color
public toString ( ): String
Converts the specified object to a string and returns it.
public toXML ( ): XML
Serializes the object into XML

Property Documentation

Black

public static Black: CColor (read-only)

    Blue

    public static Blue: CColor (read-only)

      Cyan

      public static Cyan: CColor (read-only)

        Green

        public static Green: CColor (read-only)

          Magenta

          public static Magenta: CColor (read-only)

            Red

            public static Red: CColor (read-only)

              White

              public static White: CColor (read-only)

                Yellow

                public static Yellow: CColor (read-only)

                  Constructor Documentation

                  CColor

                  public function CColor (
                  r: Number,
                  g: Number,
                  b: Number)
                  Constructs a new color object
                  • Usage:
                    new CColor(r: Number, g: Number, b: Number)

                  Method Documentation

                  clone

                  public function clone (
                  ): CColor
                  Returns an excact copy of this color
                  • Returns:
                    Copy of this color as a new instance

                  fromXML

                  public function fromXML (
                  value: XML): Void
                  Unserializes XML into the object
                  Object state is set according to XML.

                  getBlue

                  public function getBlue (
                  ): Number
                  Retrives the amount of red in the color
                  • Returns:
                    Blue Amount

                  getColor

                  public function getColor (
                  ): CColor
                  Returns a new color instance of this color
                  • Returns:
                    New CColor with the same RGB amounts as this color

                  getColorValue

                  public function getColorValue (
                  ): Number
                  Return the color as decimal value
                  • Returns:
                    Returns the decimal color representation

                  getGreen

                  public function getGreen (
                  ): Number
                  Retrives the amount of green in the color
                  • Returns:
                    Green Amount

                  getRed

                  public function getRed (
                  ): Number
                  Retrieves the amount of red in the color
                  • Returns:
                    Red Amount

                  setBlue

                  public function setBlue (
                  value: Number): Void
                  Sets the amount of blue in the color
                  • Parameters:
                    value
                    Blue Amount

                  setColor

                  public function setColor (
                  r: Number,
                  g: Number,
                  b: Number): CColor
                  Sets this color's RGB amounts
                  • Parameters:
                    r
                    Red Amount
                    g
                    Green Amount
                    b
                    Blue Amount
                  • Returns:
                    Returns a reference to itself

                  setColorValue

                  public function setColorValue (
                  value: Number): CColor
                  Sets this color's RGB values using a decimal value
                  • Parameters:
                    value
                    A decimal value being used to populate the RGB values
                  • Example:
                    myColor.setColorValue(0xFF0000); // Red color

                  setGreen

                  public function setGreen (
                  value: Number): Void
                  Sets the amount of green in the color
                  • Parameters:
                    value
                    Green Amount

                  setRed

                  public function setRed (
                  value: Number): Void
                  Sets the amount of red in the color
                  • Parameters:
                    value
                    Red Amount

                  toString

                  public function toString (
                  ): String
                  Converts the specified object to a string and returns it.
                  • Overrides:
                  • Returns:
                    A string.
                  • Example:
                    trace(new myColor(255,0,0).toString()); // traces: "r:255,g:0,b:0"

                  toXML

                  public function toXML (
                  ): XML
                  Serializes the object into XML
                  The current object state will be serialized. The fromXML method must be able to unserialize the XML.

                  The documentation was generated from the following file:
                  • CColor.as, Last Modified: 21.08.2004 22:31:36