|
Color Class
Has Constructor: NO, Can Create Instance: YES Can Subclass: YES
User the color object to represent a color, to manipulate the color or to convert from one color representation to other. To create a new color object declare a variable of type color and then create a new instance with the NEW statement. Many objects like the Graphics object return a color object.
See Also: File,Graphics,Picture
getHexColor
Syntax: Color.getHexColor as string
Returns a string with the hexadecimal representation of the color. Just like html colors.
CreateFromHex
Syntax: Color.CreateFromHex(Value as string)
Sets the color object to the color represented in hexadecimal format in the string Value.
SelectColor
Syntax: Color.SelectColor(Prompt as string)
Display a dialog to select a color. The prompt is displayed in the dialog. The default color selection dialog of the OS will be used. If the user cancels the dialog the color will remain the same as before calling this method.
RGB
Syntax: Color.RGB(r as integer,g as integer,b as integer)
Sets the color object with the color resulting from the mix of red in the parameter r, the green in g, and blue in b. Each value must be in the range of 0 to 255. A value of 0 means no color and 255 all the color. For example 255,0,0 is a pure red, while 80,80,80 is a shade of light grey.
HSV
Syntax: Color.HSV(h as float,s as float, v as float)
Sets the color object with the color resulting from the mix of Hue, Saturation and Light. Each value is a percentage expressed in decimals. For example 25% of hue is .25.
CMY
Syntax: Color.CYM(c as float,m as float,y as float)
Sets the color object with the color resulting from the mix of Cyan, Magenta and Yellow. Each value is a percentage expressed in decimals. For example 25% of Cyan is .25. Sorry no black on this model.
Red
Data Type: Integer
The red value of this color in the RGB model. Read only.
Green
Data Type: Integer
The green value of this color in the RGB model. Read only.
Blue
Data Type: Integer
The blue value of this color in the RGB model. Read only.
Hue
Data Type: Float
The Hue value of this color in the HSV model. Read only.
Saturation
Data Type: Float
The Saturation value of this color in the HSV model. Read only.
Value
Data Type: Float
The Ligth value of this color in the HSV model. This property is readonly.
Cyan
Data Type: Float
The Cyan value of this color in the CMYK model. This property is readonly.
Magenta
Data Type: Float
The Magenta value of this color in the CMYK model. This property is readonly.
Yellow
DataType: Integer
The Yellow value of this color in the CMYK model. This property is readonly.
sub main()
dim c as color
c = new(color)
c.rgb(255,0,0) //red color
c.selectcolor("Select a new color")
end sub
|