summaryrefslogtreecommitdiff
path: root/poppler/CairoOutputDev.cc
diff options
context:
space:
mode:
Diffstat (limited to 'poppler/CairoOutputDev.cc')
-rw-r--r--poppler/CairoOutputDev.cc59
1 files changed, 59 insertions, 0 deletions
diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index 670ae402..d1f5f3cd 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -263,6 +263,7 @@ void CairoOutputDev::restoreState(GfxState *state) {
updateStrokeColor(state);
updateFillOpacity(state);
updateStrokeOpacity(state);
+ updateBlendMode(state);
MaskStack* ms = maskStack;
if (mask)
@@ -284,6 +285,7 @@ void CairoOutputDev::updateAll(GfxState *state) {
updateStrokeColor(state);
updateFillOpacity(state);
updateStrokeOpacity(state);
+ updateBlendMode(state);
needFontUpdate = gTrue;
}
@@ -470,6 +472,63 @@ void CairoOutputDev::updateFillColorStop(GfxState *state, double offset) {
offset, fill_color.r, fill_color.g, fill_color.b));
}
+void CairoOutputDev::updateBlendMode(GfxState *state) {
+#ifdef CAIRO_HAS_BLEND_MODES
+ switch (state->getBlendMode()) {
+ default:
+ case gfxBlendNormal:
+ cairo_set_operator (cairo, CAIRO_OPERATOR_OVER);
+ break;
+ case gfxBlendMultiply:
+ cairo_set_operator (cairo, CAIRO_OPERATOR_MULTIPLY);
+ break;
+ case gfxBlendScreen:
+ cairo_set_operator (cairo, CAIRO_OPERATOR_SCREEN);
+ break;
+ case gfxBlendOverlay:
+ cairo_set_operator (cairo, CAIRO_OPERATOR_OVERLAY);
+ break;
+ case gfxBlendDarken:
+ cairo_set_operator (cairo, CAIRO_OPERATOR_DARKEN);
+ break;
+ case gfxBlendLighten:
+ cairo_set_operator (cairo, CAIRO_OPERATOR_LIGHTEN);
+ break;
+ case gfxBlendColorDodge:
+ cairo_set_operator (cairo, CAIRO_OPERATOR_COLOR_DODGE);
+ break;
+ case gfxBlendColorBurn:
+ cairo_set_operator (cairo, CAIRO_OPERATOR_COLOR_BURN);
+ break;
+ case gfxBlendHardLight:
+ cairo_set_operator (cairo, CAIRO_OPERATOR_HARD_LIGHT);
+ break;
+ case gfxBlendSoftLight:
+ cairo_set_operator (cairo, CAIRO_OPERATOR_SOFT_LIGHT);
+ break;
+ case gfxBlendDifference:
+ cairo_set_operator (cairo, CAIRO_OPERATOR_DIFFERENCE);
+ break;
+ case gfxBlendExclusion:
+ cairo_set_operator (cairo, CAIRO_OPERATOR_EXCLUSION);
+ break;
+ case gfxBlendHue:
+ cairo_set_operator (cairo, CAIRO_OPERATOR_HSL_HUE);
+ break;
+ case gfxBlendSaturation:
+ cairo_set_operator (cairo, CAIRO_OPERATOR_HSL_SATURATION);
+ break;
+ case gfxBlendColor:
+ cairo_set_operator (cairo, CAIRO_OPERATOR_HSL_COLOR);
+ break;
+ case gfxBlendLuminosity:
+ cairo_set_operator (cairo, CAIRO_OPERATOR_HSL_LUMINOSITY);
+ break;
+ }
+ LOG(printf ("blend mode: %d\n", (int)state->getBlendMode()));
+#endif /* CAIRO_HAS_BLEND_MODES */
+}
+
void CairoOutputDev::updateFont(GfxState *state) {
cairo_font_face_t *font_face;
cairo_matrix_t matrix, invert_matrix;