[vector] Approximate a couple of Porter-Duff modes

The rest need structural change.
This commit is contained in:
Behdad Esfahbod authored and Khaled Hosny committed 2026-04-20 01:29:49 +02:00
1 parent 1ae32fb6a7
commit 521d7b2e99
2 files changed
+11 -5

No files matched your search

+6 -3
View File
@@ -1437,6 +1437,11 @@ hb_pdf_blend_mode_name (hb_paint_composite_mode_t mode)
case HB_PAINT_COMPOSITE_MODE_HSL_SATURATION: return "Saturation";
case HB_PAINT_COMPOSITE_MODE_HSL_COLOR: return "Color";
case HB_PAINT_COMPOSITE_MODE_HSL_LUMINOSITY: return "Luminosity";
/* Porter-Duff modes have no PDF blend-mode equivalent; approximate
* the two that have a plausible color-blend analog, and let the
* rest fall through to Normal (SRC_OVER). */
case HB_PAINT_COMPOSITE_MODE_PLUS: return "Screen";
case HB_PAINT_COMPOSITE_MODE_XOR: return "Difference";
case HB_PAINT_COMPOSITE_MODE_CLEAR:
case HB_PAINT_COMPOSITE_MODE_SRC:
case HB_PAINT_COMPOSITE_MODE_DEST:
@@ -1448,9 +1453,7 @@ hb_pdf_blend_mode_name (hb_paint_composite_mode_t mode)
case HB_PAINT_COMPOSITE_MODE_DEST_OUT:
case HB_PAINT_COMPOSITE_MODE_SRC_ATOP:
case HB_PAINT_COMPOSITE_MODE_DEST_ATOP:
case HB_PAINT_COMPOSITE_MODE_XOR:
case HB_PAINT_COMPOSITE_MODE_PLUS:
default: return nullptr; /* Normal / no PDF equivalent */
default: return nullptr; /* Normal */
}
}
+5 -2
View File
@@ -76,6 +76,11 @@ hb_vector_svg_composite_mode_str (hb_paint_composite_mode_t mode)
{
switch (mode)
{
/* Porter-Duff modes have no SVG mix-blend-mode equivalent;
* approximate the two that have a plausible color-blend analog,
* and let the rest fall through to normal (SRC_OVER). */
case HB_PAINT_COMPOSITE_MODE_PLUS: return "screen";
case HB_PAINT_COMPOSITE_MODE_XOR: return "difference";
case HB_PAINT_COMPOSITE_MODE_CLEAR:
case HB_PAINT_COMPOSITE_MODE_SRC:
case HB_PAINT_COMPOSITE_MODE_DEST:
@@ -86,8 +91,6 @@ hb_vector_svg_composite_mode_str (hb_paint_composite_mode_t mode)
case HB_PAINT_COMPOSITE_MODE_DEST_OUT:
case HB_PAINT_COMPOSITE_MODE_SRC_ATOP:
case HB_PAINT_COMPOSITE_MODE_DEST_ATOP:
case HB_PAINT_COMPOSITE_MODE_XOR:
case HB_PAINT_COMPOSITE_MODE_PLUS:
return nullptr;
case HB_PAINT_COMPOSITE_MODE_SRC_OVER: return "normal";
case HB_PAINT_COMPOSITE_MODE_SCREEN: return "screen";