Code: Select all
/* pre-defined palettes */
static Palette Gray() {
return Palette(imPaletteGray()); }
static Palette Red() {
return Palette(imPaletteRed()); }
static Palette Green() {
return Palette(imPaletteGreen()); }
static Palette Blue() {
return Palette(imPaletteBlue()); }
static Palette Yellow() {
return Palette(imPaletteYellow()); }
static Palette Magenta() {
return Palette(imPaletteMagenta()); }
static Palette Cyan() {
return Palette(imPaletteCyan()); }
static Palette Rainbow() {
return Palette(imPaletteRainbow()); }
static Palette Hues() {
return Palette(imPaletteHues()); }
static Palette BlueIce() {
return Palette(imPaletteBlueIce()); }
static Palette HotIron() {
return Palette(imPaletteHotIron()); }
static Palette BlackBody() {
return Palette(imPaletteBlackBody()); }
static Palette HighContrast() {
return Palette(imPaletteHighContrast()); }
static Palette Linear() {
return Palette(imPaletteLinear()); }
static Palette Uniform() {
return Palette(imPaletteUniform()); }
static int UniformIndex(long color) {
return imPaletteUniformIndex(color); }
static int UniformIndexHalftoned(long color, int x, int y) {
return imPaletteUniformIndexHalftoned(color, x, y); }
Code: Select all
#define ColorEncode(red, green, blue) cast(clong, ((cast(clong, (red)) shl 16) or (cast(clong, (green)) shl 8)) or cast(clong, (blue)))
#define ColorRed(color) cubyte((color) shr 16)
#define ColorGreen(color) cubyte((color) shr 8)
#define ColorBlue(color) cubyte(color)
#define Gray() cast(Palette, Palette(imPaletteGray()))
#define Red() cast(Palette, Palette(imPaletteRed()))
#define Green() cast(Palette, Palette(imPaletteGreen()))
#define Blue() cast(Palette, Palette(imPaletteBlue()))
#define Yellow() cast(Palette, Palette(imPaletteYellow()))
#define Magenta() cast(Palette, Palette(imPaletteMagenta()))
#define Cyan() cast(Palette, Palette(imPaletteCyan()))
#define Rainbow() cast(Palette, Palette(imPaletteRainbow()))
#define Hues() cast(Palette, Palette(imPaletteHues()))
#define BlueIce() cast(Palette, Palette(imPaletteBlueIce()))
#define HotIron() cast(Palette, Palette(imPaletteHotIron()))
#define BlackBody() cast(Palette, Palette(imPaletteBlackBody()))
#define HighContrast() cast(Palette, Palette(imPaletteHighContrast()))
#define Linear() cast(Palette, Palette(imPaletteLinear()))
#define Uniform() cast(Palette, Palette(imPaletteUniform()))
#define UniformIndex(color) clng(imPaletteUniformIndex((color)))
#define UniformIndexHalftoned(color, x, y) clng(imPaletteUniformIndexHalftoned((color), (x), (y)))
Declare Function ColorEncode(Byval red as UByte, Byval green as UByte,Byval blue as UByte) as CLong
return cast(clong, ((cast(clong, (red)) shl 16) or (cast(clong, (green)) shl 8)) or cast(clong, (blue)))
End Function
The above piece of code is adapted from fbfrog's output. As I'm still too new to the language I'm unable to translate it myself.