b8180d9f6d41dc708a2f249ba892cbca311e7a06 jcasper Mon Feb 27 11:38:55 2023 -0800 Adding transparency support for colors refs #30569 diff --git src/inc/psGfx.h src/inc/psGfx.h index d9b57a7..8a75bae 100644 --- src/inc/psGfx.h +++ src/inc/psGfx.h @@ -6,30 +6,31 @@ #ifndef PSGFX_H #define PSGFX_H #include "psPoly.h" struct psGfx /* A postScript output file. */ { FILE *f; /* File to write to. */ double userWidth, userHeight; /* Size of image in virtual pixels. */ double ptWidth, ptHeight; /* Size of image in points (1/72 of an inch) */ double xScale, yScale; /* Conversion from pixels to points. */ double xOff, yOff; /* Offset from pixels to points. */ double fontHeight; /* Height of current font. */ + boolean newTransOps; /* Local GS supports newer transparency operators */ }; struct psGfx *psOpen(char *fileName, double userWidth, double userHeight, /* Dimension of image in user's units. */ double ptWidth, double ptHeight, /* Dimension of image in points. */ double ptMargin); /* Image margin in points. */ /* Open up a new postscript file. If ptHeight is 0, it will be * calculated to keep pixels square. */ void psClose(struct psGfx **pPs); /* Close out postScript file. */ void psTranslate(struct psGfx *ps, double xTrans, double yTrans); /* add a constant to translate all coordinates */ @@ -81,30 +82,33 @@ void psTextInBox(struct psGfx *mg, double x, double y, double width, double height, char *text); /* Draw a line of text filling in box defined by x/y/width/height */ void psTextCentered(struct psGfx *mg, double x, double y, double width, double height, char *text); /* Draw a line of text centered in box defined by x/y/width/height */ void psTimesFont(struct psGfx *ps, double size); /* Set font to times of a certain size. */ void psSetColor(struct psGfx *ps, int r, int g, int b); /* Set current color. r/g/b values are between 0 and 255. */ +void psSetColorAlpha(struct psGfx *ps, int a); +/* Set current color alpha. a values are between 0 (transparent) and 255 (opaque). */ + void psSetGray(struct psGfx *ps, double grayVal); /* Set gray value (between 0.0 and 1.0. */ void psPushG(struct psGfx *ps); /* Save graphics state on stack. */ void psPopG(struct psGfx *ps); /* Pop off saved graphics state. */ void psDrawPoly(struct psGfx *ps, struct psPoly *poly, boolean filled); /* Draw a possibly filled polygon */ void psFillEllipse(struct psGfx *ps, double x, double y, double xrad, double yrad); /* Draw a filled ellipse */