[poppler] poppler/splash: Splash.cc, 1.3, 1.4 Splash.h, 1.2,
1.3 SplashBitmap.cc, 1.1.1.1, 1.2 SplashBitmap.h, 1.1.1.1,
1.2 SplashPattern.cc, 1.1.1.1, 1.2 SplashPattern.h, 1.1.1.1,
1.2 SplashState.cc, 1.2, 1.3 SplashState.h, 1.1.1.1,
1.2 SplashTypes.h, 1.2, 1.3
Albert Astals Cid
aacid at freedesktop.org
Sun Oct 30 12:29:07 PST 2005
Update of /cvs/poppler/poppler/splash
In directory gabe:/tmp/cvs-serv31488/splash
Modified Files:
Splash.cc Splash.h SplashBitmap.cc SplashBitmap.h
SplashPattern.cc SplashPattern.h SplashState.cc SplashState.h
SplashTypes.h
Log Message:
Last xpdf 3.01 merge (at least from my side)
It's very big, but noone has opposed in the 2 weeks time i gave on the ml so either poppler is dead or people agree with the patch
Index: Splash.cc
===================================================================
RCS file: /cvs/poppler/poppler/splash/Splash.cc,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- Splash.cc 16 Sep 2005 18:32:30 -0000 1.3
+++ Splash.cc 30 Oct 2005 20:29:05 -0000 1.4
@@ -22,18 +22,29 @@
#include "SplashXPathScanner.h"
#include "SplashPattern.h"
#include "SplashScreen.h"
-#include "SplashClip.h"
#include "SplashFont.h"
#include "SplashGlyphBitmap.h"
#include "Splash.h"
//------------------------------------------------------------------------
+
+static void blendNormal(SplashColorPtr src, SplashColorPtr dest,
[...3187 lines suppressed...]
(path->flags[i] & splashPathArcCW) ? " arcCW" : "");
}
}
+
+void Splash::dumpXPath(SplashXPath *path) {
+ int i;
+
+ for (i = 0; i < path->length; ++i) {
+ printf(" %4d: x0=%8.2f y0=%8.2f x1=%8.2f y1=%8.2f %s%s%s%s%s%s%s\n",
+ i, (double)path->segs[i].x0, (double)path->segs[i].y0,
+ (double)path->segs[i].x1, (double)path->segs[i].y1,
+ (path->segs[i].flags & splashXPathFirst) ? "F" : " ",
+ (path->segs[i].flags & splashXPathLast) ? "L" : " ",
+ (path->segs[i].flags & splashXPathEnd0) ? "0" : " ",
+ (path->segs[i].flags & splashXPathEnd1) ? "1" : " ",
+ (path->segs[i].flags & splashXPathHoriz) ? "H" : " ",
+ (path->segs[i].flags & splashXPathVert) ? "V" : " ",
+ (path->segs[i].flags & splashXPathFlip) ? "P" : " ");
+ }
+}
Index: Splash.h
===================================================================
RCS file: /cvs/poppler/poppler/splash/Splash.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Splash.h 16 Sep 2005 18:32:30 -0000 1.2
+++ Splash.h 30 Oct 2005 20:29:05 -0000 1.3
@@ -12,29 +12,28 @@
#endif
#include "SplashTypes.h"
+#include "SplashClip.h"
class SplashBitmap;
-class SplashGlyphBitmap;
+struct SplashGlyphBitmap;
class SplashState;
class SplashPattern;
class SplashScreen;
class SplashPath;
class SplashXPath;
-class SplashClip;
class SplashFont;
//------------------------------------------------------------------------
-// Retrieves the next pixel in an image mask. Normally, fills in
-// *<pixel> and returns true. If the image stream is exhausted,
-// returns false.
-typedef GBool (*SplashImageMaskSource)(void *data, SplashMono1 *pixel);
+// Retrieves the next line of pixels in an image mask. Normally,
+// fills in *<line> and returns true. If the image stream is
+// exhausted, returns false.
+typedef GBool (*SplashImageMaskSource)(void *data, SplashColorPtr pixel);
-// Retrieves the next pixel in an image. Normally, fills in *<pixel>
-// (pixel color) and *<alpha> (1 for opaque, 0 for transparent), and
-// returns true. If the image stream is exhausted, returns false.
-typedef GBool (*SplashImageSource)(void *data, SplashColor *pixel,
- Guchar *alpha);
+// Retrieves the next line of pixels in an image. Normally, fills in
+// *<line> and returns true. If the image stream is exhausted,
+// returns false.
+typedef GBool (*SplashImageSource)(void *data, SplashColorPtr line);
//------------------------------------------------------------------------
// Splash
@@ -53,6 +52,9 @@
SplashPattern *getStrokePattern();
SplashPattern *getFillPattern();
SplashScreen *getScreen();
+ SplashBlendFunc getBlendFunc();
+ SplashCoord getStrokeAlpha();
+ SplashCoord getFillAlpha();
SplashCoord getLineWidth();
int getLineCap();
int getLineJoin();
@@ -68,6 +70,9 @@
void setStrokePattern(SplashPattern *strokeColor);
void setFillPattern(SplashPattern *fillColor);
void setScreen(SplashScreen *screen);
+ void setBlendFunc(SplashBlendFunc func);
+ void setStrokeAlpha(SplashCoord alpha);
+ void setFillAlpha(SplashCoord alpha);
void setLineWidth(SplashCoord lineWidth);
void setLineCap(int lineCap);
void setLineJoin(int lineJoin);
@@ -87,10 +92,14 @@
void saveState();
SplashError restoreState();
+ //----- soft mask
+
+ void setSoftMask(SplashBitmap *softMaskA);
+
//----- drawing operations
// Fill the bitmap with <color>. This is not subject to clipping.
- void clear(SplashColor color);
+ void clear(SplashColorPtr color);
// Stroke a path using the current stroke pattern.
SplashError stroke(SplashPath *path);
@@ -109,10 +118,10 @@
SplashError fillGlyph(SplashCoord x, SplashCoord y,
SplashGlyphBitmap *glyph);
- // Draws an image mask using the fill color. This will read <w>*<h>
- // pixels from <src>, in raster order, starting with the top line.
- // "1" pixels will be drawn with the current fill color; "0" pixels
- // are transparent. The matrix:
+ // Draws an image mask using the fill color. This will read <h>
+ // lines of <w> pixels from <src>, starting with the top line. "1"
+ // pixels will be drawn with the current fill color; "0" pixels are
+ // transparent. The matrix:
// [ mat[0] mat[1] 0 ]
// [ mat[2] mat[3] 0 ]
// [ mat[4] mat[5] 1 ]
@@ -125,24 +134,24 @@
SplashError fillImageMask(SplashImageMaskSource src, void *srcData,
int w, int h, SplashCoord *mat);
- // Draw an image. This will read <w>*<h> pixels from <src>, in
- // raster order, starting with the top line. These pixels are
- // assumed to be in the source mode, <srcMode>. The following
- // combinations of source and target modes are supported:
+ // Draw an image. This will read <h> lines of <w> pixels from
+ // <src>, starting with the top line. These pixels are assumed to
+ // be in the source mode, <srcMode>. The following combinations of
+ // source and target modes are supported:
// source target
// ------ ------
// Mono1 Mono1
// Mono8 Mono1 -- with dithering
// Mono8 Mono8
// RGB8 RGB8
- // BGR8packed BGR8Packed
+ // BGR8 BGR8
+ // ARGB8 RGB8 -- with source alpha (masking)
+ // BGRA8 BGR8 -- with source alpha (masking)
// The matrix behaves as for fillImageMask.
SplashError drawImage(SplashImageSource src, void *srcData,
SplashColorMode srcMode,
int w, int h, SplashCoord *mat);
- //~ drawMaskedImage
-
//----- misc
// Return the associated bitmap.
@@ -156,6 +165,10 @@
// Clear the modified region bounding box.
void clearModRegion();
+ // Get clipping status for the last drawing operation subject to
+ // clipping.
+ SplashClipResult getClipRes() { return opClipRes; }
+
// Toggle debug mode on or off.
void setDebugMode(GBool debugModeA) { debugMode = debugModeA; }
@@ -167,18 +180,22 @@
void strokeWide(SplashXPath *xPath);
SplashXPath *makeDashedPath(SplashXPath *xPath);
SplashError fillWithPattern(SplashPath *path, GBool eo,
- SplashPattern *pattern);
- void drawPixel(int x, int y, SplashColor *color, GBool noClip);
- void drawPixel(int x, int y, SplashPattern *pattern, GBool noClip);
- void drawSpan(int x0, int x1, int y, SplashPattern *pattern, GBool noClip);
+ SplashPattern *pattern, SplashCoord alpha);
+ void drawPixel(int x, int y, SplashColorPtr color,
+ SplashCoord alpha, GBool noClip);
+ void drawPixel(int x, int y, SplashPattern *pattern,
+ SplashCoord alpha, GBool noClip);
+ void drawSpan(int x0, int x1, int y, SplashPattern *pattern,
+ SplashCoord alpha, GBool noClip);
void xorSpan(int x0, int x1, int y, SplashPattern *pattern, GBool noClip);
- void putPixel(int x, int y, SplashColor *pixel);
- void getPixel(int x, int y, SplashColor *pixel);
void dumpPath(SplashPath *path);
+ void dumpXPath(SplashXPath *path);
SplashBitmap *bitmap;
SplashState *state;
+ SplashBitmap *softMask;
int modXMin, modYMin, modXMax, modYMax;
+ SplashClipResult opClipRes;
GBool debugMode;
};
Index: SplashBitmap.cc
===================================================================
RCS file: /cvs/poppler/poppler/splash/SplashBitmap.cc,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- SplashBitmap.cc 3 Mar 2005 19:45:59 -0000 1.1.1.1
+++ SplashBitmap.cc 30 Oct 2005 20:29:05 -0000 1.2
@@ -19,65 +19,59 @@
// SplashBitmap
//------------------------------------------------------------------------
-SplashBitmap::SplashBitmap(int widthA, int heightA, SplashColorMode modeA) {
+SplashBitmap::SplashBitmap(int widthA, int heightA, int rowPad,
+ SplashColorMode modeA, GBool topDown) {
width = widthA;
height = heightA;
mode = modeA;
switch (mode) {
case splashModeMono1:
rowSize = (width + 7) >> 3;
- data.mono1 = (SplashMono1P *)
- gmalloc(rowSize * height * sizeof(SplashMono1P));
break;
case splashModeMono8:
rowSize = width;
- data.mono8 = (SplashMono8 *)
- gmalloc(width * height * sizeof(SplashMono8));
+ break;
+ case splashModeAMono8:
+ rowSize = width * 2;
break;
case splashModeRGB8:
- rowSize = width << 2;
- data.rgb8 = (SplashRGB8 *)
- gmalloc(width * height * sizeof(SplashRGB8));
+ case splashModeBGR8:
+ rowSize = width * 3;
break;
- case splashModeRGB8Packed:
- rowSize = (width * 3 + 3) & ~3;
- data.rgb8p = (SplashRGB8P *)
- gmalloc(rowSize * height * sizeof(SplashRGB8P));
+ case splashModeARGB8:
+ case splashModeBGRA8:
+#if SPLASH_CMYK
+ case splashModeCMYK8:
+#endif
+ rowSize = width * 4;
break;
- case splashModeBGR8Packed:
- rowSize = (width * 3 + 3) & ~3;
- data.bgr8 = (SplashBGR8P *)
- gmalloc(rowSize * height * sizeof(SplashMono1P));
+#if SPLASH_CMYK
+ case splashModeACMYK8:
+ rowSize = width * 5;
+ break;
+#endif
+ }
+ rowSize += rowPad - 1;
+ rowSize -= rowSize % rowPad;
+ data = (SplashColorPtr)gmalloc(rowSize * height);
+ if (!topDown) {
+ data += (height - 1) * rowSize;
+ rowSize = -rowSize;
}
}
SplashBitmap::~SplashBitmap() {
- switch (mode) {
- case splashModeMono1:
- gfree(data.mono1);
- break;
- case splashModeMono8:
- gfree(data.mono8);
- break;
- case splashModeRGB8:
- gfree(data.rgb8);
- break;
- case splashModeRGB8Packed:
- gfree(data.rgb8p);
- break;
- case splashModeBGR8Packed:
- gfree(data.bgr8);
+ if (rowSize < 0) {
+ gfree(data + (height - 1) * rowSize);
+ } else {
+ gfree(data);
}
}
SplashError SplashBitmap::writePNMFile(char *fileName) {
FILE *f;
- SplashMono1P *mono1;
- SplashMono8 *mono8;
- SplashRGB8 *rgb8;
- SplashRGB8P *rgb8pline, *rgb8p;
- SplashBGR8P *bgr8line, *bgr8;
+ SplashColorPtr row, p;
int x, y;
if (!(f = fopen(fileName, "wb"))) {
@@ -88,70 +82,162 @@
case splashModeMono1:
fprintf(f, "P4\n%d %d\n", width, height);
- mono1 = data.mono1;
+ row = data;
for (y = 0; y < height; ++y) {
+ p = row;
for (x = 0; x < width; x += 8) {
- fputc(*mono1 ^ 0xff, f);
- ++mono1;
+ fputc(*p ^ 0xff, f);
+ ++p;
}
+ row += rowSize;
}
break;
case splashModeMono8:
fprintf(f, "P5\n%d %d\n255\n", width, height);
- mono8 = data.mono8;
+ row = data;
for (y = 0; y < height; ++y) {
+ p = row;
for (x = 0; x < width; ++x) {
- fputc(*mono8, f);
- ++mono8;
+ fputc(*p, f);
+ ++p;
+ }
+ row += rowSize;
+ }
+ break;
+
+ case splashModeAMono8:
+ fprintf(f, "P5\n%d %d\n255\n", width, height);
+ row = data;
+ for (y = 0; y < height; ++y) {
+ p = row;
+ for (x = 0; x < width; ++x) {
+ fputc(splashAMono8M(p), f);
+ p += 2;
}
+ row += rowSize;
}
break;
case splashModeRGB8:
fprintf(f, "P6\n%d %d\n255\n", width, height);
- rgb8 = data.rgb8;
+ row = data;
for (y = 0; y < height; ++y) {
+ p = row;
for (x = 0; x < width; ++x) {
- fputc(splashRGB8R(*rgb8), f);
- fputc(splashRGB8G(*rgb8), f);
- fputc(splashRGB8B(*rgb8), f);
- ++rgb8;
+ fputc(splashRGB8R(p), f);
+ fputc(splashRGB8G(p), f);
+ fputc(splashRGB8B(p), f);
+ p += 3;
}
+ row += rowSize;
}
break;
- case splashModeRGB8Packed:
+ case splashModeBGR8:
fprintf(f, "P6\n%d %d\n255\n", width, height);
- rgb8pline = data.rgb8p;
+ row = data;
for (y = 0; y < height; ++y) {
- rgb8p = rgb8pline;
+ p = row;
for (x = 0; x < width; ++x) {
- fputc(rgb8p[0], f);
- fputc(rgb8p[1], f);
- fputc(rgb8p[2], f);
- rgb8p += 3;
+ fputc(splashBGR8R(p), f);
+ fputc(splashBGR8G(p), f);
+ fputc(splashBGR8B(p), f);
+ p += 3;
}
- rgb8pline += rowSize;
+ row += rowSize;
}
break;
- case splashModeBGR8Packed:
+ case splashModeARGB8:
fprintf(f, "P6\n%d %d\n255\n", width, height);
- bgr8line = data.bgr8;
+ row = data;
for (y = 0; y < height; ++y) {
- bgr8 = bgr8line;
+ p = row;
for (x = 0; x < width; ++x) {
- fputc(bgr8[2], f);
- fputc(bgr8[1], f);
- fputc(bgr8[0], f);
- bgr8 += 3;
+ fputc(splashARGB8R(p), f);
+ fputc(splashARGB8G(p), f);
+ fputc(splashARGB8B(p), f);
+ p += 4;
}
- bgr8line += rowSize;
+ row += rowSize;
+ }
+ break;
+
+ case splashModeBGRA8:
+ fprintf(f, "P6\n%d %d\n255\n", width, height);
+ row = data;
+ for (y = 0; y < height; ++y) {
+ p = row;
+ for (x = 0; x < width; ++x) {
+ fputc(splashBGRA8R(p), f);
+ fputc(splashBGRA8G(p), f);
+ fputc(splashBGRA8B(p), f);
+ p += 4;
+ }
+ row += rowSize;
}
break;
+
+#if SPLASH_CMYK
+ case splashModeCMYK8:
+ case splashModeACMYK8:
+ // PNM doesn't support CMYK
+ break;
+#endif
}
fclose(f);
return splashOk;
}
+
+void SplashBitmap::getPixel(int x, int y, SplashColorPtr pixel) {
+ SplashColorPtr p;
+
+ if (y < 0 || y >= height || x < 0 || x >= width) {
+ return;
+ }
+ switch (mode) {
+ case splashModeMono1:
+ p = &data[y * rowSize + (x >> 3)];
+ pixel[0] = (p[0] >> (7 - (x & 7))) & 1;
+ break;
+ case splashModeMono8:
+ p = &data[y * rowSize + x];
+ pixel[0] = p[0];
+ break;
+ case splashModeAMono8:
+ p = &data[y * rowSize + 2 * x];
+ pixel[0] = p[0];
+ pixel[1] = p[1];
+ break;
+ case splashModeRGB8:
+ case splashModeBGR8:
+ p = &data[y * rowSize + 3 * x];
+ pixel[0] = p[0];
+ pixel[1] = p[1];
+ pixel[2] = p[2];
+ break;
+ case splashModeARGB8:
+ case splashModeBGRA8:
+#if SPLASH_CMYK
+ case splashModeCMYK8:
+#endif
+ p = &data[y * rowSize + 4 * x];
+ pixel[0] = p[0];
+ pixel[1] = p[1];
+ pixel[2] = p[2];
+ pixel[3] = p[3];
+ break;
+#if SPLASH_CMYK
+ case splashModeACMYK8:
+ p = &data[y * rowSize + 5 * x];
+ pixel[0] = p[0];
+ pixel[1] = p[1];
+ pixel[2] = p[2];
+ pixel[3] = p[3];
+ pixel[4] = p[4];
+ break;
+#endif
+ }
+}
Index: SplashBitmap.h
===================================================================
RCS file: /cvs/poppler/poppler/splash/SplashBitmap.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- SplashBitmap.h 3 Mar 2005 19:45:59 -0000 1.1.1.1
+++ SplashBitmap.h 30 Oct 2005 20:29:05 -0000 1.2
@@ -20,8 +20,12 @@
class SplashBitmap {
public:
- // Create a new bitmap.
- SplashBitmap(int widthA, int heightA, SplashColorMode modeA);
+ // Create a new bitmap. It will have <widthA> x <heightA> pixels in
+ // color mode <modeA>. Rows will be padded out to a multiple of
+ // <rowPad> bytes. If <topDown> is false, the bitmap will be stored
+ // upside-down, i.e., with the last row first in memory.
+ SplashBitmap(int widthA, int heightA, int rowPad,
+ SplashColorMode modeA, GBool topDown = gTrue);
~SplashBitmap();
@@ -33,12 +37,15 @@
SplashError writePNMFile(char *fileName);
+ void getPixel(int x, int y, SplashColorPtr pixel);
+
private:
int width, height; // size of bitmap
int rowSize; // size of one row of data, in bytes
+ // - negative for bottom-up bitmaps
SplashColorMode mode; // color mode
- SplashColorPtr data;
+ SplashColorPtr data; // pointer to row zero of the bitmap data
friend class Splash;
};
Index: SplashPattern.cc
===================================================================
RCS file: /cvs/poppler/poppler/splash/SplashPattern.cc,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- SplashPattern.cc 3 Mar 2005 19:46:00 -0000 1.1.1.1
+++ SplashPattern.cc 30 Oct 2005 20:29:05 -0000 1.2
@@ -28,25 +28,25 @@
// SplashSolidColor
//------------------------------------------------------------------------
-SplashSolidColor::SplashSolidColor(SplashColor colorA) {
- color = colorA;
+SplashSolidColor::SplashSolidColor(SplashColorPtr colorA) {
+ splashColorCopy(color, colorA);
}
SplashSolidColor::~SplashSolidColor() {
}
-SplashColor SplashSolidColor::getColor(int x, int y) {
- return color;
+void SplashSolidColor::getColor(int x, int y, SplashColorPtr c) {
+ splashColorCopy(c, color);
}
//------------------------------------------------------------------------
// SplashHalftone
//------------------------------------------------------------------------
-SplashHalftone::SplashHalftone(SplashColor color0A, SplashColor color1A,
+SplashHalftone::SplashHalftone(SplashColorPtr color0A, SplashColorPtr color1A,
SplashScreen *screenA, SplashCoord valueA) {
- color0 = color0A;
- color1 = color1A;
+ splashColorCopy(color0, color0A);
+ splashColorCopy(color1, color1A);
screen = screenA;
value = valueA;
}
@@ -59,6 +59,10 @@
delete screen;
}
-SplashColor SplashHalftone::getColor(int x, int y) {
- return screen->test(x, y, value) ? color1 : color0;
+void SplashHalftone::getColor(int x, int y, SplashColorPtr c) {
+ splashColorCopy(c, screen->test(x, y, value) ? color1 : color0);
+}
+
+GBool SplashHalftone::isStatic() {
+ return screen->isStatic(value);
}
Index: SplashPattern.h
===================================================================
RCS file: /cvs/poppler/poppler/splash/SplashPattern.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- SplashPattern.h 3 Mar 2005 19:45:59 -0000 1.1.1.1
+++ SplashPattern.h 30 Oct 2005 20:29:05 -0000 1.2
@@ -28,7 +28,12 @@
virtual ~SplashPattern();
- virtual SplashColor getColor(int x, int y) = 0;
+ // Return the color value for a specific pixel.
+ virtual void getColor(int x, int y, SplashColorPtr c) = 0;
+
+ // Returns true if this pattern object will return the same color
+ // value for all pixels.
+ virtual GBool isStatic() = 0;
private:
};
@@ -40,13 +45,15 @@
class SplashSolidColor: public SplashPattern {
public:
- SplashSolidColor(SplashColor colorA);
+ SplashSolidColor(SplashColorPtr colorA);
virtual SplashPattern *copy() { return new SplashSolidColor(color); }
virtual ~SplashSolidColor();
- virtual SplashColor getColor(int x, int y);
+ virtual void getColor(int x, int y, SplashColorPtr c);
+
+ virtual GBool isStatic() { return gTrue; }
private:
@@ -60,14 +67,16 @@
class SplashHalftone: public SplashPattern {
public:
- SplashHalftone(SplashColor color0A, SplashColor color1A,
+ SplashHalftone(SplashColorPtr color0A, SplashColorPtr color1A,
SplashScreen *screenA, SplashCoord valueA);
virtual SplashPattern *copy();
virtual ~SplashHalftone();
- virtual SplashColor getColor(int x, int y);
+ virtual void getColor(int x, int y, SplashColorPtr c);
+
+ virtual GBool isStatic();
private:
Index: SplashState.cc
===================================================================
RCS file: /cvs/poppler/poppler/splash/SplashState.cc,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- SplashState.cc 27 Aug 2005 08:43:43 -0000 1.2
+++ SplashState.cc 30 Oct 2005 20:29:05 -0000 1.3
@@ -21,6 +21,11 @@
// SplashState
//------------------------------------------------------------------------
+// number of components in each color mode
+int splashColorModeNComps[] = {
+ 1, 1, 2, 3, 3, 4, 4
+};
+
SplashState::SplashState(int width, int height) {
SplashColor color;
@@ -28,6 +33,9 @@
strokePattern = new SplashSolidColor(color);
fillPattern = new SplashSolidColor(color);
screen = new SplashScreen(10);
+ blendFunc = NULL;
+ strokeAlpha = 1;
+ fillAlpha = 1;
lineWidth = 0;
lineCap = splashLineCapButt;
lineJoin = splashLineJoinMiter;
@@ -44,6 +52,9 @@
strokePattern = state->strokePattern->copy();
fillPattern = state->fillPattern->copy();
screen = state->screen->copy();
+ blendFunc = state->blendFunc;
+ strokeAlpha = state->strokeAlpha;
+ fillAlpha = state->fillAlpha;
lineWidth = state->lineWidth;
lineCap = state->lineCap;
lineJoin = state->lineJoin;
Index: SplashState.h
===================================================================
RCS file: /cvs/poppler/poppler/splash/SplashState.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- SplashState.h 3 Mar 2005 19:45:59 -0000 1.1.1.1
+++ SplashState.h 30 Oct 2005 20:29:05 -0000 1.2
@@ -68,6 +68,9 @@
SplashPattern *strokePattern;
SplashPattern *fillPattern;
SplashScreen *screen;
+ SplashBlendFunc blendFunc;
+ SplashCoord strokeAlpha;
+ SplashCoord fillAlpha;
SplashCoord lineWidth;
int lineCap;
int lineJoin;
Index: SplashTypes.h
===================================================================
RCS file: /cvs/poppler/poppler/splash/SplashTypes.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- SplashTypes.h 16 Sep 2005 18:21:38 -0000 1.2
+++ SplashTypes.h 30 Oct 2005 20:29:05 -0000 1.3
@@ -25,56 +25,109 @@
//------------------------------------------------------------------------
enum SplashColorMode {
- splashModeMono1,
- splashModeMono8,
- splashModeRGB8,
- splashModeRGB8Packed,
- splashModeBGR8Packed
+ splashModeMono1, // 1 bit per component, 8 pixels per byte,
+ // MSbit is on the left
+ splashModeMono8, // 1 byte per component, 1 byte per pixel
+ splashModeAMono8, // 1 byte per component, 2 bytes per pixel:
+ // AMAM...
+ splashModeRGB8, // 1 byte per component, 3 bytes per pixel:
+ // RGBRGB...
+ splashModeBGR8, // 1 byte per component, 3 bytes per pixel:
+ // BGRBGR...
+ splashModeARGB8, // 1 byte per component, 4 bytes per pixel:
+ // ARGBARGB...
+ splashModeBGRA8 // 1 byte per component, 4 bytes per pixel:
+ // BGRABGRA...
+#if SPLASH_CMYK
+ ,
+ splashModeCMYK8, // 1 byte per component, 4 bytes per pixel:
+ // CMYKCMYK...
+ splashModeACMYK8 // 1 byte per component, 5 bytes per pixel:
+ // ACMYKACMYK
+#endif
};
+// number of components in each color mode
+// (defined in SplashState.cc)
+extern int splashColorModeNComps[];
+
// max number of components in any SplashColor
-#define splashMaxColorComps 3
+#if SPLASH_CMYK
+# define splashMaxColorComps 5
+#else
+# define splashMaxColorComps 4
+#endif
-// 1-bit gray or alpha
-typedef Guchar SplashMono1;
-typedef Guchar SplashMono1P; // packed
+typedef Guchar SplashColor[splashMaxColorComps];
+typedef Guchar *SplashColorPtr;
-// 8-bit gray or alpha
-typedef Guchar SplashMono8;
+// AMono8
+static inline Guchar splashAMono8A(SplashColorPtr am8) { return am8[0]; }
+static inline Guchar splashAMono8M(SplashColorPtr am8) { return am8[1]; }
-// 3x8-bit RGB: (MSB) 00RRGGBB (LSB)
-typedef Guint SplashRGB8;
-#define splashRGB8R(rgb8) (((rgb8) >> 16) & 0xff)
-#define splashRGB8G(rgb8) (((rgb8) >> 8) & 0xff)
-#define splashRGB8B(rgb8) ((rgb8) & 0xff)
-#define splashMakeRGB8(r, g, b) \
- ((((r) & 0xff) << 16) | (((g) & 0xff) << 8) | ((b) & 0xff))
+// RGB8
+static inline Guchar splashRGB8R(SplashColorPtr rgb8) { return rgb8[0]; }
+static inline Guchar splashRGB8G(SplashColorPtr rgb8) { return rgb8[1]; }
+static inline Guchar splashRGB8B(SplashColorPtr rgb8) { return rgb8[2]; }
-typedef Guchar SplashRGB8P; // packed
+// BGR8
+static inline Guchar splashBGR8R(SplashColorPtr bgr8) { return bgr8[2]; }
+static inline Guchar splashBGR8G(SplashColorPtr bgr8) { return bgr8[1]; }
+static inline Guchar splashBGR8B(SplashColorPtr bgr8) { return bgr8[0]; }
-// 3x8-bit RGB: (MSB) 00BBGGRR (LSB)
-typedef Guint SplashBGR8;
-typedef Guchar SplashBGR8P; // packed
-#define splashBGR8R(bgr8) ((bgr8) & 0xff)
-#define splashBGR8G(bgr8) (((bgr8) >> 8) & 0xff)
-#define splashBGR8B(bgr8) (((bgr8) >> 16) & 0xff)
-#define splashMakeBGR8(r, g, b) \
- ((((b) & 0xff) << 16) | (((g) & 0xff) << 8) | ((r) & 0xff))
+// ARGB8
+static inline Guchar splashARGB8A(SplashColorPtr argb8) { return argb8[0]; }
+static inline Guchar splashARGB8R(SplashColorPtr argb8) { return argb8[1]; }
+static inline Guchar splashARGB8G(SplashColorPtr argb8) { return argb8[2]; }
+static inline Guchar splashARGB8B(SplashColorPtr argb8) { return argb8[3]; }
-union SplashColor {
- SplashMono1 mono1;
- SplashMono8 mono8;
- SplashRGB8 rgb8;
- SplashBGR8 bgr8;
-};
+// ARGB8
+static inline Guchar splashBGRA8A(SplashColorPtr bgra8) { return bgra8[3]; }
+static inline Guchar splashBGRA8R(SplashColorPtr bgra8) { return bgra8[2]; }
+static inline Guchar splashBGRA8G(SplashColorPtr bgra8) { return bgra8[1]; }
+static inline Guchar splashBGRA8B(SplashColorPtr bgra8) { return bgra8[0]; }
-union SplashColorPtr {
- SplashMono1P *mono1;
- SplashMono8 *mono8;
- SplashRGB8 *rgb8;
- SplashRGB8P *rgb8p;
- SplashBGR8P *bgr8;
-};
+#if SPLASH_CMYK
+// CMYK8
+static inline Guchar splashCMYK8C(SplashColorPtr cmyk8) { return cmyk8[0]; }
+static inline Guchar splashCMYK8M(SplashColorPtr cmyk8) { return cmyk8[1]; }
+static inline Guchar splashCMYK8Y(SplashColorPtr cmyk8) { return cmyk8[2]; }
+static inline Guchar splashCMYK8K(SplashColorPtr cmyk8) { return cmyk8[3]; }
+
+// ACMYK8
+static inline Guchar splashACMYK8A(SplashColorPtr acmyk8) { return acmyk8[0]; }
+static inline Guchar splashACMYK8C(SplashColorPtr acmyk8) { return acmyk8[1]; }
+static inline Guchar splashACMYK8M(SplashColorPtr acmyk8) { return acmyk8[2]; }
+static inline Guchar splashACMYK8Y(SplashColorPtr acmyk8) { return acmyk8[3]; }
+static inline Guchar splashACMYK8K(SplashColorPtr acmyk8) { return acmyk8[4]; }
+#endif
+
+static inline void splashColorCopy(SplashColorPtr dest, SplashColorPtr src) {
+ dest[0] = src[0];
+ dest[1] = src[1];
+ dest[2] = src[2];
+ dest[3] = src[3];
+#if SPLASH_CMYK
+ dest[4] = src[4];
+#endif
+}
+
+static inline void splashColorXor(SplashColorPtr dest, SplashColorPtr src) {
+ dest[0] ^= src[0];
+ dest[1] ^= src[1];
+ dest[2] ^= src[2];
+ dest[3] ^= src[3];
+#if SPLASH_CMYK
+ dest[4] ^= src[4];
+#endif
+}
+
+//------------------------------------------------------------------------
+// blend functions
+//------------------------------------------------------------------------
+
+typedef void (*SplashBlendFunc)(SplashColorPtr src, SplashColorPtr dest,
+ SplashColorPtr blend, SplashColorMode cm);
//------------------------------------------------------------------------
// error results
More information about the poppler
mailing list