| Package | sketchbook.colors |
| Class | public class ColorUtil |
ColorUtilを用いることで、RGB,HSB,HLS間の色の変換等を行うことができます。
AS2との互換性保持の為、このクラスは色情報のやり取りに無名オブジェクト{r:uint, g:uint, b:uint}を用いています。
AS3で色を操作する場合には、Colorクラスの使用を推奨します。
var rgb:Object = {r:40, g:200, b:200}
var hsb:Object = ColorUtils.RGB2HSB(rgb)
trace(hsb.h,hsb.s,hsb.b)See also
| Method | Defined by | ||
|---|---|---|---|
| ColorUtil | |||
|
getHLS(color:uint):Object
[static]
24ビットの色を、h,l,sを格納したオブジェクトに変換します。
| ColorUtil | ||
|
getHSB(color:uint):Object
[static]
24ビットの色を、h,s,bを格納したオブジェクトに変換します。
| ColorUtil | ||
|
getRGB(rgb:uint):Object
[static]
24ビットの色を、r,g,bを格納したオブジェクトに変換します。
| ColorUtil | ||
|
HLS2HSB(h:Number, l:Number, s:Number):Object
[static]
Create {h,s,b} Object from H, L, S value.
| ColorUtil | ||
|
HLS2RGB(h:Number, l:Number, s:Number):Object
[static]
H, L, Sの値から、{r,g,b}のオブジェクトを取得します。
| ColorUtil | ||
|
HSB2HLS(h:Number, s:Number, b:Number):Object
[static]
Converts H, S, B values to {h:Hue, l:Luminous, s:Saturation} Object
| ColorUtil | ||
|
HSB2RGB(hue:Number, sat:Number, bri:Number):Object
[static]
convert H, S, B values to {r:red, g:green, b:blue} Object
| ColorUtil | ||
|
RGB2HLS(r:uint, g:uint, b:uint):Object
[static]
convert R,G,B values to {h:Hue,l:Luminous,s:Saturation} Object
| ColorUtil | ||
|
RGB2HSB(r:uint, g:uint, b:uint):Object
[static]
convert R,G,B values to {h:huse,s:saturation,b:brightness} Object
| ColorUtil | ||
|
setHLS(col:Object, h:Number, l:Number, s:Number):void
[static]
r,g,bを格納したオブジェクトの色を、HLSで定義しなおします。
| ColorUtil | ||
|
setHSB(col:Object, h:Number, s:Number, b:Number):void
[static]
r,g,bを格納したオブジェクトの色を、HSBで定義しなおします。
| ColorUtil | ||
|
setRGB(obj:Object, r:uint, g:uint, b:uint):void
[static]
Set Color.value with R,G,B.
| ColorUtil | ||
| ColorUtil | () | constructor |
public function ColorUtil()
| getHLS | () | method |
public static function getHLS(color:uint):Object24ビットの色を、h,l,sを格納したオブジェクトに変換します。
Parameterscolor:uint — color
|
Object |
| getHSB | () | method |
public static function getHSB(color:uint):Object24ビットの色を、h,s,bを格納したオブジェクトに変換します。
Parameterscolor:uint — color.
|
Object |
| getRGB | () | method |
public static function getRGB(rgb:uint):Object24ビットの色を、r,g,bを格納したオブジェクトに変換します。
Parametersrgb:uint — color
|
Object — Object that contains {r:Red, g:Green, b:Blue}
|
| HLS2HSB | () | method |
public static function HLS2HSB(h:Number, l:Number, s:Number):ObjectCreate {h,s,b} Object from H, L, S value.
Parametersh:Number |
|
l:Number |
|
s:Number |
Object — {h:Hue, s:Saturation, b:Brightness}
|
| HLS2RGB | () | method |
public static function HLS2RGB(h:Number, l:Number, s:Number):ObjectH, L, Sの値から、{r,g,b}のオブジェクトを取得します。
Parametersh:Number |
|
l:Number |
|
s:Number |
Object — {r:Red, g:Green, b:Blue}
|
| HSB2HLS | () | method |
public static function HSB2HLS(h:Number, s:Number, b:Number):ObjectConverts H, S, B values to {h:Hue, l:Luminous, s:Saturation} Object
Parametersh:Number |
|
s:Number |
|
b:Number |
Object — {h:Hue, l:Luminous, s:Saturation}
|
| HSB2RGB | () | method |
public static function HSB2RGB(hue:Number, sat:Number, bri:Number):Objectconvert H, S, B values to {r:red, g:green, b:blue} Object
Parametershue:Number — 0-360
|
|
sat:Number — 0-100
|
|
bri:Number — 0-100
|
Object — contains r(0-255), g(0-255), n(0-255)
|
| RGB2HLS | () | method |
public static function RGB2HLS(r:uint, g:uint, b:uint):Objectconvert R,G,B values to {h:Hue,l:Luminous,s:Saturation} Object
Parametersr:uint — Red value 0-255
|
|
g:uint — Green value 0-255
|
|
b:uint — Blue value 0-255
|
Object — contains {h:Hue,l:Luminous,s:Saturation}
|
| RGB2HSB | () | method |
public static function RGB2HSB(r:uint, g:uint, b:uint):Objectconvert R,G,B values to {h:huse,s:saturation,b:brightness} Object
Parametersr:uint — Red value 0-255
|
|
g:uint — Green value 0-255
|
|
b:uint — Blue value 0-255
|
Object — contains h(0-360), s(0-100), b(0-100)
|
| setHLS | () | method |
public static function setHLS(col:Object, h:Number, l:Number, s:Number):voidr,g,bを格納したオブジェクトの色を、HLSで定義しなおします。
Parameterscol:Object — with property h, s, b
|
|
h:Number — 0-255
|
|
l:Number — 0-255
|
|
s:Number — 0-255
|
| setHSB | () | method |
public static function setHSB(col:Object, h:Number, s:Number, b:Number):voidr,g,bを格納したオブジェクトの色を、HSBで定義しなおします。
Parameterscol:Object — with property h, s, b
|
|
h:Number — 0-255
|
|
s:Number — 0-255
|
|
b:Number — 0-255
|
| setRGB | () | method |
public static function setRGB(obj:Object, r:uint, g:uint, b:uint):voidSet Color.value with R,G,B.
Parametersobj:Object — with property r, g, b
|
|
r:uint — 0-255
|
|
g:uint — 0-255
|
|
b:uint — 0-255
|