Function:ss2qar

From S2PLOT

Jump to: navigation, search

ss2qar

Query the aspect ratio.

Prototype

float ss2qar(void);

Description

Query the aspect ratio: returned value is ratio of width to height, ie. it is normally > 1.

See Also

s2openOpen the S2PLOT device.
s2opendOpen the S2PLOT device (device string version).
s2opendoOpen the S2PLOT device (device string version, ignoring command line arguments).
s2ldevList the available S2PLOT devices on stdout.

Code Example

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

void cb(double *t, int *kc)
{
   float qar = ss2qar();                        /* Query the aspect ratio */
   char string[32];                     
   sprintf(string,"aspect ratio = %.2f",qar);   /* Write to string */
   s2textxy(0,0,0,string);                      /* Display text */
}

int main(int argc, char *argv[])
{
   fprintf(stderr,"Resize window to see change in aspect ratio");

   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.


Personal tools