00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef GFXSTATE_H
00010 #define GFXSTATE_H
00011
00012 #ifdef __GNUC__
00013 #pragma interface
00014 #endif
00015
00016 #include "gtypes.h"
00017 #include "Object.h"
00018 #include "Function.h"
00019
00020 class Array;
00021 class GfxFont;
00022 struct PDFRectangle;
00023
00024
00025
00026
00027
00028 #define gfxColorMaxComps funcMaxOutputs
00029
00030 struct GfxColor {
00031 fouble c[gfxColorMaxComps];
00032 };
00033
00034
00035
00036
00037
00038 struct GfxRGB {
00039 fouble r, g, b;
00040 };
00041
00042
00043
00044
00045
00046 struct GfxCMYK {
00047 fouble c, m, y, k;
00048 };
00049
00050
00051
00052
00053
00054 enum GfxColorSpaceMode {
00055 csDeviceGray,
00056 csCalGray,
00057 csDeviceRGB,
00058 csCalRGB,
00059 csDeviceCMYK,
00060 csLab,
00061 csICCBased,
00062 csIndexed,
00063 csSeparation,
00064 csDeviceN,
00065 csPattern
00066 };
00067
00068 class GfxColorSpace {
00069 public:
00070
00071 GfxColorSpace();
00072 virtual ~GfxColorSpace();
00073 virtual GfxColorSpace *copy() = 0;
00074 virtual GfxColorSpaceMode getMode() = 0;
00075
00076
00077 static GfxColorSpace *parse(Object *csObj);
00078
00079
00080 virtual void getGray(GfxColor *color, fouble *gray) = 0;
00081 virtual void getRGB(GfxColor *color, GfxRGB *rgb) = 0;
00082 virtual void getCMYK(GfxColor *color, GfxCMYK *cmyk) = 0;
00083
00084
00085 virtual int getNComps() = 0;
00086
00087
00088
00089 virtual void getDefaultRanges(fouble *decodeLow, fouble *decodeRange,
00090 int maxImgPixel);
00091
00092 private:
00093 };
00094
00095
00096
00097
00098
00099 class GfxDeviceGrayColorSpace: public GfxColorSpace {
00100 public:
00101
00102 GfxDeviceGrayColorSpace();
00103 virtual ~GfxDeviceGrayColorSpace();
00104 virtual GfxColorSpace *copy();
00105 virtual GfxColorSpaceMode getMode() { return csDeviceGray; }
00106
00107 virtual void getGray(GfxColor *color, fouble *gray);
00108 virtual void getRGB(GfxColor *color, GfxRGB *rgb);
00109 virtual void getCMYK(GfxColor *color, GfxCMYK *cmyk);
00110
00111 virtual int getNComps() { return 1; }
00112
00113 private:
00114 };
00115
00116
00117
00118
00119
00120 class GfxCalGrayColorSpace: public GfxColorSpace {
00121 public:
00122
00123 GfxCalGrayColorSpace();
00124 virtual ~GfxCalGrayColorSpace();
00125 virtual GfxColorSpace *copy();
00126 virtual GfxColorSpaceMode getMode() { return csCalGray; }
00127
00128
00129 static GfxColorSpace *parse(Array *arr);
00130
00131 virtual void getGray(GfxColor *color, fouble *gray);
00132 virtual void getRGB(GfxColor *color, GfxRGB *rgb);
00133 virtual void getCMYK(GfxColor *color, GfxCMYK *cmyk);
00134
00135 virtual int getNComps() { return 1; }
00136
00137
00138 fouble getWhiteX() { return whiteX; }
00139 fouble getWhiteY() { return whiteY; }
00140 fouble getWhiteZ() { return whiteZ; }
00141 fouble getBlackX() { return blackX; }
00142 fouble getBlackY() { return blackY; }
00143 fouble getBlackZ() { return blackZ; }
00144 fouble getGamma() { return gamma; }
00145
00146 private:
00147
00148 fouble whiteX, whiteY, whiteZ;
00149 fouble blackX, blackY, blackZ;
00150 fouble gamma;
00151 };
00152
00153
00154
00155
00156
00157 class GfxDeviceRGBColorSpace: public GfxColorSpace {
00158 public:
00159
00160 GfxDeviceRGBColorSpace();
00161 virtual ~GfxDeviceRGBColorSpace();
00162 virtual GfxColorSpace *copy();
00163 virtual GfxColorSpaceMode getMode() { return csDeviceRGB; }
00164
00165 virtual void getGray(GfxColor *color, fouble *gray);
00166 virtual void getRGB(GfxColor *color, GfxRGB *rgb);
00167 virtual void getCMYK(GfxColor *color, GfxCMYK *cmyk);
00168
00169 virtual int getNComps() { return 3; }
00170
00171 private:
00172 };
00173
00174
00175
00176
00177
00178 class GfxCalRGBColorSpace: public GfxColorSpace {
00179 public:
00180
00181 GfxCalRGBColorSpace();
00182 virtual ~GfxCalRGBColorSpace();
00183 virtual GfxColorSpace *copy();
00184 virtual GfxColorSpaceMode getMode() { return csCalRGB; }
00185
00186
00187 static GfxColorSpace *parse(Array *arr);
00188
00189 virtual void getGray(GfxColor *color, fouble *gray);
00190 virtual void getRGB(GfxColor *color, GfxRGB *rgb);
00191 virtual void getCMYK(GfxColor *color, GfxCMYK *cmyk);
00192
00193 virtual int getNComps() { return 3; }
00194
00195
00196 fouble getWhiteX() { return whiteX; }
00197 fouble getWhiteY() { return whiteY; }
00198 fouble getWhiteZ() { return whiteZ; }
00199 fouble getBlackX() { return blackX; }
00200 fouble getBlackY() { return blackY; }
00201 fouble getBlackZ() { return blackZ; }
00202 fouble getGammaR() { return gammaR; }
00203 fouble getGammaG() { return gammaG; }
00204 fouble getGammaB() { return gammaB; }
00205 fouble *getMatrix() { return mat; }
00206
00207 private:
00208
00209 fouble whiteX, whiteY, whiteZ;
00210 fouble blackX, blackY, blackZ;
00211 fouble gammaR, gammaG, gammaB;
00212 fouble mat[9];
00213 };
00214
00215
00216
00217
00218
00219 class GfxDeviceCMYKColorSpace: public GfxColorSpace {
00220 public:
00221
00222 GfxDeviceCMYKColorSpace();
00223 virtual ~GfxDeviceCMYKColorSpace();
00224 virtual GfxColorSpace *copy();
00225 virtual GfxColorSpaceMode getMode() { return csDeviceCMYK; }
00226
00227 virtual void getGray(GfxColor *color, fouble *gray);
00228 virtual void getRGB(GfxColor *color, GfxRGB *rgb);
00229 virtual void getCMYK(GfxColor *color, GfxCMYK *cmyk);
00230
00231 virtual int getNComps() { return 4; }
00232
00233 private:
00234 };
00235
00236
00237
00238
00239
00240 class GfxLabColorSpace: public GfxColorSpace {
00241 public:
00242
00243 GfxLabColorSpace();
00244 virtual ~GfxLabColorSpace();
00245 virtual GfxColorSpace *copy();
00246 virtual GfxColorSpaceMode getMode() { return csLab; }
00247
00248
00249 static GfxColorSpace *parse(Array *arr);
00250
00251 virtual void getGray(GfxColor *color, fouble *gray);
00252 virtual void getRGB(GfxColor *color, GfxRGB *rgb);
00253 virtual void getCMYK(GfxColor *color, GfxCMYK *cmyk);
00254
00255 virtual int getNComps() { return 3; }
00256
00257 virtual void getDefaultRanges(fouble *decodeLow, fouble *decodeRange,
00258 int maxImgPixel);
00259
00260
00261 fouble getWhiteX() { return whiteX; }
00262 fouble getWhiteY() { return whiteY; }
00263 fouble getWhiteZ() { return whiteZ; }
00264 fouble getBlackX() { return blackX; }
00265 fouble getBlackY() { return blackY; }
00266 fouble getBlackZ() { return blackZ; }
00267 fouble getAMin() { return aMin; }
00268 fouble getAMax() { return aMax; }
00269 fouble getBMin() { return bMin; }
00270 fouble getBMax() { return bMax; }
00271
00272 private:
00273
00274 fouble whiteX, whiteY, whiteZ;
00275 fouble blackX, blackY, blackZ;
00276 fouble aMin, aMax, bMin, bMax;
00277 fouble kr, kg, kb;
00278 };
00279
00280
00281
00282
00283
00284 class GfxICCBasedColorSpace: public GfxColorSpace {
00285 public:
00286
00287 GfxICCBasedColorSpace(int nCompsA, GfxColorSpace *altA,
00288 Ref *iccProfileStreamA);
00289 virtual ~GfxICCBasedColorSpace();
00290 virtual GfxColorSpace *copy();
00291 virtual GfxColorSpaceMode getMode() { return csICCBased; }
00292
00293
00294 static GfxColorSpace *parse(Array *arr);
00295
00296 virtual void getGray(GfxColor *color, fouble *gray);
00297 virtual void getRGB(GfxColor *color, GfxRGB *rgb);
00298 virtual void getCMYK(GfxColor *color, GfxCMYK *cmyk);
00299
00300 virtual int getNComps() { return nComps; }
00301
00302 virtual void getDefaultRanges(fouble *decodeLow, fouble *decodeRange,
00303 int maxImgPixel);
00304
00305
00306 GfxColorSpace *getAlt() { return alt; }
00307
00308 private:
00309
00310 int nComps;
00311 GfxColorSpace *alt;
00312 fouble rangeMin[4];
00313 fouble rangeMax[4];
00314 Ref iccProfileStream;
00315 };
00316
00317
00318
00319
00320
00321 class GfxIndexedColorSpace: public GfxColorSpace {
00322 public:
00323
00324 GfxIndexedColorSpace(GfxColorSpace *baseA, int indexHighA);
00325 virtual ~GfxIndexedColorSpace();
00326 virtual GfxColorSpace *copy();
00327 virtual GfxColorSpaceMode getMode() { return csIndexed; }
00328
00329
00330 static GfxColorSpace *parse(Array *arr);
00331
00332 virtual void getGray(GfxColor *color, fouble *gray);
00333 virtual void getRGB(GfxColor *color, GfxRGB *rgb);
00334 virtual void getCMYK(GfxColor *color, GfxCMYK *cmyk);
00335
00336 virtual int getNComps() { return 1; }
00337
00338 virtual void getDefaultRanges(fouble *decodeLow, fouble *decodeRange,
00339 int maxImgPixel);
00340
00341
00342 GfxColorSpace *getBase() { return base; }
00343 int getIndexHigh() { return indexHigh; }
00344 Guchar *getLookup() { return lookup; }
00345
00346 private:
00347
00348 GfxColorSpace *base;
00349 int indexHigh;
00350 Guchar *lookup;
00351 };
00352
00353
00354
00355
00356
00357 class GfxSeparationColorSpace: public GfxColorSpace {
00358 public:
00359
00360 GfxSeparationColorSpace(GString *nameA, GfxColorSpace *altA,
00361 Function *funcA);
00362 virtual ~GfxSeparationColorSpace();
00363 virtual GfxColorSpace *copy();
00364 virtual GfxColorSpaceMode getMode() { return csSeparation; }
00365
00366
00367 static GfxColorSpace *parse(Array *arr);
00368
00369 virtual void getGray(GfxColor *color, fouble *gray);
00370 virtual void getRGB(GfxColor *color, GfxRGB *rgb);
00371 virtual void getCMYK(GfxColor *color, GfxCMYK *cmyk);
00372
00373 virtual int getNComps() { return 1; }
00374
00375
00376 GString *getName() { return name; }
00377 GfxColorSpace *getAlt() { return alt; }
00378 Function *getFunc() { return func; }
00379
00380 private:
00381
00382 GString *name;
00383 GfxColorSpace *alt;
00384 Function *func;
00385 };
00386
00387
00388
00389
00390
00391 class GfxDeviceNColorSpace: public GfxColorSpace {
00392 public:
00393
00394 GfxDeviceNColorSpace(int nComps, GfxColorSpace *alt, Function *func);
00395 virtual ~GfxDeviceNColorSpace();
00396 virtual GfxColorSpace *copy();
00397 virtual GfxColorSpaceMode getMode() { return csDeviceN; }
00398
00399
00400 static GfxColorSpace *parse(Array *arr);
00401
00402 virtual void getGray(GfxColor *color, fouble *gray);
00403 virtual void getRGB(GfxColor *color, GfxRGB *rgb);
00404 virtual void getCMYK(GfxColor *color, GfxCMYK *cmyk);
00405
00406 virtual int getNComps() { return nComps; }
00407
00408
00409 GfxColorSpace *getAlt() { return alt; }
00410
00411 private:
00412
00413 int nComps;
00414 GString
00415 *names[gfxColorMaxComps];
00416 GfxColorSpace *alt;
00417 Function *func;
00418
00419 };
00420
00421
00422
00423
00424
00425 class GfxPatternColorSpace: public GfxColorSpace {
00426 public:
00427
00428 GfxPatternColorSpace(GfxColorSpace *underA);
00429 virtual ~GfxPatternColorSpace();
00430 virtual GfxColorSpace *copy();
00431 virtual GfxColorSpaceMode getMode() { return csPattern; }
00432
00433
00434 static GfxColorSpace *parse(Array *arr);
00435
00436 virtual void getGray(GfxColor *color, fouble *gray);
00437 virtual void getRGB(GfxColor *color, GfxRGB *rgb);
00438 virtual void getCMYK(GfxColor *color, GfxCMYK *cmyk);
00439
00440 virtual int getNComps() { return 0; }
00441
00442
00443 GfxColorSpace *getUnder() { return under; }
00444
00445 private:
00446
00447 GfxColorSpace *under;
00448
00449 };
00450
00451
00452
00453
00454
00455 class GfxPattern {
00456 public:
00457
00458 GfxPattern(int typeA);
00459 virtual ~GfxPattern();
00460
00461 static GfxPattern *parse(Object *obj);
00462
00463 virtual GfxPattern *copy() = 0;
00464
00465 int getType() { return type; }
00466
00467 private:
00468
00469 int type;
00470 };
00471
00472
00473
00474
00475
00476 class GfxTilingPattern: public GfxPattern {
00477 public:
00478
00479 GfxTilingPattern(Dict *streamDict, Object *stream);
00480 virtual ~GfxTilingPattern();
00481
00482 virtual GfxPattern *copy();
00483
00484 int getPaintType() { return paintType; }
00485 int getTilingType() { return tilingType; }
00486 fouble *getBBox() { return bbox; }
00487 fouble getXStep() { return xStep; }
00488 fouble getYStep() { return yStep; }
00489 Dict *getResDict()
00490 { return resDict.isDict() ? resDict.getDict() : (Dict *)NULL; }
00491 fouble *getMatrix() { return matrix; }
00492 Object *getContentStream() { return &contentStream; }
00493
00494 private:
00495
00496 GfxTilingPattern(GfxTilingPattern *pat);
00497
00498 int paintType;
00499 int tilingType;
00500 fouble bbox[4];
00501 fouble xStep, yStep;
00502 Object resDict;
00503 fouble matrix[6];
00504 Object contentStream;
00505 };
00506
00507
00508
00509
00510
00511 class GfxShading {
00512 public:
00513
00514 GfxShading();
00515 virtual ~GfxShading();
00516
00517 static GfxShading *parse(Object *obj);
00518
00519 int getType() { return type; }
00520 GfxColorSpace *getColorSpace() { return colorSpace; }
00521 GfxColor *getBackground() { return &background; }
00522 GBool getHasBackground() { return hasBackground; }
00523 void getBBox(fouble *xMinA, fouble *yMinA, fouble *xMaxA, fouble *yMaxA)
00524 { *xMinA = xMin; *yMinA = yMin; *xMaxA = xMax; *yMaxA = yMax; }
00525 GBool getHasBBox() { return hasBBox; }
00526
00527 private:
00528
00529 int type;
00530 GfxColorSpace *colorSpace;
00531 GfxColor background;
00532 GBool hasBackground;
00533 fouble xMin, yMin, xMax, yMax;
00534 GBool hasBBox;
00535 };
00536
00537
00538
00539
00540
00541 class GfxAxialShading: public GfxShading {
00542 public:
00543
00544 GfxAxialShading(fouble x0A, fouble y0A,
00545 fouble x1A, fouble y1A,
00546 fouble t0A, fouble t1A,
00547 Function **funcsA, int nFuncsA,
00548 GBool extend0A, GBool extend1A);
00549 virtual ~GfxAxialShading();
00550
00551 static GfxAxialShading *parse(Dict *dict);
00552
00553 void getCoords(fouble *x0A, fouble *y0A, fouble *x1A, fouble *y1A)
00554 { *x0A = x0; *y0A = y0; *x1A = x1; *y1A = y1; }
00555 fouble getDomain0() { return t0; }
00556 fouble getDomain1() { return t1; }
00557 void getColor(fouble t, GfxColor *color);
00558 GBool getExtend0() { return extend0; }
00559 GBool getExtend1() { return extend1; }
00560
00561 private:
00562
00563 fouble x0, y0, x1, y1;
00564 fouble t0, t1;
00565 Function *funcs[gfxColorMaxComps];
00566 int nFuncs;
00567 GBool extend0, extend1;
00568 };
00569
00570
00571
00572
00573
00574 class GfxRadialShading: public GfxShading {
00575 public:
00576
00577 GfxRadialShading(fouble x0A, fouble y0A, fouble r0A,
00578 fouble x1A, fouble y1A, fouble r1A,
00579 fouble t0A, fouble t1A,
00580 Function **funcsA, int nFuncsA,
00581 GBool extend0A, GBool extend1A);
00582 virtual ~GfxRadialShading();
00583
00584 static GfxRadialShading *parse(Dict *dict);
00585
00586 void getCoords(fouble *x0A, fouble *y0A, fouble *r0A,
00587 fouble *x1A, fouble *y1A, fouble *r1A)
00588 { *x0A = x0; *y0A = y0; *r0A = r0; *x1A = x1; *y1A = y1; *r1A = r1; }
00589 fouble getDomain0() { return t0; }
00590 fouble getDomain1() { return t1; }
00591 void getColor(fouble t, GfxColor *color);
00592 GBool getExtend0() { return extend0; }
00593 GBool getExtend1() { return extend1; }
00594
00595 private:
00596
00597 fouble x0, y0, r0, x1, y1, r1;
00598 fouble t0, t1;
00599 Function *funcs[gfxColorMaxComps];
00600 int nFuncs;
00601 GBool extend0, extend1;
00602 };
00603
00604
00605
00606
00607
00608 class GfxImageColorMap {
00609 public:
00610
00611
00612 GfxImageColorMap(int bitsA, Object *decode, GfxColorSpace *colorSpaceA);
00613
00614
00615 ~GfxImageColorMap();
00616
00617
00618 GBool isOk() { return ok; }
00619
00620
00621 GfxColorSpace *getColorSpace() { return colorSpace; }
00622
00623
00624 int getNumPixelComps() { return nComps; }
00625 int getBits() { return bits; }
00626
00627
00628 fouble getDecodeLow(int i) { return decodeLow[i]; }
00629 fouble getDecodeHigh(int i) { return decodeLow[i] + decodeRange[i]; }
00630
00631
00632 void getGray(Guchar *x, fouble *gray);
00633 void getRGB(Guchar *x, GfxRGB *rgb);
00634 void getCMYK(Guchar *x, GfxCMYK *cmyk);
00635
00636 private:
00637
00638 GfxColorSpace *colorSpace;
00639 int bits;
00640 int nComps;
00641 GfxColorSpace *colorSpace2;
00642 int nComps2;
00643 fouble *lookup;
00644 fouble
00645 decodeLow[gfxColorMaxComps];
00646 fouble
00647 decodeRange[gfxColorMaxComps];
00648 GBool ok;
00649 };
00650
00651
00652
00653
00654
00655 class GfxSubpath {
00656 public:
00657
00658
00659 GfxSubpath(fouble x1, fouble y1);
00660
00661
00662 ~GfxSubpath();
00663
00664
00665 GfxSubpath *copy() { return new GfxSubpath(this); }
00666
00667
00668 int getNumPoints() { return n; }
00669 fouble getX(int i) { return x[i]; }
00670 fouble getY(int i) { return y[i]; }
00671 GBool getCurve(int i) { return curve[i]; }
00672
00673
00674 fouble getLastX() { return x[n-1]; }
00675 fouble getLastY() { return y[n-1]; }
00676
00677
00678 void lineTo(fouble x1, fouble y1);
00679
00680
00681 void curveTo(fouble x1, fouble y1, fouble x2, fouble y2,
00682 fouble x3, fouble y3);
00683
00684
00685 void close();
00686 GBool isClosed() { return closed; }
00687
00688 private:
00689
00690 fouble *x, *y;
00691 GBool *curve;
00692
00693 int n;
00694 int size;
00695 GBool closed;
00696
00697 GfxSubpath(GfxSubpath *subpath);
00698 };
00699
00700 class GfxPath {
00701 public:
00702
00703
00704 GfxPath();
00705
00706
00707 ~GfxPath();
00708
00709
00710 GfxPath *copy()
00711 { return new GfxPath(justMoved, firstX, firstY, subpaths, n, size); }
00712
00713
00714 GBool isCurPt() { return n > 0 || justMoved; }
00715
00716
00717 GBool isPath() { return n > 0; }
00718
00719
00720 int getNumSubpaths() { return n; }
00721 GfxSubpath *getSubpath(int i) { return subpaths[i]; }
00722
00723
00724 fouble getLastX() { return subpaths[n-1]->getLastX(); }
00725 fouble getLastY() { return subpaths[n-1]->getLastY(); }
00726
00727
00728 void moveTo(fouble x, fouble y);
00729
00730
00731 void lineTo(fouble x, fouble y);
00732
00733
00734 void curveTo(fouble x1, fouble y1, fouble x2, fouble y2,
00735 fouble x3, fouble y3);
00736
00737
00738 void close();
00739
00740 private:
00741
00742 GBool justMoved;
00743 fouble firstX, firstY;
00744 GfxSubpath **subpaths;
00745 int n;
00746 int size;
00747
00748 GfxPath(GBool justMoved1, fouble firstX1, fouble firstY1,
00749 GfxSubpath **subpaths1, int n1, int size1);
00750 };
00751
00752
00753
00754
00755
00756 class GfxState {
00757 public:
00758
00759
00760
00761
00762 GfxState(fouble dpi, PDFRectangle *pageBox, int rotate,
00763 GBool upsideDown);
00764
00765
00766 ~GfxState();
00767
00768
00769 GfxState *copy() { return new GfxState(this); }
00770
00771
00772 fouble *getCTM() { return ctm; }
00773 fouble getX1() { return px1; }
00774 fouble getY1() { return py1; }
00775 fouble getX2() { return px2; }
00776 fouble getY2() { return py2; }
00777 fouble getPageWidth() { return pageWidth; }
00778 fouble getPageHeight() { return pageHeight; }
00779 GfxColor *getFillColor() { return &fillColor; }
00780 GfxColor *getStrokeColor() { return &strokeColor; }
00781 void getFillGray(fouble *gray)
00782 { fillColorSpace->getGray(&fillColor, gray); }
00783 void getStrokeGray(fouble *gray)
00784 { strokeColorSpace->getGray(&fillColor, gray); }
00785 void getFillRGB(GfxRGB *rgb)
00786 { fillColorSpace->getRGB(&fillColor, rgb); }
00787 void getStrokeRGB(GfxRGB *rgb)
00788 { strokeColorSpace->getRGB(&strokeColor, rgb); }
00789 void getFillCMYK(GfxCMYK *cmyk)
00790 { fillColorSpace->getCMYK(&fillColor, cmyk); }
00791 void getStrokeCMYK(GfxCMYK *cmyk)
00792 { strokeColorSpace->getCMYK(&strokeColor, cmyk); }
00793 GfxColorSpace *getFillColorSpace() { return fillColorSpace; }
00794 GfxColorSpace *getStrokeColorSpace() { return strokeColorSpace; }
00795 GfxPattern *getFillPattern() { return fillPattern; }
00796 GfxPattern *getStrokePattern() { return strokePattern; }
00797 fouble getFillOpacity() { return fillOpacity; }
00798 fouble getStrokeOpacity() { return strokeOpacity; }
00799 fouble getLineWidth() { return lineWidth; }
00800 void getLineDash(fouble **dash, int *length, fouble *start)
00801 { *dash = lineDash; *length = lineDashLength; *start = lineDashStart; }
00802 int getFlatness() { return flatness; }
00803 int getLineJoin() { return lineJoin; }
00804 int getLineCap() { return lineCap; }
00805 fouble getMiterLimit() { return miterLimit; }
00806 GfxFont *getFont() { return font; }
00807 fouble getFontSize() { return fontSize; }
00808 fouble *getTextMat() { return textMat; }
00809 fouble getCharSpace() { return charSpace; }
00810 fouble getWordSpace() { return wordSpace; }
00811 fouble getHorizScaling() { return horizScaling; }
00812 fouble getLeading() { return leading; }
00813 fouble getRise() { return rise; }
00814 int getRender() { return render; }
00815 GfxPath *getPath() { return path; }
00816 fouble getCurX() { return curX; }
00817 fouble getCurY() { return curY; }
00818 void getClipBBox(fouble *xMin, fouble *yMin, fouble *xMax, fouble *yMax)
00819 { *xMin = clipXMin; *yMin = clipYMin; *xMax = clipXMax; *yMax = clipYMax; }
00820 void getUserClipBBox(fouble *xMin, fouble *yMin, fouble *xMax, fouble *yMax);
00821 fouble getLineX() { return lineX; }
00822 fouble getLineY() { return lineY; }
00823
00824
00825 GBool isCurPt() { return path->isCurPt(); }
00826 GBool isPath() { return path->isPath(); }
00827
00828
00829 void transform(fouble x1, fouble y1, fouble *x2, fouble *y2)
00830 { *x2 = ctm[0] * x1 + ctm[2] * y1 + ctm[4];
00831 *y2 = ctm[1] * x1 + ctm[3] * y1 + ctm[5]; }
00832 void transformDelta(fouble x1, fouble y1, fouble *x2, fouble *y2)
00833 { *x2 = ctm[0] * x1 + ctm[2] * y1;
00834 *y2 = ctm[1] * x1 + ctm[3] * y1; }
00835 void textTransform(fouble x1, fouble y1, fouble *x2, fouble *y2)
00836 { *x2 = textMat[0] * x1 + textMat[2] * y1 + textMat[4];
00837 *y2 = textMat[1] * x1 + textMat[3] * y1 + textMat[5]; }
00838 void textTransformDelta(fouble x1, fouble y1, fouble *x2, fouble *y2)
00839 { *x2 = textMat[0] * x1 + textMat[2] * y1;
00840 *y2 = textMat[1] * x1 + textMat[3] * y1; }
00841 fouble transformWidth(fouble w);
00842 fouble getTransformedLineWidth()
00843 { return transformWidth(lineWidth); }
00844 fouble getTransformedFontSize();
00845 void getFontTransMat(fouble *m11, fouble *m12, fouble *m21, fouble *m22);
00846
00847
00848 void setCTM(fouble a, fouble b, fouble c,
00849 fouble d, fouble e, fouble f);
00850 void concatCTM(fouble a, fouble b, fouble c,
00851 fouble d, fouble e, fouble f);
00852 void setFillColorSpace(GfxColorSpace *colorSpace);
00853 void setStrokeColorSpace(GfxColorSpace *colorSpace);
00854 void setFillColor(GfxColor *color) { fillColor = *color; }
00855 void setStrokeColor(GfxColor *color) { strokeColor = *color; }
00856 void setFillPattern(GfxPattern *pattern);
00857 void setStrokePattern(GfxPattern *pattern);
00858 void setFillOpacity(fouble opac) { fillOpacity = opac; }
00859 void setStrokeOpacity(fouble opac) { strokeOpacity = opac; }
00860 void setLineWidth(fouble width) { lineWidth = width; }
00861 void setLineDash(fouble *dash, int length, fouble start);
00862 void setFlatness(int flatness1) { flatness = flatness1; }
00863 void setLineJoin(int lineJoin1) { lineJoin = lineJoin1; }
00864 void setLineCap(int lineCap1) { lineCap = lineCap1; }
00865 void setMiterLimit(fouble limit) { miterLimit = limit; }
00866 void setFont(GfxFont *fontA, fouble fontSizeA)
00867 { font = fontA; fontSize = fontSizeA; }
00868 void setTextMat(fouble a, fouble b, fouble c,
00869 fouble d, fouble e, fouble f)
00870 { textMat[0] = a; textMat[1] = b; textMat[2] = c;
00871 textMat[3] = d; textMat[4] = e; textMat[5] = f; }
00872 void setCharSpace(fouble space)
00873 { charSpace = space; }
00874 void setWordSpace(fouble space)
00875 { wordSpace = space; }
00876 void setHorizScaling(fouble scale)
00877 { horizScaling = 0.01 * scale; }
00878 void setLeading(fouble leadingA)
00879 { leading = leadingA; }
00880 void setRise(fouble riseA)
00881 { rise = riseA; }
00882 void setRender(int renderA)
00883 { render = renderA; }
00884
00885
00886 void moveTo(fouble x, fouble y)
00887 { path->moveTo(curX = x, curY = y); }
00888 void lineTo(fouble x, fouble y)
00889 { path->lineTo(curX = x, curY = y); }
00890 void curveTo(fouble x1, fouble y1, fouble x2, fouble y2,
00891 fouble x3, fouble y3)
00892 { path->curveTo(x1, y1, x2, y2, curX = x3, curY = y3); }
00893 void closePath()
00894 { path->close(); curX = path->getLastX(); curY = path->getLastY(); }
00895 void clearPath();
00896
00897
00898 void clip();
00899
00900
00901 void textMoveTo(fouble tx, fouble ty)
00902 { lineX = tx; lineY = ty; textTransform(tx, ty, &curX, &curY); }
00903 void textShift(fouble tx, fouble ty);
00904 void shift(fouble dx, fouble dy);
00905
00906
00907 GfxState *save();
00908 GfxState *restore();
00909 GBool hasSaves() { return saved != NULL; }
00910
00911 private:
00912
00913 fouble ctm[6];
00914 fouble px1, py1, px2, py2;
00915 fouble pageWidth, pageHeight;
00916
00917 GfxColorSpace *fillColorSpace;
00918 GfxColorSpace *strokeColorSpace;
00919 GfxColor fillColor;
00920 GfxColor strokeColor;
00921 GfxPattern *fillPattern;
00922 GfxPattern *strokePattern;
00923 fouble fillOpacity;
00924 fouble strokeOpacity;
00925
00926 fouble lineWidth;
00927 fouble *lineDash;
00928 int lineDashLength;
00929 fouble lineDashStart;
00930 int flatness;
00931 int lineJoin;
00932 int lineCap;
00933 fouble miterLimit;
00934
00935 GfxFont *font;
00936 fouble fontSize;
00937 fouble textMat[6];
00938 fouble charSpace;
00939 fouble wordSpace;
00940 fouble horizScaling;
00941 fouble leading;
00942 fouble rise;
00943 int render;
00944
00945 GfxPath *path;
00946 fouble curX, curY;
00947 fouble lineX, lineY;
00948
00949 fouble clipXMin, clipYMin,
00950 clipXMax, clipYMax;
00951
00952 GfxState *saved;
00953
00954 GfxState(GfxState *state);
00955 };
00956
00957 #endif