color.c File Reference

#include "common.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <ctype.h>
#include <strings.h>
#include "machine.h"
#include "bu.h"
#include "vmath.h"

Include dependency graph for color.c:

Go to the source code of this file.

Defines

#define ACHROMATIC   -1.0
#define HUE   0
#define SAT   1
#define VAL   2
#define RED   0
#define GRN   1
#define BLU   2

Functions

void bu_rgb_to_hsv (unsigned char *rgb, fastf_t *hsv)
int bu_hsv_to_rgb (fastf_t *hsv, unsigned char *rgb)
int bu_str_to_rgb (char *str, unsigned char *rgb)


Detailed Description

Routines to convert between various color models.

Author:
Paul Tanenbaum
Source
The U. S. Army Research Laboratory
Aberdeen Proving Ground, Maryland 21005-5068 USA
Convert between RGB and HSV color models

R, G, and B are in {0, 1, ..., 255},

H is in [0.0, 360.0), and S and V are in [0.0, 1.0],

unless S = 0.0, in which case H = ACHROMATIC.

These two routines are adapted from: pp. 592-3 of J.D. Foley, A. van Dam, S.K. Feiner, and J.F. Hughes, _Computer graphics: principles and practice_, 2nd ed., Addison-Wesley, Reading, MA, 1990.

Definition in file color.c.


Generated on Mon Sep 18 01:25:03 2006 for BRL-CAD by  doxygen 1.4.6