Function:struct COLOUR

From S2PLOT

(Difference between revisions)
Jump to: navigation, search

Revision as of 04:37, 26 October 2007

struct COLOUR

Data structure for (r,g,b) colour indices.

Definition

typedef struct {
   double r, g, b;
} COLOUR;

Description

Data structure for storing (r,g,b) colour indices. Note that this data structure uses double variables for (r,g,b) while the colour setting and querying functions use float variables.

See Also

Colours Useful colour definitions based on PGPlot default settings.
struct_XYZ Data structure for (x,y,z) coordinates.
s2scr Set colour representation, ie. define a colour associated with an index.
s2qcr Query colour representation.


Code Example

#include <stdio.h>
#include <stdlib.h>
#include "s2plot.h"


int main(int argc, char *argv[])
{
   XYZ xyz;					/* Declare an XYZ variable */
   COLOUR col;					/* Declare a COLOUR variable */
   s2opend("/?",argc, argv);			/* Open the display */
   s2swin(-1.,1., -1.,1., -1.,1.);		/* Set the window coordinates */
   s2box("BCDET",0,0,"BCDET",0,0,"BCDET",0,0);	/* Draw coordinate box */

   xyz.x =  0.0;				/* Set some values */
   xyz.y =  0.5;
   xyz.z = -0.3;

   col.r = 0.3;					/* Set colour value */
   col.g = 1.0;
   col.b = 0.7;

   ns2vpoint(xyz, col);				/* Draw the point */

   s2show(1);					/* Open the s2plot window */
   
   return 1;
}

Back to S2PLOT function list.


Personal tools