Function:ss2sbc

From S2PLOT

(Difference between revisions)
Jump to: navigation, search
Revision as of 01:22, 30 October 2007
S2plot admin (Talk | contribs)

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

Line 11: Line 11:
==Description== ==Description==
-Set the background colour. This call should almost always be followed by calls to s2scr to set the 0th colour index to be the same as the background, and the 1st colour index to be the opposite. Some S2PLOT internals always use white to draw text, and setting the background colour to a light value might result in some text being difficult or impossible to read. +Set the background colour. This call should usually be followed by calls to s2scr to set the 0th colour index to be the same as the background, and the 1st colour index to be the opposite.
== See Also == == See Also ==
<table> <table>
<tr><td>[[Function:struct_COLOUR | struct_COLOUR ]]</td><td>Data structure for (r,g,b) colour indices. </td></tr> <tr><td>[[Function:struct_COLOUR | struct_COLOUR ]]</td><td>Data structure for (r,g,b) colour indices. </td></tr>
 +<tr><td>[[Function:ss2qbc | ss2qbc]]</td><td>Query background colour</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:ss2sfc | ss2sfc ]]</td><td>Set the foreground colour. </td></tr>
</table> </table>

Current revision

ss2sbc

Set the background colour.

Prototype

void ss2sbc(float r, float g, float b);

Description

Set the background colour. This call should usually be followed by calls to s2scr to set the 0th colour index to be the same as the background, and the 1st colour index to be the opposite.

See Also

struct_COLOUR Data structure for (r,g,b) colour indices.
ss2qbcQuery background colour
s2scr Set colour representation, ie. define a colour associated with an index.
ss2sfc Set the foreground colour.


Code Example

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

int main(int argc, char *argv[])
{
   float r, g, b; 				/* Background colour */
   XYZ xyz = { 0.0, 0.0, 0.0 };			/* Position */
   COLOUR col;					/* Sphere colour */ 
   float radius = 0.3;				/* Radius */

   s2opend("/?",argc, argv);			/* Open the display */

   r = 0.3; 					/* Background colour */
   g = 0.7;
   b = 0.2;
   ss2sbc(r, g, b);				/* Set background colour */

   s2swin(-1.,1., -1.,1., -1.,1.);		/* Set the window coordinates */
   s2box("BCDET",0,0,"BCDET",0,0,"BCDET",0,0);	/* Draw coordinate box */

   col.r = 1.0-r;				/* Sphere colour */
   col.g = 1.0-g;				/* Sphere colour */
   col.b = 1.0-b;				/* Sphere colour */
   ns2vsphere(xyz, radius, col);		/* Draw the sphere */

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

Back to S2PLOT function list.


Personal tools