|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef SPLASH_H |
|
#define SPLASH_H |
|
|
|
#include <cstddef> |
|
#include "SplashTypes.h" |
|
#include "SplashClip.h" |
|
#include "SplashPattern.h" |
|
#include "poppler_private_export.h" |
|
|
|
class SplashBitmap; |
|
struct SplashGlyphBitmap; |
|
class SplashState; |
|
class SplashScreen; |
|
class SplashPath; |
|
class SplashXPath; |
|
class SplashFont; |
|
struct SplashPipe; |
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef bool (*SplashImageMaskSource)(void *data, SplashColorPtr pixel); |
|
|
|
|
|
|
|
|
|
typedef bool (*SplashImageSource)(void *data, SplashColorPtr colorLine, unsigned char *alphaLine); |
|
|
|
|
|
typedef void (*SplashICCTransform)(void *data, SplashBitmap *bitmap); |
|
|
|
|
|
|
|
enum SplashPipeResultColorCtrl |
|
{ |
|
splashPipeResultColorNoAlphaBlendCMYK, |
|
splashPipeResultColorNoAlphaBlendDeviceN, |
|
splashPipeResultColorNoAlphaBlendRGB, |
|
splashPipeResultColorNoAlphaBlendMono, |
|
splashPipeResultColorAlphaNoBlendMono, |
|
splashPipeResultColorAlphaNoBlendRGB, |
|
splashPipeResultColorAlphaNoBlendCMYK, |
|
splashPipeResultColorAlphaNoBlendDeviceN, |
|
splashPipeResultColorAlphaBlendMono, |
|
splashPipeResultColorAlphaBlendRGB, |
|
splashPipeResultColorAlphaBlendCMYK, |
|
splashPipeResultColorAlphaBlendDeviceN |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class POPPLER_PRIVATE_EXPORT Splash |
|
{ |
|
public: |
|
|
|
Splash(SplashBitmap *bitmapA, bool vectorAntialiasA, SplashScreenParams *screenParams = nullptr); |
|
Splash(SplashBitmap *bitmapA, bool vectorAntialiasA, SplashScreen *screenA); |
|
|
|
~Splash(); |
|
|
|
Splash(const Splash &) = delete; |
|
Splash &operator=(const Splash &) = delete; |
|
|
|
|
|
|
|
SplashCoord *getMatrix(); |
|
SplashPattern *getStrokePattern(); |
|
SplashPattern *getFillPattern(); |
|
SplashScreen *getScreen(); |
|
SplashBlendFunc getBlendFunc(); |
|
SplashCoord getStrokeAlpha(); |
|
SplashCoord getFillAlpha(); |
|
SplashCoord getLineWidth(); |
|
int getLineCap(); |
|
int getLineJoin(); |
|
SplashCoord getMiterLimit(); |
|
SplashCoord getFlatness(); |
|
SplashCoord getLineDashPhase(); |
|
bool getStrokeAdjust(); |
|
SplashClip *getClip(); |
|
SplashBitmap *getSoftMask(); |
|
bool getInNonIsolatedGroup(); |
|
|
|
|
|
|
|
void setMatrix(SplashCoord *matrix); |
|
void setStrokePattern(SplashPattern *strokePattern); |
|
void setFillPattern(SplashPattern *fillPattern); |
|
void setScreen(SplashScreen *screen); |
|
void setBlendFunc(SplashBlendFunc func); |
|
void setStrokeAlpha(SplashCoord alpha); |
|
void setFillAlpha(SplashCoord alpha); |
|
void setPatternAlpha(SplashCoord strokeAlpha, SplashCoord fillAlpha); |
|
void clearPatternAlpha(); |
|
void setFillOverprint(bool fop); |
|
void setStrokeOverprint(bool sop); |
|
void setOverprintMode(int opm); |
|
void setLineWidth(SplashCoord lineWidth); |
|
void setLineCap(int lineCap); |
|
void setLineJoin(int lineJoin); |
|
void setMiterLimit(SplashCoord miterLimit); |
|
void setFlatness(SplashCoord flatness); |
|
|
|
void setLineDash(std::vector<SplashCoord> &&lineDash, SplashCoord lineDashPhase); |
|
void setStrokeAdjust(bool strokeAdjust); |
|
|
|
void clipResetToRect(SplashCoord x0, SplashCoord y0, SplashCoord x1, SplashCoord y1); |
|
|
|
SplashError clipToRect(SplashCoord x0, SplashCoord y0, SplashCoord x1, SplashCoord y1); |
|
|
|
SplashError clipToPath(SplashPath *path, bool eo); |
|
void setSoftMask(SplashBitmap *softMask); |
|
void setInNonIsolatedGroup(SplashBitmap *alpha0BitmapA, int alpha0XA, int alpha0YA); |
|
void setTransfer(unsigned char *red, unsigned char *green, unsigned char *blue, unsigned char *gray); |
|
void setOverprintMask(unsigned int overprintMask, bool additive); |
|
|
|
|
|
|
|
void saveState(); |
|
SplashError restoreState(); |
|
|
|
|
|
|
|
|
|
void clear(SplashColorPtr color, unsigned char alpha = 0x00); |
|
|
|
|
|
SplashError stroke(SplashPath *path); |
|
|
|
|
|
SplashError fill(SplashPath *path, bool eo); |
|
|
|
|
|
SplashError xorFill(SplashPath *path, bool eo); |
|
|
|
|
|
SplashError fillChar(SplashCoord x, SplashCoord y, int c, SplashFont *font); |
|
|
|
|
|
|
|
void fillGlyph(SplashCoord x, SplashCoord y, SplashGlyphBitmap *glyph); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SplashError fillImageMask(SplashImageMaskSource src, void *srcData, int w, int h, SplashCoord *mat, bool glyphMode); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SplashError drawImage(SplashImageSource src, SplashICCTransform tf, void *srcData, SplashColorMode srcMode, bool srcAlpha, int w, int h, SplashCoord *mat, bool interpolate, bool tilingPattern = false); |
|
|
|
|
|
|
|
SplashError composite(SplashBitmap *src, int xSrc, int ySrc, int xDest, int yDest, int w, int h, bool noClip, bool nonIsolated, bool knockout = false, SplashCoord knockoutOpacity = 1.0); |
|
|
|
|
|
|
|
void compositeBackground(SplashColorConstPtr color); |
|
|
|
|
|
|
|
|
|
SplashError blitTransparent(SplashBitmap *src, int xSrc, int ySrc, int xDest, int yDest, int w, int h); |
|
void blitImage(SplashBitmap *src, bool srcAlpha, int xDest, int yDest); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SplashPath *makeStrokePath(SplashPath *path, SplashCoord w, bool flatten = true); |
|
|
|
|
|
SplashBitmap *getBitmap() { return bitmap; } |
|
|
|
|
|
void setMinLineWidth(SplashCoord w) { minLineWidth = w; } |
|
|
|
|
|
void setThinLineMode(SplashThinLineMode thinLineModeA) { thinLineMode = thinLineModeA; } |
|
SplashThinLineMode getThinLineMode() { return thinLineMode; } |
|
|
|
|
|
|
|
SplashClipResult getClipRes() { return opClipRes; } |
|
|
|
|
|
void setDebugMode(bool debugModeA) { debugMode = debugModeA; } |
|
|
|
#if 1 |
|
void setInShading(bool sh) { inShading = sh; } |
|
bool getVectorAntialias() { return vectorAntialias; } |
|
void setVectorAntialias(bool vaa) { vectorAntialias = vaa; } |
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
SplashError shadedFill(SplashPath *path, bool hasBBox, SplashPattern *pattern, bool clipToStrokePath); |
|
|
|
bool gouraudTriangleShadedFill(SplashGouraudColor *shading); |
|
|
|
private: |
|
void pipeInit(SplashPipe *pipe, int x, int y, SplashPattern *pattern, SplashColorPtr cSrc, unsigned char aInput, bool usesShape, bool nonIsolatedGroup, bool knockout = false, unsigned char knockoutOpacity = 255); |
|
void pipeRun(SplashPipe *pipe); |
|
void pipeRunSimpleMono1(SplashPipe *pipe); |
|
void pipeRunSimpleMono8(SplashPipe *pipe); |
|
void pipeRunSimpleRGB8(SplashPipe *pipe); |
|
void pipeRunSimpleXBGR8(SplashPipe *pipe); |
|
void pipeRunSimpleBGR8(SplashPipe *pipe); |
|
void pipeRunSimpleCMYK8(SplashPipe *pipe); |
|
void pipeRunSimpleDeviceN8(SplashPipe *pipe); |
|
void pipeRunAAMono1(SplashPipe *pipe); |
|
void pipeRunAAMono8(SplashPipe *pipe); |
|
void pipeRunAARGB8(SplashPipe *pipe); |
|
void pipeRunAAXBGR8(SplashPipe *pipe); |
|
void pipeRunAABGR8(SplashPipe *pipe); |
|
void pipeRunAACMYK8(SplashPipe *pipe); |
|
void pipeRunAADeviceN8(SplashPipe *pipe); |
|
void pipeSetXY(SplashPipe *pipe, int x, int y); |
|
void pipeIncX(SplashPipe *pipe); |
|
void drawPixel(SplashPipe *pipe, int x, int y, bool noClip); |
|
void drawAAPixelInit(); |
|
void drawAAPixel(SplashPipe *pipe, int x, int y); |
|
void drawSpan(SplashPipe *pipe, int x0, int x1, int y, bool noClip); |
|
void drawAALine(SplashPipe *pipe, int x0, int x1, int y, bool adjustLine = false, unsigned char lineOpacity = 0); |
|
void transform(const SplashCoord *matrix, SplashCoord xi, SplashCoord yi, SplashCoord *xo, SplashCoord *yo); |
|
void strokeNarrow(SplashPath *path); |
|
void strokeWide(SplashPath *path, SplashCoord w); |
|
SplashPath *flattenPath(SplashPath *path, SplashCoord *matrix, SplashCoord flatness); |
|
void flattenCurve(SplashCoord x0, SplashCoord y0, SplashCoord x1, SplashCoord y1, SplashCoord x2, SplashCoord y2, SplashCoord x3, SplashCoord y3, SplashCoord *matrix, SplashCoord flatness2, SplashPath *fPath); |
|
SplashPath *makeDashedPath(SplashPath *xPath); |
|
void getBBoxFP(SplashPath *path, SplashCoord *xMinA, SplashCoord *yMinA, SplashCoord *xMaxA, SplashCoord *yMaxA); |
|
SplashError fillWithPattern(SplashPath *path, bool eo, SplashPattern *pattern, SplashCoord alpha); |
|
bool pathAllOutside(SplashPath *path); |
|
void fillGlyph2(int x0, int y0, SplashGlyphBitmap *glyph, bool noclip); |
|
void arbitraryTransformMask(SplashImageMaskSource src, void *srcData, int srcWidth, int srcHeight, SplashCoord *mat, bool glyphMode); |
|
SplashBitmap *scaleMask(SplashImageMaskSource src, void *srcData, int srcWidth, int srcHeight, int scaledWidth, int scaledHeight); |
|
void scaleMaskYdownXdown(SplashImageMaskSource src, void *srcData, int srcWidth, int srcHeight, int scaledWidth, int scaledHeight, SplashBitmap *dest); |
|
void scaleMaskYdownXup(SplashImageMaskSource src, void *srcData, int srcWidth, int srcHeight, int scaledWidth, int scaledHeight, SplashBitmap *dest); |
|
void scaleMaskYupXdown(SplashImageMaskSource src, void *srcData, int srcWidth, int srcHeight, int scaledWidth, int scaledHeight, SplashBitmap *dest); |
|
void scaleMaskYupXup(SplashImageMaskSource src, void *srcData, int srcWidth, int srcHeight, int scaledWidth, int scaledHeight, SplashBitmap *dest); |
|
void blitMask(SplashBitmap *src, int xDest, int yDest, SplashClipResult clipRes); |
|
SplashError arbitraryTransformImage(SplashImageSource src, SplashICCTransform tf, void *srcData, SplashColorMode srcMode, int nComps, bool srcAlpha, int srcWidth, int srcHeight, SplashCoord *mat, bool interpolate, |
|
bool tilingPattern = false); |
|
SplashBitmap *scaleImage(SplashImageSource src, void *srcData, SplashColorMode srcMode, int nComps, bool srcAlpha, int srcWidth, int srcHeight, int scaledWidth, int scaledHeight, bool interpolate, bool tilingPattern = false); |
|
bool scaleImageYdownXdown(SplashImageSource src, void *srcData, SplashColorMode srcMode, int nComps, bool srcAlpha, int srcWidth, int srcHeight, int scaledWidth, int scaledHeight, SplashBitmap *dest); |
|
bool scaleImageYdownXup(SplashImageSource src, void *srcData, SplashColorMode srcMode, int nComps, bool srcAlpha, int srcWidth, int srcHeight, int scaledWidth, int scaledHeight, SplashBitmap *dest); |
|
bool scaleImageYupXdown(SplashImageSource src, void *srcData, SplashColorMode srcMode, int nComps, bool srcAlpha, int srcWidth, int srcHeight, int scaledWidth, int scaledHeight, SplashBitmap *dest); |
|
bool scaleImageYupXup(SplashImageSource src, void *srcData, SplashColorMode srcMode, int nComps, bool srcAlpha, int srcWidth, int srcHeight, int scaledWidth, int scaledHeight, SplashBitmap *dest); |
|
bool scaleImageYupXupBilinear(SplashImageSource src, void *srcData, SplashColorMode srcMode, int nComps, bool srcAlpha, int srcWidth, int srcHeight, int scaledWidth, int scaledHeight, SplashBitmap *dest); |
|
void vertFlipImage(SplashBitmap *img, int width, int height, int nComps); |
|
void blitImage(SplashBitmap *src, bool srcAlpha, int xDest, int yDest, SplashClipResult clipRes); |
|
void blitImageClipped(SplashBitmap *src, bool srcAlpha, int xSrc, int ySrc, int xDest, int yDest, int w, int h); |
|
void dumpPath(SplashPath *path); |
|
void dumpXPath(SplashXPath *path); |
|
|
|
static SplashPipeResultColorCtrl pipeResultColorNoAlphaBlend[]; |
|
static SplashPipeResultColorCtrl pipeResultColorAlphaNoBlend[]; |
|
static SplashPipeResultColorCtrl pipeResultColorAlphaBlend[]; |
|
static int pipeNonIsoGroupCorrection[]; |
|
|
|
SplashBitmap *bitmap; |
|
SplashState *state; |
|
SplashBitmap *aaBuf; |
|
int aaBufY; |
|
SplashBitmap *alpha0Bitmap; |
|
|
|
int alpha0X, alpha0Y; |
|
SplashCoord aaGamma[splashAASize * splashAASize + 1]; |
|
SplashCoord minLineWidth; |
|
SplashThinLineMode thinLineMode; |
|
SplashClipResult opClipRes; |
|
bool vectorAntialias; |
|
bool inShading; |
|
bool debugMode; |
|
}; |
|
|
|
#endif |
|
|