Version 7 of XLEL

Updated 2008-05-13 07:51:43 by torsten

The Xlib Emulation Layer is Tk's traditional mechanism for factoring cross-platform support. Replacement of XLEL is, in one sense, the main aim of TkGS, a project initiated by Frederic Bonnet.

See [L1 ] for a discussion of the limitations and problems with the XLEL.


Lars H, 8 March 2007: I just encountered an awkward misfeature of this XLEL: Coordinates of lines drawn on the canvas will be rounded to integers! Sure enough, the canvas stores item coordinates as floats (doubles, even), and Aqua (or Quartz 2D [L2 ], if we're technical) thinks a point is a pair of floats too, but on its way from one to the other it has to pass through the Xlib Emulation Layer, and Xlib thinks a point is a pair of integers (shorts, even), so any subpixel precision is lost.

While this is not a show-stopper, it does put some restrictions on the kind of things one can do on the canvas. It is probably also relevant for any discussion of antialiasing in Tk, but I don't know whether it would be pro or con...

DKF: Neutral for font rendering; we don't render individual characters but rather segments of text (i.e. all in the same font/color/style).


PT 15-Sep-2003: Tk implements the following Xlib functions, which constitute the XLEL. These functions are in the xlib subdirectory of the Tk distribution. They map to corresponding functions on the different platforms and the original Xlib functions on systems using X11:

 xbytes.c: (defines a table to reverse bit order of bytes)

 xcolors.c: (contains the routines used to map from X color names to RGB and pixel values, all colors used by Tk are defined here)
   XParseColor
   FindColor (not an Xlib function)

 xdraw.c:
   XDrawLine -> maps to macosx/tkMacOSXDraw.c and win/tkWinDraw.c (called XDrawLines there) 
   XFillRectangle -> maps to macosx/tkMacOSXDraw.c and win/tkWinDraw.c (called XFillRectangles there)

 xgc.c: (contains generic routines for manipulating X graphics)
   XCreateGC
   XChangeGC
   XFreeGC
   XSetForeground
   XSetBackground
   XSetDashes
   XSetFunction
   XSetFillRule
   XSetFillStyle
   XSetTSOrigin
   XSetFont
   XSetArcMode
   XSetStipple
   XSetLineAttributes
   XSetClipOrgin
   TkSetRegion
   XSetClipMask
   XCreateFontCursor /* not implemented */
   XDrawImageString  /* not implemented */
   XDrawPoint
   XDrawSegments /* not implemented */
   XFetchBuffer /* not implemented */
   XFetchName /* not implemented */
   XListProperties /* not implemented */
   XMapRaised /* not implemented */
   XPutImage /* not implemented */
   XQueryTextExtents /* not implemented */
   XReparentWindow /* not implemented */
   XRotateBuffers /* not implemented */
   XStoreBuffer /* not implemented */
   XUndefineCursor /* not implemented */

 ximage.c: (contains X bitmap and image routines)
   XCreateBitmapFromData

 xutil.c: (contains generic X emulation routines)
   XInternAtom
   XGetVisualInfo