summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Chaplin <>2012-08-15 17:49:46 +0800
committerSteve Chaplin <>2012-08-15 17:49:46 +0800
commitcdec5e4c0a9ef4ad7b0413e4dc1e21f81841b064 (patch)
treeeeabb7ef8eb6534fba8f9ec3f658ee33533823ed
parent68314398b2e3ee1b8d62e171c80ccfe54d713abf (diff)
downloadpycairo-cdec5e4c0a9ef4ad7b0413e4dc1e21f81841b064.tar.gz
Add new constants:
cairo.OPERATOR_MULTIPLY cairo.OPERATOR_SCREEN cairo.OPERATOR_OVERLAY cairo.OPERATOR_DARKEN cairo.OPERATOR_LIGHTEN cairo.OPERATOR_COLOR_DODGE cairo.OPERATOR_COLOR_BURN cairo.OPERATOR_HARD_LIGHT cairo.OPERATOR_SOFT_LIGHT cairo.OPERATOR_DIFFERENCE cairo.OPERATOR_EXCLUSION cairo.OPERATOR_HSL_HUE cairo.OPERATOR_HSL_SATURATION cairo.OPERATOR_HSL_COLOR cairo.OPERATOR_HSL_LUMINOSITY
-rw-r--r--doc/reference/constants.rst73
-rw-r--r--src/cairomodule.c16
2 files changed, 89 insertions, 0 deletions
diff --git a/doc/reference/constants.rst b/doc/reference/constants.rst
index a1fef62..bcbfbeb 100644
--- a/doc/reference/constants.rst
+++ b/doc/reference/constants.rst
@@ -456,6 +456,79 @@ mathematical definitions, see http://cairographics.org/operators.
like over, but assuming source and dest are disjoint geometries
+.. data:: OPERATOR_MULTIPLY
+
+ source and destination layers are multiplied. This causes the result to be
+ at least as dark as the darker inputs. (Since 1.10.2)
+
+.. data:: OPERATOR_SCREEN
+
+ source and destination are complemented and multiplied. This causes the
+ result to be at least as light as the lighter inputs. (Since 1.10.2)
+
+.. data:: OPERATOR_OVERLAY
+
+ multiplies or screens, depending on the lightness of the destination
+ color. (Since 1.10.2)
+
+.. data:: OPERATOR_DARKEN
+
+ replaces the destination with the source if it is darker, otherwise keeps
+ the source. (Since 1.10.2)
+
+.. data:: OPERATOR_LIGHTEN
+
+ replaces the destination with the source if it is lighter, otherwise keeps
+ the source. (Since 1.10.2)
+
+.. data:: OPERATOR_COLOR_DODGE
+
+ brightens the destination color to reflect the source color. (Since 1.10.2)
+
+.. data:: OPERATOR_COLOR_BURN
+
+ darkens the destination color to reflect the source color. (Since 1.10.2)
+
+.. data:: OPERATOR_HARD_LIGHT
+
+ Multiplies or screens, dependent on source color. (Since 1.10.2)
+
+.. data:: OPERATOR_SOFT_LIGHT
+
+ Darkens or lightens, dependent on source color. (Since 1.10.2)
+
+.. data:: OPERATOR_DIFFERENCE
+
+ Takes the difference of the source and destination color. (Since 1.10.2)
+
+.. data:: OPERATOR_EXCLUSION
+
+ Produces an effect similar to difference, but with lower contrast. (Since
+ 1.10.2)
+
+.. data:: OPERATOR_HSL_HUE
+
+ Creates a color with the hue of the source and the saturation and
+ luminosity of the target. (Since 1.10.2)
+
+.. data:: OPERATOR_HSL_SATURATION
+
+ Creates a color with the saturation of the source and the hue and
+ luminosity of the target. Painting with this mode onto a gray area produces
+ no change. (Since 1.10.2)
+
+.. data:: OPERATOR_HSL_COLOR
+
+ Creates a color with the hue and saturation of the source and the
+ luminosity of the target. This preserves the gray levels of the target and
+ is useful for coloring monochrome images or tinting color images. (Since
+ 1.10.2)
+
+.. data:: OPERATOR_HSL_LUMINOSITY
+
+ Creates a color with the luminosity of the source and the hue and
+ saturation of the target. This produces an inverse effect to
+ CAIRO_OPERATOR_HSL_COLOR. (Since 1.10.2)
.. _constants_PATH:
diff --git a/src/cairomodule.c b/src/cairomodule.c
index 3a15d44..ab70319 100644
--- a/src/cairomodule.c
+++ b/src/cairomodule.c
@@ -535,6 +535,22 @@ PyInit__cairo(void)
CONSTANT(OPERATOR_ADD);
CONSTANT(OPERATOR_SATURATE);
+ CONSTANT(OPERATOR_MULTIPLY);
+ CONSTANT(OPERATOR_SCREEN);
+ CONSTANT(OPERATOR_OVERLAY);
+ CONSTANT(OPERATOR_DARKEN);
+ CONSTANT(OPERATOR_LIGHTEN);
+ CONSTANT(OPERATOR_COLOR_DODGE);
+ CONSTANT(OPERATOR_COLOR_BURN);
+ CONSTANT(OPERATOR_HARD_LIGHT);
+ CONSTANT(OPERATOR_SOFT_LIGHT);
+ CONSTANT(OPERATOR_DIFFERENCE);
+ CONSTANT(OPERATOR_EXCLUSION);
+ CONSTANT(OPERATOR_HSL_HUE);
+ CONSTANT(OPERATOR_HSL_SATURATION);
+ CONSTANT(OPERATOR_HSL_COLOR);
+ CONSTANT(OPERATOR_HSL_LUMINOSITY);
+
CONSTANT(PATH_MOVE_TO);
CONSTANT(PATH_LINE_TO);
CONSTANT(PATH_CURVE_TO);