Class DColor

Inherits from:
Object
Conforms to:
DParsable, DTextable
Declared in:
DColor.h

Class Hierarchy

    Object
      |
      +---DColor

Class Description

The color class implements a number of methods for using colors.

Example:
#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;
}
Last modified:
19-Jul-2008 (DColor.h)

Instance Variables

public unsigned char _red
the red color 255 = full
public unsigned char _green
the green color 255 = full
public unsigned char _blue
the blue color 255 = full
public unsigned char _alpha
the alpha factor 255 = solid
public int _text
the (alternative) text color (DCLR_... or -1)

Method Index


generated 06-Sep-2008 by ObjcDoc 3.0.0