Skip to main content
4 of 4
edited tags
xzczd
  • 68.4k
  • 9
  • 174
  • 489

Custom Graphics primitives can't work with parallel Rasterize

I tried to create Graphics primitives using the techniques in this, found problems with parallel rasterization

SetAttributes[createPrimitive,HoldAll];

createPrimitive[patt_,expr_]:=Typeset`MakeBoxes[p:patt,fmt_,Graphics]:=Typeset`MakeBoxes[Interpretation[expr,p],fmt,Graphics];

createPrimitive[face[x_:0.1],{Circle[{0,0},1],Circle[{-0.3,0.5},x],Circle[{0.3,0.5},x],Line[{{-0.4,-0.2},{0.4,-0.2}}]}];

ParallelTable[Graphics[{face[i]},ImageSize->Tiny],{i,0,0.3,0.3/5}]
ParallelTable[Rasterize@Graphics[{face[i]},ImageSize->Tiny],{i,0,0.3,0.3/5}]

enter image description here

Is there any way to fix this?

expression
  • 5.7k
  • 1
  • 20
  • 47