📄 gfxstate.h
字号:
virtual void getGray(GfxColor *color, GfxGray *gray); virtual void getRGB(GfxColor *color, GfxRGB *rgb); virtual void getCMYK(GfxColor *color, GfxCMYK *cmyk); virtual int getNComps() { return 1; } virtual void getDefaultColor(GfxColor *color); virtual void getDefaultRanges(double *decodeLow, double *decodeRange, int maxImgPixel); // Indexed-specific access. GfxColorSpace *getBase() { return base; } int getIndexHigh() { return indexHigh; } Guchar *getLookup() { return lookup; } GfxColor *mapColorToBase(GfxColor *color, GfxColor *baseColor);private: GfxColorSpace *base; // base color space int indexHigh; // max pixel value Guchar *lookup; // lookup table};//------------------------------------------------------------------------// GfxSeparationColorSpace//------------------------------------------------------------------------class GfxSeparationColorSpace: public GfxColorSpace {public: GfxSeparationColorSpace(GString *nameA, GfxColorSpace *altA, Function *funcA); virtual ~GfxSeparationColorSpace(); virtual GfxColorSpace *copy(); virtual GfxColorSpaceMode getMode() { return csSeparation; } // Construct a Separation color space. Returns NULL if unsuccessful. static GfxColorSpace *parse(Array *arr); virtual void getGray(GfxColor *color, GfxGray *gray); virtual void getRGB(GfxColor *color, GfxRGB *rgb); virtual void getCMYK(GfxColor *color, GfxCMYK *cmyk); virtual int getNComps() { return 1; } virtual void getDefaultColor(GfxColor *color); virtual GBool isNonMarking() { return nonMarking; } // Separation-specific access. GString *getName() { return name; } GfxColorSpace *getAlt() { return alt; } Function *getFunc() { return func; }private: GString *name; // colorant name GfxColorSpace *alt; // alternate color space Function *func; // tint transform (into alternate color space) GBool nonMarking;};//------------------------------------------------------------------------// GfxDeviceNColorSpace//------------------------------------------------------------------------class GfxDeviceNColorSpace: public GfxColorSpace {public: GfxDeviceNColorSpace(int nCompsA, GfxColorSpace *alt, Function *func); virtual ~GfxDeviceNColorSpace(); virtual GfxColorSpace *copy(); virtual GfxColorSpaceMode getMode() { return csDeviceN; } // Construct a DeviceN color space. Returns NULL if unsuccessful. static GfxColorSpace *parse(Array *arr); virtual void getGray(GfxColor *color, GfxGray *gray); virtual void getRGB(GfxColor *color, GfxRGB *rgb); virtual void getCMYK(GfxColor *color, GfxCMYK *cmyk); virtual int getNComps() { return nComps; } virtual void getDefaultColor(GfxColor *color); virtual GBool isNonMarking() { return nonMarking; } // DeviceN-specific access. GString *getColorantName(int i) { return names[i]; } GfxColorSpace *getAlt() { return alt; } Function *getTintTransformFunc() { return func; }private: int nComps; // number of components GString // colorant names *names[gfxColorMaxComps]; GfxColorSpace *alt; // alternate color space Function *func; // tint transform (into alternate color space) GBool nonMarking;};//------------------------------------------------------------------------// GfxPatternColorSpace//------------------------------------------------------------------------class GfxPatternColorSpace: public GfxColorSpace {public: GfxPatternColorSpace(GfxColorSpace *underA); virtual ~GfxPatternColorSpace(); virtual GfxColorSpace *copy(); virtual GfxColorSpaceMode getMode() { return csPattern; } // Construct a Pattern color space. Returns NULL if unsuccessful. static GfxColorSpace *parse(Array *arr); virtual void getGray(GfxColor *color, GfxGray *gray); virtual void getRGB(GfxColor *color, GfxRGB *rgb); virtual void getCMYK(GfxColor *color, GfxCMYK *cmyk); virtual int getNComps() { return 0; } virtual void getDefaultColor(GfxColor *color); // Pattern-specific access. GfxColorSpace *getUnder() { return under; }private: GfxColorSpace *under; // underlying color space (for uncolored // patterns)};//------------------------------------------------------------------------// GfxPattern//------------------------------------------------------------------------class GfxPattern {public: GfxPattern(int typeA); virtual ~GfxPattern(); static GfxPattern *parse(Object *obj); virtual GfxPattern *copy() = 0; int getType() { return type; }private: int type;};//------------------------------------------------------------------------// GfxTilingPattern//------------------------------------------------------------------------class GfxTilingPattern: public GfxPattern {public: static GfxTilingPattern *parse(Object *patObj); virtual ~GfxTilingPattern(); virtual GfxPattern *copy(); int getPaintType() { return paintType; } int getTilingType() { return tilingType; } double *getBBox() { return bbox; } double getXStep() { return xStep; } double getYStep() { return yStep; } Dict *getResDict() { return resDict.isDict() ? resDict.getDict() : (Dict *)NULL; } double *getMatrix() { return matrix; } Object *getContentStream() { return &contentStream; }private: GfxTilingPattern(int paintTypeA, int tilingTypeA, double *bboxA, double xStepA, double yStepA, Object *resDictA, double *matrixA, Object *contentStreamA); int paintType; int tilingType; double bbox[4]; double xStep, yStep; Object resDict; double matrix[6]; Object contentStream;};//------------------------------------------------------------------------// GfxShadingPattern//------------------------------------------------------------------------class GfxShadingPattern: public GfxPattern {public: static GfxShadingPattern *parse(Object *patObj); virtual ~GfxShadingPattern(); virtual GfxPattern *copy(); GfxShading *getShading() { return shading; } double *getMatrix() { return matrix; }private: GfxShadingPattern(GfxShading *shadingA, double *matrixA); GfxShading *shading; double matrix[6];};//------------------------------------------------------------------------// GfxShading//------------------------------------------------------------------------class GfxShading {public: GfxShading(int typeA); GfxShading(GfxShading *shading); virtual ~GfxShading(); static GfxShading *parse(Object *obj); virtual GfxShading *copy() = 0; int getType() { return type; } GfxColorSpace *getColorSpace() { return colorSpace; } GfxColor *getBackground() { return &background; } GBool getHasBackground() { return hasBackground; } void getBBox(double *xMinA, double *yMinA, double *xMaxA, double *yMaxA) { *xMinA = xMin; *yMinA = yMin; *xMaxA = xMax; *yMaxA = yMax; } GBool getHasBBox() { return hasBBox; }protected: GBool init(Dict *dict); int type; GfxColorSpace *colorSpace; GfxColor background; GBool hasBackground; double xMin, yMin, xMax, yMax; GBool hasBBox;};//------------------------------------------------------------------------// GfxFunctionShading//------------------------------------------------------------------------class GfxFunctionShading: public GfxShading {public: GfxFunctionShading(double x0A, double y0A, double x1A, double y1A, double *matrixA, Function **funcsA, int nFuncsA); GfxFunctionShading(GfxFunctionShading *shading); virtual ~GfxFunctionShading(); static GfxFunctionShading *parse(Dict *dict); virtual GfxShading *copy(); void getDomain(double *x0A, double *y0A, double *x1A, double *y1A) { *x0A = x0; *y0A = y0; *x1A = x1; *y1A = y1; } double *getMatrix() { return matrix; } int getNFuncs() { return nFuncs; } Function *getFunc(int i) { return funcs[i]; } void getColor(double x, double y, GfxColor *color);private: double x0, y0, x1, y1; double matrix[6]; Function *funcs[gfxColorMaxComps]; int nFuncs;};//------------------------------------------------------------------------// GfxAxialShading//------------------------------------------------------------------------class GfxAxialShading: public GfxShading {public: GfxAxialShading(double x0A, double y0A, double x1A, double y1A, double t0A, double t1A, Function **funcsA, int nFuncsA, GBool extend0A, GBool extend1A); GfxAxialShading(GfxAxialShading *shading); virtual ~GfxAxialShading(); static GfxAxialShading *parse(Dict *dict); virtual GfxShading *copy(); void getCoords(double *x0A, double *y0A, double *x1A, double *y1A) { *x0A = x0; *y0A = y0; *x1A = x1; *y1A = y1; } double getDomain0() { return t0; } double getDomain1() { return t1; } GBool getExtend0() { return extend0; } GBool getExtend1() { return extend1; } int getNFuncs() { return nFuncs; } Function *getFunc(int i) { return funcs[i]; } void getColor(double t, GfxColor *color);private: double x0, y0, x1, y1; double t0, t1; Function *funcs[gfxColorMaxComps]; int nFuncs; GBool extend0, extend1;};//------------------------------------------------------------------------// GfxRadialShading//------------------------------------------------------------------------class GfxRadialShading: public GfxShading {public: GfxRadialShading(double x0A, double y0A, double r0A, double x1A, double y1A, double r1A, double t0A, double t1A, Function **funcsA, int nFuncsA, GBool extend0A, GBool extend1A); GfxRadialShading(GfxRadialShading *shading); virtual ~GfxRadialShading(); static GfxRadialShading *parse(Dict *dict); virtual GfxShading *copy(); void getCoords(double *x0A, double *y0A, double *r0A, double *x1A, double *y1A, double *r1A) { *x0A = x0; *y0A = y0; *r0A = r0; *x1A = x1; *y1A = y1; *r1A = r1; } double getDomain0() { return t0; } double getDomain1() { return t1; } GBool getExtend0() { return extend0; } GBool getExtend1() { return extend1; } int getNFuncs() { return nFuncs; } Function *getFunc(int i) { return funcs[i]; } void getColor(double t, GfxColor *color);private: double x0, y0, r0, x1, y1, r1; double t0, t1; Function *funcs[gfxColorMaxComps]; int nFuncs; GBool extend0, extend1;};//------------------------------------------------------------------------// GfxGouraudTriangleShading//------------------------------------------------------------------------struct GfxGouraudVertex { double x, y; GfxColor color;};class GfxGouraudTriangleShading: public GfxShading {public: GfxGouraudTriangleShading(int typeA, GfxGouraudVertex *verticesA, int nVerticesA, int (*trianglesA)[3], int nTrianglesA, Function **funcsA, int nFuncsA); GfxGouraudTriangleShading(GfxGouraudTriangleShading *shading); virtual ~GfxGouraudTriangleShading(); static GfxGouraudTriangleShading *parse(int typeA, Dict *dict, Stream *str); virtual GfxShading *copy(); int getNTriangles() { return nTriangles; } void getTriangle(int i, double *x0, double *y0, GfxColor *color0, double *x1, double *y1, GfxColor *color1, double *x2, double *y2, GfxColor *color2);private: GfxGouraudVertex *vertices; int nVertices; int (*triangles)[3]; int nTriangles; Function *funcs[gfxColorMaxComps]; int nFuncs;};//------------------------------------------------------------------------// GfxPatchMeshShading//------------------------------------------------------------------------struct GfxPatch { double x[4][4]; double y[4][4]; GfxColor color[2][2];};class GfxPatchMeshShading: public GfxShading {public: GfxPatchMeshShading(int typeA, GfxPatch *patchesA, int nPatchesA, Function **funcsA, int nFuncsA); GfxPatchMeshShading(GfxPatchMeshShading *shading); virtual ~GfxPatchMeshShading(); static GfxPatchMeshShading *parse(int typeA, Dict *dict, Stream *str);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -