Cake! Everybody loves cake! Cakes have layers!
Cake! Everybody loves cake! Cakes have layers!
In[]:=
cake =
;
In[]:=
{width, height} = ImageDimensions[cake];{w, h} = Rationalize[NumeratorDenominator[Round[width/height, 0.1]]*10];
Code
Code
In[]:=
SetAttributes[evenNumPrimeFactorsQ, Listable];evenNumPrimeFactorsQ[n_Integer] := EvenQ[Length[FactorInteger[n]]]
In[]:=
(* remove the pixels that satisfy hideCriteria *)ClearAll[pixelMask]pixelMask[{w_, h_}, hideCriteria_, opts:OptionsPattern[]] := Module[ {data = Table[Table[0, w], h], indexes, xQfnc, yQfnc, hideIndexes, whiteOut, res}, indexes = Outer[List, Range[h], Range[w]]; {xQfnc, yQfnc} = If[MatchQ[hideCriteria, {_, _}], hideCriteria, Flatten[{hideCriteria, hideCriteria}][[;;2]] ]; hideIndexes = Position[indexes /. {x_Integer, y_Integer} :> {xQfnc[x], yQfnc[y]}, {False, False}]; res = ReplacePart[data, hideIndexes -> 1]; ArrayPlot[res, ImageSize->200, Frame->None, PlotRangePadding->None, opts]]
In[]:=
(*exportimagestomanipulateinInkscape*){m1,m2,m3}=pixelMask[{w,h},#,ColorRules->{1->White,0->Black},ImageSize->{width,height},PlotRangePadding->0]&/@{PrimeQ,evenNumPrimeFactorsQ,EvenQ}
Out[]=
,
,
Layers
Layers
In[]:=
{c1,c2,c3}={Red,Blue,RGBColor[1,0.91,0.34]};{img1,img2,img3}=ImageRecolor[cake,Cyan#]&/@{c1,c2,c3}
Out[]=
,
,
In[]:=
(*whatlayerswilllooklike*){l1,l2,l3}=pixelMask[{w,h},#1,ColorRules->{1->White,0->Opacity[0,Black]},ImageSize->{width,height},Background->Opacity[0,Black],PlotRangePadding->0,Prolog->Inset[#2,{0,0},{Left,Bottom},{w,h},BaseStyle->{Background->None}]]&@@@{{PrimeQ,img1},{evenNumPrimeFactorsQ,img2},{EvenQ,img3}}
Out[]=
,
,