More scripts: Raster
Syntax Highlighing:
comments, key words, predefined symbols, class members & methods, functions & classes
# rgbhis.sml
# convert between rgb and his
# each function also takes a maximum rgb value for proper scaling
# max for 8-bit unsigned = 255
# max for 16-bit unsigned = 65535
clear();
numeric maxrgb = 255;
numeric h, i, s;
numeric r, g, b;
for h = 1 to 360 step 179 {
for i = 1 to 100 step 49 {
for s = 1 to 100 step 49 {
ConvertHIStoRGB(maxrgb, h, i, s, r, g, b);
printf("%s: %6d %6d %6d %6d %6d %6d \n", "his -> rgb", h, i, s, r, g, b);
}
}
}
print("\n\n");
for r = 1 to 255 step 100 {
for g = 1 to 255 step 100 {
for b = 1 to 255 step 100 {
ConvertRGBtoHIS(maxrgb, r, g, b, h, i, s);
printf("%s: %6d %6d %6d %6d %6d %6d \n", "rgb -> his", r, g, b, h, i, s) ;
}
}
}