[PATCH] fix pixel shape in PS output of "smooth" style image

7 views
Skip to first unread message

Qian Yun

unread,
May 16, 2024, 6:46:27 AM5/16/24
to fricas-devel
The 3D "smooth" style image is rasterization.

You can see the exported pixmap format is made up of pixels.
(Which corresponding to the pixels on display screen.)

For the exported PS format though, it is a bit strange:

If you zoom in, you can find it is not made up of square pixels,
but slant rectangle pixels.

I don't think this is some kind of dithering technique,
this is a bug: the code draws from (x,y) to (x+1,y+1),
resulting overlapping slant rectangle pixels,
while simply draw from (x,y) to (x+1,y) will resulting
square pixels.

You can see the attachment for comparison.

- Qian

diff --git a/src/graph/Gdraws/Gfun.c b/src/graph/Gdraws/Gfun.c
index 4206d731..4ae995d1 100644
--- a/src/graph/Gdraws/Gfun.c
+++ b/src/graph/Gdraws/Gfun.c
@@ -491,7 +491,7 @@ GDrawPoint(

psData[drawpointps].flag = yes; /* sets procedure flag */
fprintf(fp, "\t%d\t%d\t%d\t%d\tpsDrawPoint\n",
- x0, y0, x0 + 1, y0 + 1);
+ x0, y0, x0 + 1, y0);
s = fclose(fp);
}
break;
smooth-new.pdf
smooth-old.pdf

Waldek Hebisch

unread,
May 17, 2024, 9:09:13 AM5/17/24
to fricas...@googlegroups.com
On Thu, May 16, 2024 at 06:46:16PM +0800, Qian Yun wrote:
> The 3D "smooth" style image is rasterization.
>
> You can see the exported pixmap format is made up of pixels.
> (Which corresponding to the pixels on display screen.)
>
> For the exported PS format though, it is a bit strange:
>
> If you zoom in, you can find it is not made up of square pixels,
> but slant rectangle pixels.
>
> I don't think this is some kind of dithering technique,
> this is a bug: the code draws from (x,y) to (x+1,y+1),
> resulting overlapping slant rectangle pixels,
> while simply draw from (x,y) to (x+1,y) will resulting
> square pixels.
>
> You can see the attachment for comparison.

I am not so sure. I think that you were not supposed to see
shape of pixels. And at least in old technology pixels were
round.

I did not look at relevant code, but IIRC some graphic texts
mentioned "smoothing" by adding noise-like irregularities.
If "smoothing" is understood in such sense, then square
pixels go against this spirit and slant may be deliberate.
Or possibly orginal author experimented with various effects
and added what looked good to him -- different thing may look
good to other folks (and there is also change of technology).



--
Waldek Hebisch

Ralf Hemmecke

unread,
May 17, 2024, 3:48:40 PM5/17/24
to fricas...@googlegroups.com
> I did not look at relevant code, but IIRC some graphic texts
> mentioned "smoothing" by adding noise-like irregularities.
> If "smoothing" is understood in such sense, then square
> pixels go against this spirit and slant may be deliberate.
> Or possibly orginal author experimented with various effects
> and added what looked good to him -- different thing may look
> good to other folks (and there is also change of technology).

Ideally our graphics code should produce a vector graphic, but that's
probably to huge a change for now.

Ralf
Reply all
Reply to author
Forward
0 new messages