[winGRASS] libG11

Mike Thomas miketh at brisbane.paradigmgeo.com
Thu Oct 4 00:53:19 EDT 2001


Hi all.

OK - Here is the fixed "XFillPolygon()", including a beefed up comment from
SGI man page.

Attached is another screenshot ("d.colortable geology" followed by "d.legend
geology") which to me does not seem right - I would have expected all of the
colors which appear in the "d.legend" output to have appeared in the
"d.colortable" output.

Regards

Mike Thomas.


/*****************************************************************\

 Function: XFillPolygon
 Inputs:   display, window, gc, points list, number of points,
    shape hint, relative drawing mode.

 Comments: Works for convex polygons.  Untested on otherwise.
           Optimisation hints are unused, as is the mode.

     XFillPolygon fills the region closed by the specified path.
     The path is closed automatically if the last point in the
     list does not coincide with the first point.  XFillPolygon
     does not draw a pixel of the region more than once.  Coord-
     ModeOrigin treats all coordinates as relative to the origin,
     and CoordModePrevious treats all coordinates after the first
     as relative to the previous point.


\*****************************************************************/

int
XFillPolygon(display,w,gc,points,nps,shape,mode)
Display *display;
Drawable w;
GC gc;
XPoint *points;
int nps,shape,mode;
{
 HBRUSH hbrush;
 int n;
 POINT ntps[1000];
 HDC hDC;
 HANDLE oldObj;
 xtrace("XFillPolygon\n");
 if (VALID_WINDOW(w))
 {
  hDC = drawableGetDC(w);
  hbrush = NT_get_GC_brush(hDC,gc);
  oldObj = SelectObject(hDC,hbrush);
  for (n=0;n<nps;++n)
  {
                        if ( ( mode == CoordModeOrigin ) ||
                             ( 0 == n ) )
                            {
                                (ntps+n)->x=(LONG)(points+n)->x;
                                (ntps+n)->y=(LONG)(points+n)->y;
                            }
                        else
                            {

(ntps+n)->x=(LONG)(points+n)->x+(ntps+n-1)->x;

(ntps+n)->y=(LONG)(points+n)->y+(ntps+n-1)->y;
                            }
                    }
  Polygon(hDC,ntps,nps);
  SelectObject(hDC, oldObj);
  drawableRelDC(w,hDC);
 }

 return 0;
}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: colortable_legend_geology.png
Type: image/png
Size: 8525 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-windows/attachments/20011004/44b44eb9/colortable_legend_geology.png


More information about the grass-windows mailing list