Currently we get mono color in postscript output of "smooth" style
3D drawings.
That's caused by "GSetForeground" before "GDrawPoint".
"GSetForeground" can only set gray scale.
Luckily the all four usage of "GDrawPoint" are all for the purpose
of generating "smooth" style image. So this change will not break
anywhere else.
So I decode color and use "setrgbcolor" for it and remove
"installGC" from "drawpoint.ps" because that's responsible for
setting the grey color.
- Qian
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/fricas-devel/32851d37-cad8-4a06-a69f-aa5090c07325%40gmail.com.
diff --git a/src/graph/Gdraws/Gfun.c b/src/graph/Gdraws/Gfun.c
index a4a3bb01..6fd0116d 100644
--- a/src/graph/Gdraws/Gfun.c
+++ b/src/graph/Gdraws/Gfun.c
@@ -425,6 +425,7 @@ int
GDrawPoint(
Window wid, /* window id */
GC gc, /* graphics context */
+ int color, /* color is represented as 0xRRGGBB */
int x0, int y0, int dFlag)
{
int s = 0;
@@ -444,8 +445,14 @@ GDrawPoint(
}
psData[drawpointps].flag = yes; /* sets procedure flag */
- fprintf(fp, "\t%s\t%d\t%d\t%d\t%d\tpsDrawPoint\n",
- PSfindGC(gc), x0, y0, x0 + 1, y0 + 1);
+
+ float r = ((color & 0xFF0000) >> 16) / 255.0;
+ float g = ((color & 0x00FF00) >> 8) / 255.0;
+ float b = (color & 0x0000FF) / 255.0;
+ fprintf(fp, "\t%f\t%f\t%f\tsetrgbcolor\n", r, g, b);
+ fprintf(fp, "\t%d\t%d\t%d\t%d\tpsDrawPoint\n",
+ x0, y0, x0 + 1, y0 + 1);
+
s = fclose(fp);
}
break;
diff --git a/src/graph/Gdraws/ps_files/drawpoint.ps b/src/graph/Gdraws/ps_files/drawpoint.ps
index 1850f08a..1981e1ad 100644
--- a/src/graph/Gdraws/ps_files/drawpoint.ps
+++ b/src/graph/Gdraws/ps_files/drawpoint.ps
@@ -3,7 +3,7 @@
newpath
yVal moveto
yVal lineto
- begin installGC stroke end %%fills with foreground color
+ stroke
grestore }
def
diff --git a/src/graph/include/Gfun.H1 b/src/graph/include/Gfun.H1
index b3993d99..702ce7be 100644
--- a/src/graph/include/Gfun.H1
+++ b/src/graph/include/Gfun.H1
@@ -5,7 +5,7 @@ extern int GDrawImageString(GC, Window, int, int, char *, int, int);
extern int GDrawArc(GC, Window, int, int, unsigned int, unsigned int, int, int, int);
extern int GDrawLine(GC, Window, int, int, int, int, int);
extern int GDrawLines(GC, Window, XPoint *, int, int, int);
-extern int GDrawPoint(Window, GC, int, int, int);
+extern int GDrawPoint(Window, GC, int, int, int, int);
extern int GDrawString(GC, Window, int, int, char *, int, int);
extern int GFillArc(GC, Window, int, int, unsigned int, unsigned int, int, int, int);
extern int PSGlobalInit(void);
diff --git a/src/graph/view3D/smoothShade3d.c b/src/graph/view3D/smoothShade3d.c
index 51761863..7e80157a 100644
--- a/src/graph/view3D/smoothShade3d.c
+++ b/src/graph/view3D/smoothShade3d.c
@@ -133,7 +133,7 @@ drawPhongSpan(triple pt,float N[3],int dFlag)
put_cBuffer_axes(xpixel,'0');
put_zBuffer(xpixel,zC);
/* if mono (bw dsply) do black and white semi-random dithering */
- if (mono || (dFlag == PSoption) || viewport->monoOn) {
+ if (mono || viewport->monoOn) {
if (get_random() < 100.0*exp((double)-1.3*(pi_sq*(col-.2)*(col-.2)))) {
put_cBuffer_indx(xpixel,black);
} else {
@@ -649,8 +649,8 @@ scanLines(int dFlag)
else pixColor = boxInline;
if (i >=0 && i<vwInfo.width) XPutPixel(imageX,i,0,pixColor);
} else {
- GSetForeground(GC9991, psBlack, dFlag );
- GDrawPoint(viewport->viewWindow, GC9991, i,scanline,dFlag);
+ GDrawPoint(viewport->viewWindow, GC9991,
+ (int) psBlack, i, scanline, dFlag);
}
}
}
@@ -662,8 +662,8 @@ scanLines(int dFlag)
else pixColor = clipBoxInline;
if (i >=0 && i<vwInfo.width) XPutPixel(imageX,i,0,pixColor);
} else {
- GSetForeground(GC9991, psBlack, dFlag );
- GDrawPoint(viewport->viewWindow, GC9991, i,scanline,dFlag);
+ GDrawPoint(viewport->viewWindow, GC9991,
+ (int) psBlack, i, scanline, dFlag);
}
}
}
@@ -675,8 +675,8 @@ scanLines(int dFlag)
else pixColor = monoColor(axesColor);
if (i >=0 && i<vwInfo.width) XPutPixel(imageX,i,0,pixColor);
} else {
- GSetForeground(GC9991,psBlack,dFlag);
- GDrawPoint(viewport->viewWindow, GC9991, i,scanline,dFlag);
+ GDrawPoint(viewport->viewWindow, GC9991,
+ (int) psBlack, i, scanline, dFlag);
}
} /* if buffer slot is an axes point */
tempA = get_cBuffer_axes(i);
@@ -689,8 +689,8 @@ scanLines(int dFlag)
if (i >=0 && i<vwInfo.width) XPutPixel(imageX,i,0,pixColor);
}
else {
- GSetForeground(GC9991,(float)get_cBuffer_indx(i),dFlag);
- GDrawPoint(viewport->viewWindow, GC9991, i,scanline,dFlag);
+ GDrawPoint(viewport->viewWindow, GC9991,
+ get_cBuffer_indx(i), i, scanline, dFlag);
}
}
} /* for each pixel in scanline */