Function:struct COLOUR

From S2PLOT

(Difference between revisions)
Jump to: navigation, search
Revision as of 04:37, 26 October 2007
S2plot admin (Talk | contribs)

← Previous diff
Current revision
S2plot admin (Talk | contribs)

Line 18: Line 18:
<table> <table>
<tr><td>[[Function:Colours | Colours ]]</td><td>Useful colour definitions based on PGPlot default settings. </td></tr> <tr><td>[[Function:Colours | Colours ]]</td><td>Useful colour definitions based on PGPlot default settings. </td></tr>
-<tr><td>[[Function:struct_XYZ | struct_XYZ ]]</td><td>Data structure for (x,y,z) coordinates. </td></tr>+<tr><td>[[Function:struct XYZ | struct XYZ ]]</td><td>Data structure for (x,y,z) coordinates. </td></tr>
<tr><td>[[Function:s2scr | s2scr ]]</td><td>Set colour representation, ie. define a colour associated with an index. </td></tr> <tr><td>[[Function:s2scr | s2scr ]]</td><td>Set colour representation, ie. define a colour associated with an index. </td></tr>
<tr><td>[[Function:s2qcr | s2qcr ]]</td><td>Query colour representation. </td></tr> <tr><td>[[Function:s2qcr | s2qcr ]]</td><td>Query colour representation. </td></tr>

Current revision

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.