#undef PdfSeparableBlendMode
-#define Subtract(res, Color) \
- do { \
- comp1_t dc, sc; \
- dc = Color (d); \
- sc = Color (s); \
- if (sc >= dc) \
- res = 0; \
- else \
- res = dc - sc; \
- } while (0)
-
-static void
-fbCombineSubtractU (pixman_implementation_t *imp, pixman_op_t op,
- comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
- int i;
-
- for (i = 0; i < width; ++i) {
- comp4_t d, s;
- comp4_t r, g, b;
-
- d = *(dest + i);
- s = combineMask (src, mask, i);
-
- Subtract (r, Red);
- Subtract (g, Green);
- Subtract (b, Blue);
-
- *(dest + i) = (Alpha (d) << A_SHIFT)
- | (r << R_SHIFT)
- | (g << G_SHIFT)
- | b;
- }
-}
-
-static void
-fbCombineSubtractC (pixman_implementation_t *imp, pixman_op_t op,
- comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
- int i;
-
- for (i = 0; i < width; ++i) {
- comp4_t d, s, m;
- comp4_t r, g, b;
-
- d = *(dest + i);
- s = combineMask (src, mask, i);
- m = *(mask + i);
-
- fbCombineMaskC (&s, &m);
- m = ~m;
- fbCombineMaskC (&d, &m);
-
- Subtract (r, Red);
- Subtract (g, Green);
- Subtract (b, Blue);
-
- *(dest + i) = (Alpha (d) << A_SHIFT)
- | (r << R_SHIFT)
- | (g << G_SHIFT)
- | b;
- }
-}
-
-#undef Subtract
-
/*
* PDF nonseperable blend modes are implemented using the following functions
* to operate in HSL space, with Cmax, Cmid, Cmin referring to the max, mid
#define Sat(c) (Max (c) - Min (c))
#define PdfNonSeparableBlendMode(name) \
-static FASTCALL void \
+static void \
fbCombine ## name ## U (pixman_implementation_t *imp, pixman_op_t op, \
comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) \
{ \
#undef Min
#undef PdfNonSeparableBlendMode
+/*
+ * Flash Subtract:
+ * This is the only blend mode present in Adobe Flash that is not part of
+ * the PDF specification. It has been reverse engineered from looking at
+ * Flash files. Some information can be found at
+ * http://www.kaourantin.net/2005/09/some-word-on-blend-modes-in-flash.html
+ */
+#define Subtract(res, Color) \
+ do { \
+ comp1_t dc, sc; \
+ dc = Color (d); \
+ sc = Color (s); \
+ if (sc >= dc) \
+ res = 0; \
+ else \
+ res = dc - sc; \
+ } while (0)
+
+static void
+fbCombineFlashSubtractU (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+ int i;
+
+ for (i = 0; i < width; ++i) {
+ comp4_t d, s;
+ comp4_t r, g, b;
+
+ d = *(dest + i);
+ s = combineMask (src, mask, i);
+
+ Subtract (r, Red);
+ Subtract (g, Green);
+ Subtract (b, Blue);
+
+ *(dest + i) = (Alpha (d) << A_SHIFT)
+ | (r << R_SHIFT)
+ | (g << G_SHIFT)
+ | b;
+ }
+}
+
+static void
+fbCombineFlashSubtractC (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+ int i;
+
+ for (i = 0; i < width; ++i) {
+ comp4_t d, s, m;
+ comp4_t r, g, b;
+
+ d = *(dest + i);
+ s = combineMask (src, mask, i);
+ m = *(mask + i);
+
+ fbCombineMaskC (&s, &m);
+ m = ~m;
+ fbCombineMaskC (&d, &m);
+
+ Subtract (r, Red);
+ Subtract (g, Green);
+ Subtract (b, Blue);
+
+ *(dest + i) = (Alpha (d) << A_SHIFT)
+ | (r << R_SHIFT)
+ | (g << G_SHIFT)
+ | b;
+ }
+}
+
+#undef Subtract
+
/* Overlay
*
* All of the disjoint composing functions
imp->combine_width[PIXMAN_OP_SOFT_LIGHT] = fbCombineSoftLightU;
imp->combine_width[PIXMAN_OP_DIFFERENCE] = fbCombineDifferenceU;
imp->combine_width[PIXMAN_OP_EXCLUSION] = fbCombineExclusionU;
- imp->combine_width[PIXMAN_OP_SUBTRACT] = fbCombineSubtractU;
imp->combine_width[PIXMAN_OP_HSL_HUE] = fbCombineHSLHueU;
imp->combine_width[PIXMAN_OP_HSL_SATURATION] = fbCombineHSLSaturationU;
imp->combine_width[PIXMAN_OP_HSL_COLOR] = fbCombineHSLColorU;
imp->combine_width[PIXMAN_OP_HSL_LUMINOSITY] = fbCombineHSLLuminosityU;
+ imp->combine_width[PIXMAN_OP_FLASH_SUBTRACT] = fbCombineFlashSubtractU;
/* Component alpha combiners */
imp->combine_width_ca[PIXMAN_OP_CLEAR] = fbCombineClearC;
imp->combine_width_ca[PIXMAN_OP_SOFT_LIGHT] = fbCombineSoftLightC;
imp->combine_width_ca[PIXMAN_OP_DIFFERENCE] = fbCombineDifferenceC;
imp->combine_width_ca[PIXMAN_OP_EXCLUSION] = fbCombineExclusionC;
- imp->combine_width_ca[PIXMAN_OP_SUBTRACT] = fbCombineSubtractC;
imp->combine_width_ca[PIXMAN_OP_HSL_HUE] = fbCombineHSLHueC;
imp->combine_width_ca[PIXMAN_OP_HSL_SATURATION] = fbCombineHSLSaturationC;
imp->combine_width_ca[PIXMAN_OP_HSL_COLOR] = fbCombineHSLColorC;
imp->combine_width_ca[PIXMAN_OP_HSL_LUMINOSITY] = fbCombineHSLLuminosityC;
+ imp->combine_width_ca[PIXMAN_OP_FLASH_SUBTRACT] = fbCombineFlashSubtractC;
}
PIXMAN_OP_SOFT_LIGHT = 0x38,
PIXMAN_OP_DIFFERENCE = 0x39,
PIXMAN_OP_EXCLUSION = 0x3a,
- PIXMAN_OP_SUBTRACT = 0x3b,
- PIXMAN_OP_HSL_HUE = 0x3c,
- PIXMAN_OP_HSL_SATURATION = 0x3d,
- PIXMAN_OP_HSL_COLOR = 0x3e,
- PIXMAN_OP_HSL_LUMINOSITY = 0x3f,
+ PIXMAN_OP_HSL_HUE = 0x3b,
+ PIXMAN_OP_HSL_SATURATION = 0x3c,
+ PIXMAN_OP_HSL_COLOR = 0x3d,
+ PIXMAN_OP_HSL_LUMINOSITY = 0x3e,
+ PIXMAN_OP_FLASH_SUBTRACT = 0x3f,
PIXMAN_OP_NONE,
PIXMAN_OP_LAST = PIXMAN_OP_NONE