Institut de Robòtica i Informàtica Industrial
KRD Group

The CuikSuite Project

color.c File Reference

Implementation of the functions operating on Tcolor. More...

#include "color.h"

Go to the source code of this file.

Functions

void NewColor (double r, double g, double b, Tcolor *c)
 Constructor.
void CopyColor (Tcolor *c_dst, Tcolor *c_src)
 Copy constructor.
void SetRed (double r, Tcolor *c)
 Changes the red component of a color.
void SetGreen (double g, Tcolor *c)
 Changes the green component of a color.
void SetBlue (double b, Tcolor *c)
 Changes the blue component of a color.
double GetRed (Tcolor *c)
 Gets the red component of a color.
double GetGreen (Tcolor *c)
 Gets the green component of a color.
double GetBlue (Tcolor *c)
 Gets the blue component of a color.
void PrintColor (FILE *f, Tcolor *c)
 Prints the color.
void DeleteColor (Tcolor *c)
 Destructor.

Detailed Description

Implementation of the functions working on colors as red/green/blue components.

See also:
Tcolor, color.h.

Definition in file color.c.


Function Documentation

void NewColor ( double  r,
double  g,
double  b,
Tcolor c 
)

Creates new color.

Parameters:
r The red component for the new color.
g The green component for the new color.
b The blue component for the new color.
c The color to intialize.

Definition at line 14 of file color.c.

References Tcolor::b, Tcolor::g, and Tcolor::r.

Referenced by InitPlot3d(), main(), NewFixJoint(), NewFreeJoint(), NewPrismaticJoint(), NewRevoluteJoint(), NewSphericalJoint(), NewUniversalJoint(), and PlotLink().

Here is the caller graph for this function:

void CopyColor ( Tcolor c_dst,
Tcolor c_src 
)

Creates new color from another color.

Parameters:
c_dst The color to create.
c_src The color from where to copy.

Definition at line 21 of file color.c.

References Tcolor::b, Tcolor::g, and Tcolor::r.

Referenced by CopyCPolyhedron(), CopyJoint(), GetCPolyhedronColor(), InitCPolyhedronFromFile(), NewCylinder(), NewSphere(), NewSphSphJoint(), SetCPolyhedronColor(), and StartNew3dObject().

Here is the caller graph for this function:

void SetRed ( double  r,
Tcolor c 
)

Changes the red component of a color.

Parameters:
r The new red component.
c The color to update.

Definition at line 28 of file color.c.

References Tcolor::r.

void SetGreen ( double  g,
Tcolor c 
)

Changes the green component of a color.

Parameters:
g The new green component.
c The color to update.

Definition at line 33 of file color.c.

References Tcolor::g.

void SetBlue ( double  b,
Tcolor c 
)

Changes the blue component of a color.

Parameters:
b The new blue component.
c The color to update.

Definition at line 38 of file color.c.

References Tcolor::b.

double GetRed ( Tcolor c  ) 

Gets the red component of a color.

Parameters:
c The color to query.
Returns:
The red component of the color.

Definition at line 43 of file color.c.

References Tcolor::r.

double GetGreen ( Tcolor c  ) 

Gets the green component of a color.

Parameters:
c The color to query.
Returns:
The green component of the color.

Definition at line 48 of file color.c.

References Tcolor::r.

double GetBlue ( Tcolor c  ) 

Gets the blue component of a color.

Parameters:
c The color to query.
Returns:
The blue component of the color.

Definition at line 53 of file color.c.

References Tcolor::r.

void PrintColor ( FILE *  f,
Tcolor c 
)

Prints the three components of a color in a file.

The componts (red, blue, and green) are printed as doubles, without any separation mark. This is the way in which Geomview uses colors.

See also:
plot3d.h, Tplot3d.
Parameters:
f The file where to write the color
c The color to print.

Definition at line 58 of file color.c.

References Tcolor::b, Tcolor::g, and Tcolor::r.

Referenced by PlotVect3d(), and SetColor3dObject().

Here is the caller graph for this function:

void DeleteColor ( Tcolor c  ) 

Deletes the information stored in a Tcolor and frees the allocated memory, if any.

Parameters:
c The color to delete.

Definition at line 63 of file color.c.

Referenced by main(), and PlotLink().

Here is the caller graph for this function: