Object | +---DColor
The color class implements a number of methods for using colors.
#include <stdio.h> #include "ofc/DColor.h" int main(int argc, char *argv[]) { DColor *red = [DColor alloc]; DColor *grn = [DColor alloc]; DColor *blu = [DColor new ]; DColor *col = [DColor new ]; double H,S,V; DText *str; [red init :"red"]; // Init with a color name [grn init :0 :255 :0 :80]; // Init with green color and alpha 80 [blu set :0 :0 :255]; // Set the blue color [col move :red]; // Move the color [col blend :123 :145 :78 :20]; // Blend the color with another color, alpha 20 [col lighter :1.3]; // Makes the color lighter [col toHSV :&H :&S :&V]; // Convert the color to HSV str = [col toText]; // Convert the color to text printf("Color (%0d,%0d,%0d) or \"%s\" in HSV:%.3f, %.3f, %.3f\n", [col red], [col green], [col blue], [str cstring], H, S, V); [str free]; // Cleanup [col free]; [blu free]; [grn free]; [red free]; return 0; }