vectorgraphics / asymptote

2D & 3D TeX-Aware Vector Graphics Language
https://asymptote.sourceforge.io/
GNU General Public License v3.0
547 stars 90 forks source link

opacity crashes Ghostscript 9.27 #299

Closed transientsolutions closed 2 years ago

transientsolutions commented 2 years ago

This example with opacity crashes Ghostscript when running as

asy -f pdf test.asy
Error: /undefined in .setfillconstantalpha
Operand stack:
![testcrash](https://user-images.githubusercontent.com/17047309/151345400-86558d75-2e23-4823-b8e5-1288c1958261.png)
![testcrash](https://user-images.githubusercontent.com/17047309/151345560-3
![testcrash](https://user-images.githubusercontent.com/17047309/151346003-83b697ff-03b4-48ee-a61e-a1737314aaff.png)
253880b-233a-43d2-8142-7590244e8d6b.png)

   0.5
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   199
2   1   3   %oparray_pop   1991   1   3   %oparray_pop   1990   1   3   %oparray_pop   --nostringval--   1979   1   3   %oparray_pop   1833   1   3   %oparray_pop   --nostringval--   %error
exec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--
Dictionary stack:
   --dict:734/1123(ro)(G)--   --dict:0/20(G)--   --dict:106/200(L)--   --dict:106/300(L)--   --dict:43/200(L)--
Current allocation mode is local
Current file position is 77575
GPL Ghostscript 9.27: Unrecoverable error, exit code 1
  _shipout(prefix,f,currentpatterns,format,wait,view,t);
          ^
C:\Program Files\Asymptote/plain_shipout.asy: 116.11: runtime: shipout failed

Option -noGPUindexing does not help. Configuration: asymptote 2.74 64 bit Windows 7 GPL Ghostscript 9.27

Working with another configuration is ok: asymptote ver. 2.75 64 bit Windows 10 GPL Ghostscript 9.55.0

An example:

import graph;

size(4cm,0);
defaultpen(fontsize(8pt));

pair O = (0,0);
pair A=(cos(pi/4),sin(pi/4));
pair B=(cos(3*pi/4),sin(3*pi/4));
pair C=(cos(pi/4),-sin(pi/4));
pair D=(cos(3*pi/4),-sin(3*pi/4));

path Okr = circle(O,1);
path Obl1 = buildcycle(A -- O -- C, arc(O,C,A));
path Obl2 = buildcycle(B -- O -- D, arc(O,B,D));

fill(Obl1,mediumgray+opacity(0.5));
fill(Obl2,mediumgray+opacity(0.5));

draw(Okr);

draw(A--O--C);
draw(B--O--D);

dot(A,filltype=FillDraw(white,black));
dot(B);
dot(D,filltype=FillDraw(white,black));
dot(C);

label("$O$",O,SW);
label("$\frac{\pi}{4}$",A,NE);
label("$\frac{3}{4}\pi$",B,NW);
label("$-\frac{\pi}{4}$",C,SE);
labe
![test-crash](https://user-images.githubusercontent.com/17047309/151346284-01a16056-ac95-4885-89af-ed56c9f0ddbb.png)
l("$-\frac{3}{4}\pi$",D,SW);

xaxis("$x$",xmax=1.2,xmin=-1.2,arrow=Arrow);
yaxis("$y$",ymax=1.2,ymin=-1.2,arrow=Arrow);

testcrash

johncbowman commented 2 years ago

Please upgrade to Ghostscript 9.55. If you like, complain to the Ghostscript developers for the lack of backwards compatibility.