Compose.jl icon indicating copy to clipboard operation
Compose.jl copied to clipboard

Change blend mode

Open grero opened this issue 8 years ago • 0 comments

Hi, I'm trying to create an image consisting of overlapping filled circles, where I'd like the intersection of the circles to have a fill color representing a blend of the fill color of the individual circles. From my cursory understanding of Cairo, this involves setting Cairo.OPERATOR_OVERLAY for the underlying CairoContext, but I'm not sure how to achieve this in Compose. The following naive first attempt did not produce the desired results

using Cairo,Compose
p1 = compose(context(), Compose.circle(0.5, 0.5, 0.25),fill("red"))
p2 = compose(context(), Compose.circle(0.75, 0.5, 0.25),fill("blue"))
pp = PDF("/tmp/test5.pdf", 3inch, 4inch)
Cairo.set_operator(pp.ctx, Cairo.OPERATOR_OVERLAY)
draw(pp,compose(p1, p2))

The resulting PDF still shows the red circle on top of the blue circle, with no blending.

grero avatar Aug 18 '16 02:08 grero