Re: Is color overlapping possible with Mathematica?

*To*: mathgroup at smc.vnet.net*Subject*: [mg28947] Re: [mg28917] Is color overlapping possible with Mathematica?*From*: BobHanlon at aol.com*Date*: Sat, 19 May 2001 22:28:06 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

This is not a general solution; however, it is an approach. Needs["Graphics`Graphics`"]; Needs["Graphics`Colors`"]; Needs["Graphics`InequalityGraphics`"]; blend[x__ /;!FreeQ[{x}, RGBColor]] := Module[{colorList = Cases[Flatten[{x}], RGBColor[__]]}, RGBColor[ Sequence@@(Plus@@Apply[List,colorList,{1}]/Length[colorList])]]; cond1 = 0<x<2 && 0<y<2; cond2 = 1<x<3 && 1<y<3; colors = {Red, Blue}; DisplayTogether[ InequalityPlot[cond1, {x}, {y}, Fills -> colors[[1]]], InequalityPlot[cond2, {x}, {y}, Fills -> colors[[2]]], InequalityPlot[cond1 && cond2, {x}, {y}, Fills -> blend[colors]]]; cond1 = 0<x<2 && 0<y<3x && x*y < 1; cond2 = 1<(x+2y)^2+4y^2<4; colors = {Red, LightBlue}; DisplayTogether[ InequalityPlot[cond1, {x}, {y}, Fills -> colors[[1]]], InequalityPlot[cond2, {x, -3, 3}, {y, -3, 3}, Fills -> colors[[2]]], InequalityPlot[cond1 && cond2, {x, -3, 3}, {y, -3, 3}, Fills -> blend[colors]]]; Bob Hanlon In a message dated 2001/5/18 1:39:03 AM, liu at vtaix.cc.vt.edu writes: >I wonder if it's possible to use Mathematica to draw to >overlapping shapes each filled with a different color >and the color in the overlapping region being the >composition of the two colors but not the color of the >shape on top. For example, I could do > >In[1]:= Show[Graphics[{RGBColor[1.0, 0.0, 0.0], > Polygon[{{0, 0}, {0, 2}, {2, 2}, {2, 0}}]}]]; >In[2]:= Show[Graphics[{RGBColor[0.0, 0.0, 1.0], > Polygon[{{1, 1}, {1, 3}, {3, 3}, {3, 1}}]}]]; >In[3]:= Show[Out[1],Out[2]]; > >But the overlapping square area would have the color of Out[2], >RGBColor[0.0, 0.0, 1.0]. > >What I am looking for is to plot a shape transparent rather than >opaque. >