HexColor |
Bitmaps | |
Aptilis 1 |
HexColor(HexadecimalString)
HexColor transforms a string that represents a colour, into an Aptilis
colour index. Aptilis uses a default 256 colour palette, which contains
a broad range of tones. HexColor takes a string such as "FFDE5C"
which contains three hexadecimal values and translates the values for
red, green and blue into an Aptilis color index that matches the given
colour in the best possible way.
Of course if you have redefined some or all of the 256 available colours,
HexColor will most probably return an unsuitable value.
Hexadecimal colour values are very often used in web pages.
Unless you have an hexadecimal value ready for use, you may prefer to use
more meaningful decimal values, with RGB
.
Return Value:
An Aptilis colour index. If any part of the string contains an invalid
character, then the remaining colours are considered to be 0.
Note: Valid hexadecimal numbers are numbers from 0 to 9 and letters
from A to F. Two hexadecimal numbers make up a value which ranges
from 0 to 255.
Example:
b = createBitmap(90, 200) if b = -1 print("Oops...\n") else clearBitmap(b, RGB(255, 255, 255)) printAt(b, 4, 20, "Red", RGB(255, 0, 0)) printAt(b, 4, 40, "Green", RGB(0, 255, 0)) printAt(b, 4, 60, "Blue", RGB(0, 0, 255)) printAt(b, 4, 80, "Yellow", RGB(255, 255, 0)) printAt(b, 4, 100, "HxRed", hexColor("FF0000")) printAt(b, 4, 120, "HxGreen", hexColor("00ff00")) printAt(b, 4, 140, "HxBlue", hexColor("0000FF")) printAt(b, 4, 160, "HxYellow", hexColor("FFFF00")) printAt(b, 4, 180, "HxMagenta", hexColor("FF00FF")) printAt(b, 4, 199, "HxCyan", hexColor("00FFFF")) saveGifFile("c:\\aptilis\\colors.gif", b) end ifResult:
For more details see the Bitmap topic.