[GRASSLIST:8702] Re: GRASS, Tcl/Tk, Xlib and Cygwin problem !

Richard Greenwood richard.greenwood at gmail.com
Wed Oct 19 22:38:45 EDT 2005


On 10/19/05, Shura <shura01 at gmail.com> wrote:
> Hi,
>
> We would like to move a graphic application from Linux to Windows,
> using Cygwin (newest version).
> The application uses GRASS features.
>
> It's written in C and Tcl/Tk, and it uses Xlib.
>
> The interface and the windows are built in Tcl/Tk. There is also a
> linkage between an Object, and some commands, developed in C, wich can
> be used by Tcl/Tk.
> The display module uses C and Xlib.
>
> It works fine under Linux .
>
> But with Cygwin, with natives Tcl/Tk librairies, the application can't
> display RASTER files in the window (drawable). It crashes at
> XPutImage(), just after XPutPixel().
>
> If I do :
> printf("XPutPixel() : %d\n",XPutPixel(ximage, numPixelH,
> 0,rcolor_ptr[cell[numCol[numPixelH]] + layer->translate]));
> it returns 0 on Cygwin, but it returns 1 on Linux.
>
> So it seems to be a problem with the XPutPixel function.
>
> Some parts of the code :
>
> [...]
> // creation of XImage structure
> XImage *ximage;
> ximage = XCreateImage(Tk_Display(view->tkwin), Tk_Visual(view->tkwin),
>                         Tk_Depth(view->tkwin), ZPixmap,
>                         0,imdata, width, 1,8 * sizeof(unsigned int), 0);
>
> [...]
> // Pixel color definition
> XPutPixel(ximage, numPixelH, 0,rcolor_ptr[cell[numCol[numPixelH]] +
> layer->translate]);
>
> [...]
>
> XPutImage(Tk_Display(view->tkwin),Tk_WindowId(view->tkwin),view->gc,
> ximage,xstart,0,beginX + xstart,beginY + j,xwidth,1);
>
> [...]
>
> The arguments of these functions are OK (good values).
>
> I both tried XGetPixel() under linux and Cygwin to get the value
> returned by XPutPixel(), and it's OK (same values, an hexadecimal
> color).
>
> If we compile the Tcl/Tk sources for unix (v8.4.8), with some
> modifications, under Cygwin, RASTER files are displayed if we run the
> X server of Cygwin ($ X -multiwindow)
>
> Is it a Tcl/Tk lib problem ? (Cygwin support has been dropped in
> recent Tcl/Tk releases)
>
> Is it a XPutPixel() / XPutWindow() error ?


Have you tested with the "grass specific" Tcl/Tk version at:
   http://geni.ath.cx/grass.html#toc6
Actually this Tcl/Tk version would be better described as "not Windows
specific".

Regards,
--
Richard Greenwood
richard.greenwood at gmail.com
www.greenwoodmap.com




More information about the grass-user mailing list