inc/pscmGfx.h

Go to the documentation of this file.
00001 /* pscmGfx - routines for making postScript output seem a
00002  * lot like 256 color bitmap output. 
00003  *
00004  * This file is copyright 2002 Jim Kent, but license is hereby
00005  * granted for all use - public, private or commercial. */
00006 
00007 #ifndef PSCMGFX_H
00008 #define PSCMGFX_H
00009 
00010 struct pscmGfx 
00011 /* Structure to simululate 256 color image
00012  * in postScript - so to make it easier to
00013  * swap between memGfx/gif output and PostScript
00014  * output */
00015     {
00016     struct pscmGfx *next;
00017     struct psGfx *ps;     /* Underlying postScript object. */
00018     int colAlloc;         /* Colors allocated. */
00019     int colUsed;          /* Colors used. */
00020     void *curFont;        /* Current font. */
00021     int curColor;         /* Current color. */
00022     struct colHash *colorHash;  /* Hash for fast look up of color. */
00023     struct rgbColor colorMap[256]; /* The color map. */
00024     int colorsUsed;             /* Number of colors actually used. */
00025     int clipMinX, clipMaxX;     /* Clipping region upper left corner. */
00026     int clipMinY, clipMaxY;     /* lower right, not inclusive */
00027     struct hash *hints;   /* Hints to guide behavior */
00028     };
00029 
00030 struct pscmGfx *pscmOpen(int width, int height, char *file);
00031 /* Return new pscmGfx. */
00032 
00033 void pscmClose(struct pscmGfx **ppscm);
00034 /* Finish writing out and free structure. */
00035 
00036 void pscmSetClip(struct pscmGfx *pscm, int x, int y, int width, int height);
00037 /* Set clipping rectangle. */
00038 
00039 void pscmUnclip(struct pscmGfx *pscm);
00040 /* Set clipping rect cover full thing. */
00041 
00042 int pscmFindColorIx(struct pscmGfx *pscm, int r, int g, int b);
00043 /* Find color index for rgb. */
00044 
00045 void pscmBox(struct pscmGfx *pscm, int x, int y, 
00046         int width, int height, int colorIx);
00047 /* Draw a box. */
00048 
00049 void pscmLine(struct pscmGfx *pscm, 
00050         int x1, int y1, int x2, int y2, int colorIx);
00051 /* Draw a line from one point to another. */
00052 
00053 void pscmText(struct pscmGfx *pscm, int x, int y, int colorIx, 
00054         MgFont *font, char *text);
00055 /* Draw a line of text with upper left corner x,y. */
00056 
00057 void pscmTextRight(struct pscmGfx *pscm, int x, int y, int width, int height,
00058         int color, MgFont *font, char *text);
00059 /* Draw a line of text right justified in box defined by x/y/width/height */
00060 
00061 void pscmTextCentered(struct pscmGfx *pscm, int x, int y, 
00062         int width, int height, int color, MgFont *font, char *text);
00063 /* Draw a line of text centered in box defined by x/y/width/height */
00064 
00065 #endif /* PSCMGFX_H */

Generated on Tue Dec 25 18:39:29 2007 for blat by  doxygen 1.5.2