Function:ss2qfc
From S2PLOT
ss2sfc
Query the foreground colour.
Prototype
void ss2qfc(float *r, float *g, float *b);
Description
Query the foreground colour.
See Also
ss2sfc | Set the foreground colour. |
Code Example
#include <stdio.h>
#include <stdlib.h>
#include "s2plot.h"
void cb(double *t, int *kc)
{
static int lkc = 0; /* Count of key presses */
if (lkc != *kc) { /* Space bar pressed? */
ss2sfc(drand48(), drand48(), drand48()); /* Random foreground colour */
}
float r, g, b;
ss2qfc(&r, &g, &b); /* Query foreground colour */
char string[32];
sprintf(string,"Colour = (%.2f,%.2f,%.2f)",r,g,b); /* Write to string */
s2lab("","","",string);
lkc = *kc; /* Update count */
}
int main(int argc, char *argv[])
{
fprintf(stderr,"Press the <spacebar> to change background colour");
s2opend("/s2mono", argc, argv); /* Open in mono mode */
s2swin(-1.,1., -1.,1., -1.,1.); /* Set the window coordinates */
s2box("BCDET",0,0,"BCDET",0,0,"BCDET",0,0); /* Draw coordinate box */
cs2scb(cb); /* Install dynamic callback */
s2show(1); /* Open the s2plot window */
return 1;
}
Back to S2PLOT function list.