Packagesketchbook.colors
Classpublic class ColorSB

色情報を表現したクラスです。

Colorクラスは、RGB,HSBによる色の操作を提供します。
このクラスはアルファチャンネルをサポートしません。

ColorクラスはvalueOfを実装している為インスタンスをuint型に変換することで、色への代入値として使用することができます。

Colorクラスの内部処理はColorUtilクラスに委譲されています。
Colorクラスを用いずに色の操作をう場合、ColorUtilクラスで同様の操作を行うこともできます。

TODO: 色の各要素は遅延評価なのでR,G,B,H,S,Bに対してデータのバインディングができない。速度優先にしてバインディング自体を諦めるか?

ColorUtilを使うと、brightnessを0とかにすると、必然的にhueやsaturationも0になる。本来のh,sを保存すべきか?


Example
  var col:Color = new Color(0xff0000);
  col.hue = 120;
  
  var bmd:BitmapData = new BitmapData(100,100,false,uint(col)); //Colorインスタンスを直接代入

See also

sketchbook.colors.ColorUtil


Public Properties
 PropertyDefined by
  blue : uint
青成分。 0-255
ColorSB
  brightness : Number
明度 0-100
ColorSB
  green : uint
緑成分。 0-255
ColorSB
  hue : Number
色相 0-360
ColorSB
  red : uint
赤成分。 0-255
ColorSB
  saturation : Number
彩度 0-100
ColorSB
  value : uint
色を24ビットで表現した数値です
ColorSB
Public Methods
 MethodDefined by
  
ColorSB(color:uint = 0)
ColorSB
  
applyColorMatrix(mat:ColorMatrixFilter):void
現在の色にColorMatrixFilterを適用します。
ColorSB
  
applyColorTransform(colt:ColorTransform):void
現在の色にColorTransformを適用します。
ColorSB
  
Color インスタンスの複製を返します。
ColorSB
  
setGray(value:Number):void
0-255の値でグレーの色を定義します。
ColorSB
  
setHSB(hue:Number, saturation:Number, brightness:Number):void
色相(hue), 彩度(saturation), 明度(brightnessChanges)から色を定義します。
ColorSB
  
setRGB(r:uint, g:uint, b:uint):void
R,G,Bの3つの値から色を定義します。
ColorSB
  
toGray():void
現在の色をグレースケールに変換します。
ColorSB
  
valueOf():Number
ColorSB
Property detail
blueproperty
blue:uint  [read-write]

青成分。 0-255

Implementation
    public function get blue():uint
    public function set blue(value:uint):void
brightnessproperty 
brightness:Number  [read-write]

明度 0-100

Implementation
    public function get brightness():Number
    public function set brightness(value:Number):void
greenproperty 
green:uint  [read-write]

緑成分。 0-255

Implementation
    public function get green():uint
    public function set green(value:uint):void
hueproperty 
hue:Number  [read-write]

色相 0-360

Implementation
    public function get hue():Number
    public function set hue(value:Number):void
redproperty 
red:uint  [read-write]

赤成分。 0-255

Implementation
    public function get red():uint
    public function set red(value:uint):void
saturationproperty 
saturation:Number  [read-write]

彩度 0-100

Implementation
    public function get saturation():Number
    public function set saturation(value:Number):void
valueproperty 
value:uint  [read-write]

色を24ビットで表現した数値です

Implementation
    public function get value():uint
    public function set value(value:uint):void
Constructor detail
ColorSB()constructor
public function ColorSB(color:uint = 0)

Parameters
color:uint (default = 0) — 24bit unit value for color. This class does not support alpha channel
Method detail
applyColorMatrix()method
public function applyColorMatrix(mat:ColorMatrixFilter):void

現在の色にColorMatrixFilterを適用します。

Parameters
mat:ColorMatrixFilter

See also

flash.filters.ColorMatrixFilter
applyColorTransform()method 
public function applyColorTransform(colt:ColorTransform):void

現在の色にColorTransformを適用します。

Parameters
colt:ColorTransform

See also

flash.geom.ColorTransform
clone()method 
public function clone():ColorSB

Color インスタンスの複製を返します。

Returns
ColorSB — The copy of the Color instance
setGray()method 
public function setGray(value:Number):void

0-255の値でグレーの色を定義します。

Parameters
value:Number — 0-255 gray scale.
setHSB()method 
public function setHSB(hue:Number, saturation:Number, brightness:Number):void

色相(hue), 彩度(saturation), 明度(brightnessChanges)から色を定義します。

Parameters
hue:Number — 0-360
 
saturation:Number — 0-100
 
brightness:Number — 0-100
setRGB()method 
public function setRGB(r:uint, g:uint, b:uint):void

R,G,Bの3つの値から色を定義します。

Parameters
r:uint — 0-255
 
g:uint — 0-255
 
b:uint — 0-255
toGray()method 
public function toGray():void

現在の色をグレースケールに変換します。

valueOf()method 
public function valueOf():Number

Returns
Number