Function:s2qtxtyzf

From S2PLOT

(Difference between revisions)
Jump to: navigation, search

Revision as of 22:57, 28 October 2007

s2qtxtyzf

Find the bounding box of text drawn with s2textyzf.

Prototype

void s2qtxtyzf(float *y1, float *y2, float *z1, float *z2, float x, float y, float z, 
float flipy, float flipz, char *text, float pad);

Description

Find the bounding box of text drawn with the s2textyzf function. For convenience, pad can be given > 0.0 to obtain padding around the text of pad percent.

See Also

s2qtxtyzf Find the bounding box of text drawn with s2textyzf.
s2textyz Draw text in the yz plane at a fixed x coordinate.

PGPLOT Equivalent

PGQTXT

Code Example

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

int main(int argc, char *argv[])
{
   float x = 0.0;
   float y = 0.5;
   float z = 0.2; 
   float flipy = -1.0;
   float flipz = -1.0;
   float y1,y2, z1,z2;				/* Bounding coordinates */
   char string[32] = "S2PLOT is great!";
   float pad = 0.5;				/* Padding around text */

   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 */

   s2sci(S2_PG_YELLOW);
   s2slw(2);					/* Set line width */
   s2textyzf(x,y,z,flipy,flipz,string);		/* Write some flipped text in y-z plane */

   s2qtxtyzf(&y1,&y2, &z1,&z2, x,y,z, flipy, flipz, string, pad);
						/* Query bounding box for flipped text */

   s2sci(S2_PG_GREEN);	
   s2rectyz(y1,y2, z1,z2, x-0.01);		/* Draw bounding rectangle */
   s2show(1);					/* Open the s2plot window */
   
   return 1;
}

Back to S2PLOT function list.


Personal tools