From: Petr M. <mi...@ph...> - 2023-06-16 08:16:43
|
> Oh, and two more notes, where the old code had off-by-one errors > > - There old code was set up to overlap each colorbox by extending the > bottom/right edge of each slice: GPMIN(xy_to,xy2+1) Please try also "set term postscript color" output to see what your pdf viewers do there. These "write stripes issue" and antialiasing was an issue two decades ago. It depended whether you have switched on or off antialising in the pdf/ps viewer. Hm, I see that current viewer do not have such an option any longer (even though ghostscript can be run with different options), so you cannot check the problem directly in the viewer. What you can try as the lowest-level approach is gs a.pdf gs -dDOINTERPOLATE a.pdf Pdf itself can manipulate antialiasing directly, such as 3 0 obj <</AntiAlias false>> but that's probably possible to insert directy in the poppler or cairo library? > - The old code was computing the colors for each slice like this: > > for (i = 0; i < steps; i++) > gray = i / (double)steps; > > This is another off-by-one error. The colors in the colorbox spanned > [0,1-1/steps] instead of [0,1]. My patch fixes this one. > > There's some funky logic in quanize_gray() that maybe is trying to > deal with this in the limited-max-colors case, but it's not commented, > and applies to only this case. Code: > > qgray = floor(gray * sm_palette.use_maxcolors) > / (sm_palette.use_maxcolors-1); The colorbox code must work correctly for limited number of colors, try set palette maxcolors 4 splot x*y with pm3d Thus I think the code is correct, if you see exactly 4 color boxes in the colorbox. --- Petr Mikulik |