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 [http://wiki.tcl.tk/12673] for a discussion of the limitations and problems with the XLEL. See [http://tronche.com/gui/x/xlib/] for an XLib manual and [http://tronche.com/gui/x/xlib/function-index.html] for a complete Xlib function index. ---- [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 ([double]s, even), and [Aqua] (or Quartz 2D [http://developer.apple.com/referencelibrary/GraphicsImaging/idxQuartz-date.html], 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 [antialias]ing 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). ---- **Functions in XLEL** [PT] 15-Sep-2003: Tk implements the following Xlib functions, which constitute the [XLEL]. Some 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. Other functions reside in the platform's subdirectories and the 'generic' subdirectory. Note, the functions in the 'mac' directory are no longer supported/included in Tk 8.5. xlib/xbytes.c: (defines a table to reverse bit order of bytes) xlib/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) xlib/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) xlib/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 */ xlib/ximage.c: (contains X bitmap and image routines) XCreateBitmapFromData xlib/xutil.c: (contains generic X emulation routines) XInternAtom XGetVisualInfo win/tkWinDraw.c | macosx/tkMacOSXDraw.c | mac/tkMacDraw.c: XCopyArea XCopyPlane XDrawLines (mapped from xlib/xdraw.c) XDrawSegments (only macosx and mac) XFillPolygon XDrawRectangle XDrawRectangles (only macosx) XFillRectangles (mapped from xlib/xdraw.c) * XDrawArc XDrawArcs (only macosx) XFillArc XFillArcs (only macosx) XMaxRequestSize (only macosx) (Hmm, XFillArcs and XDrawArcs are never called anywhere in the core. Why are they there??) generic/tkPointer.c: XGrabPointer XUngrabPointer XDefineCursor mac/tkMacKeyboard.c: XKeycodeToKeysym XGetModifierMapping XFreeModifiermap XKeysymToString XStringToKeysym XKeysymToKeycode mac/tkMacSubwindows.c: XDestroyWindow XMapWindow XUnmapWindow XResizeWindow XMoveResizeWindow XMoveWindow XRaiseWindow XConfigureWindow mac/tkMacWindowMgr.c: XSetInputFocus XGrabKeyboard XUngrabKeyboard XQueryPointer macosx/tkMacOSXKeyboard.c: XKeycodeToKeysym XGetModifierMapping XFreeModifiermap XKeysymToString XStringToKeysym XKeysymToMacKeycode (only macosx; not an Xlib function) XKeysymToKeycode macosx/tkMacOSXKeyEvent.c: XGrabKeyboard XUngrabKeyboard macosx/tkMacOSXMouseEvent.c: XQueryPointer macosx/tkMacOSXSubwindows.c | win/tkWinWindow.c: XDestroyWindow XMapWindow XUnmapWindow XResizeWindow XMoveResizeWindow XMoveWindow XRaiseWindow XLowerWindow (only macosx) XConfigureWindow XClearWindow (only win) XChangeWindowAttributes (only win) macosx/tkMacOSXWm.c: XSetInputFocus macosx/tkMacOSXXStubs.c | win/tkWinImage.c: XCreateImage XGetImage XGetImageZPixmap (only win; not an Xlib function) win/tkWinColor.c: XAllocColor XFreeColors XCreateColormap XFreeColormap win/tkWinPixmap.c: XGetGeometry win/tkWinPointer.c: XGrabKeyboard XUngrabKeyboard XQueryPointer XWarpPointer XGetInputFocus XSetInputFocus win/tkWinX.c: XBell <> Tk Library | Glossary