[GRASSLIST:8686] GRASS, Tcl/Tk, Xlib and Cygwin problem !
Shura
shura01 at gmail.com
Wed Oct 19 03:41:18 EDT 2005
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 ?
Thanks for your help !
More information about the grass-user
mailing list