Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search  

pwrit.c

Go to the documentation of this file.
00001 /* pwrit.f -- translated by f2c (version 19961017).
00002    You must link the resulting object file with the libraries:
00003         -lf2c -lm   (in that order)
00004 */
00005 
00006 #include "f2c.h"
00007 
00008 /* Common Block Declarations */
00009 
00010 extern struct {
00011     real xpgmin, ypgmin, xpgmax, ypgmax, xclbot, yclbot, xcltop, ycltop, xbot,
00012              ybot, xtop, ytop, xmin, ymin, xmax, ymax;
00013     integer ixcoor, iycoor;
00014     real alphxx, betaxx, alphyy, betayy, tmajx, tminx, tmajy, tminy;
00015     integer majrx, minrx, majry, minry, isizx, isizy;
00016     real xphold, yphold;
00017 } zzzplt_;
00018 
00019 #define zzzplt_1 zzzplt_
00020 
00021 extern struct {
00022     real xphmax, yphmax;
00023     integer ixpmax, iypmax;
00024     real xpscal, ypscal;
00025     integer iflip, nplotr;
00026     char cfile[64];
00027 } zzpltr_;
00028 
00029 #define zzpltr_1 zzpltr_
00030 
00031 
00032 
00033 
00034 /* Subroutine */ int pwrit_(real *x, real *y, char *ch, integer *nch, integer 
00035         *isiz, integer *ior, integer *icent, ftnlen ch_len)
00036 {
00037     /* System generated locals */
00038     integer i__1;
00039 
00040     /* Local variables */
00041     static integer i__, nchar;
00042     static real width;
00043     static integer isize;
00044     static real ct, dx, dy, oor, st, xx, yy;
00045     extern /* Subroutine */ int zzchar_(char *, real *, real *, real *, real *
00046             , ftnlen), zzphys_(real *, real *);
00047 
00048 
00049 /*  Additional options besides NCAR's choices: */
00050 
00051 /*    NCH < 0    ==> use absolute coordinates rather than user coords. */
00052 /*                   [this is because the use of integer absolute   ] */
00053 /*                   [coordinates is not implemented in this package] */
00054 
00055 /*    ABS(NCH) = 999 ==> find length of string by looking for a 0 byte. */
00056 
00057 /*    ICENT = -2 ==> (X,Y) is lower left corner of string to plot. */
00058 
00059 /* .......................................................................
00060  */
00061 
00062 /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00063  */
00064 /*  Calculate character width in terms of 1/1000 of the x-width. */
00065 
00066 
00067 /*  Internal Data for PLOTPAK */
00068 
00069     /* Parameter adjustments */
00070     --ch;
00071 
00072     /* Function Body */
00073     isize = *isiz;
00074     if (isize <= 0) {
00075         isize = 8;
00076     } else if (isize == 1) {
00077         isize = 12;
00078     } else if (isize == 2) {
00079         isize = 16;
00080     } else if (isize == 3) {
00081         isize = 24;
00082     }
00083 
00084     width = isize * .001f * (zzzplt_1.xpgmax - zzzplt_1.xpgmin);
00085 
00086 /*  Rotation/scaling factors for digitization.  Include factor of 1/6 */
00087 /*  to allow for digitization scale in ZZCHAR. */
00088 
00089     oor = *ior * .017453292f;
00090     dx = width * cos(oor);
00091     dy = width * sin(oor);
00092     ct = dx * .1666667f;
00093     st = dy * .1666667f;
00094 
00095 /*  Starting location for first character. */
00096 
00097     xx = *x;
00098     yy = *y;
00099     if (*nch > 0) {
00100         zzphys_(&xx, &yy);
00101     }
00102 
00103 /*  Get no. of characters in string.  Special option 999 must be checked. 
00104 */
00105 
00106     nchar = abs(*nch);
00107     if (nchar == 999) {
00108         i__1 = nchar;
00109         for (i__ = 1; i__ <= i__1; ++i__) {
00110             if (*(unsigned char *)&ch[i__] == '\0') {
00111                 goto L20;
00112             }
00113 /* L10: */
00114         }
00115 L20:
00116         nchar = i__ - 1;
00117     }
00118 
00119 /*  If centering option is not lower-left corner, must calculate */
00120 /*  location of lower left corner. */
00121 
00122     if (*icent != -2) {
00123 /*  Move from center of character down to bottom (aspect ratio = 7/6) 
00124 */
00125         xx += dy * .5833333f;
00126         yy -= dx * .5833333f;
00127         if (*icent == 0) {
00128             xx -= nchar * .5f * dx;
00129             yy -= nchar * .5f * dy;
00130         } else if (*icent == 1) {
00131             xx -= nchar * dx;
00132             yy -= nchar * dy;
00133         }
00134     }
00135 /* .......................................................................
00136  */
00137     i__1 = nchar;
00138     for (i__ = 1; i__ <= i__1; ++i__) {
00139         zzchar_(ch + i__, &xx, &yy, &ct, &st, 1L);
00140         xx += dx;
00141         yy += dy;
00142 /* L100: */
00143     }
00144 /* .......................................................................
00145  */
00146     zzzplt_1.xphold = xx;
00147     zzzplt_1.yphold = yy;
00148     return 0;
00149 } /* pwrit_ */
00150 
 

Powered by Plone

This site conforms to the following standards: