[PATCH] fix "write" of "smooth" style image in postscript format

4 views
Skip to first unread message

Qian Yun

unread,
Apr 17, 2024, 9:03:42 AM4/17/24
to fricas-devel
vp := draw(x*y,x=0..1,y=0..1,style=="smooth")
write(vp, "t1", "postscript")

Then check "t1.VIEW/fricas3D.ps", you'll see only axes there.

After this patch, there will be black and white image. (this is
another bug.)

However, if you save the image by clicking buttons in
the control panel, you can have the black and white image.

As you can see that in process3d.c (responsible for the button
to save PS file):

redoSmooth = yes;
drawViewport(PSoption); /* draw picture in PS; create ps script
file */

- Qian

diff --git a/src/graph/view3D/write3d.c b/src/graph/view3D/write3d.c
index ac5a1210..9ccd4c32 100644
--- a/src/graph/view3D/write3d.c
+++ b/src/graph/view3D/write3d.c
@@ -199,6 +199,7 @@ writeViewport (int thingsToWrite)
"/fricas3D.ps");
if (PSInit(viewport->viewWindow,viewport->titleWindow) ==
psError)
return(-1);
+ redoSmooth = yes;
drawViewport(PSoption); /* write new script file in /tmp */
if (PSCreateFile(viewBorderWidth,viewport->viewWindow,
viewport->titleWindow, viewport->title) ==
psError)

Waldek Hebisch

unread,
Apr 21, 2024, 1:13:16 PM4/21/24
to fricas...@googlegroups.com
On Wed, Apr 17, 2024 at 09:03:38PM +0800, Qian Yun wrote:
> vp := draw(x*y,x=0..1,y=0..1,style=="smooth")
> write(vp, "t1", "postscript")
>
> Then check "t1.VIEW/fricas3D.ps", you'll see only axes there.
>
> After this patch, there will be black and white image. (this is
> another bug.)

That is good. Just two comments:
- in the patch 'redoSmooth' is incorrectly indented, that may
indicate tab (which we do not want).
- It makes sense to keep various graphics fixes together and
do not split them into several tiny commit. In particular
there is significant duplication and almost duplication in
the code, so there is good chance that fix for one problem
is also applicable in different place (or at least suggests
a solution). Smaller number of bigger commits makes search
to chanes easier.

> However, if you save the image by clicking buttons in
> the control panel, you can have the black and white image.
>
> As you can see that in process3d.c (responsible for the button
> to save PS file):
>
> redoSmooth = yes;
> drawViewport(PSoption); /* draw picture in PS; create ps script file
> */
>
> - Qian
>
> diff --git a/src/graph/view3D/write3d.c b/src/graph/view3D/write3d.c
> index ac5a1210..9ccd4c32 100644
> --- a/src/graph/view3D/write3d.c
> +++ b/src/graph/view3D/write3d.c
> @@ -199,6 +199,7 @@ writeViewport (int thingsToWrite)
> "/fricas3D.ps");
> if (PSInit(viewport->viewWindow,viewport->titleWindow) == psError)
> return(-1);
> + redoSmooth = yes;
> drawViewport(PSoption); /* write new script file in /tmp */
> if (PSCreateFile(viewBorderWidth,viewport->viewWindow,
> viewport->titleWindow, viewport->title) ==
> psError)
>
> --
> You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/fricas-devel/28e84d63-3d81-4be9-b89d-61501723828d%40gmail.com.

--
Waldek Hebisch
Reply all
Reply to author
Forward
0 new messages