Slashdot Mirror


A PostScript-like API for the X Render Extension

Pivot writes: "Carl Worth and Keith Packard have started building a PostScript-like API for drawing using the X Render extension. There are two modules, called 'Xr' (the "rendering part") and 'Xc' (the "compositing part", which is a layer on top of Render which will eventually grow to a client-side Render emulator). The API supports only cubic Bezier splines, leaving other splines out of the library, similar to PostScript. Check out the initial announcement on the Render mailing list, and some example shots. Shurely this will remind some of NeWS, cowritten by another well known character."

3 of 193 comments (clear)

  1. beziers by siokaos · · Score: 4, Informative

    it's amazing that a mathemetician (two actually, decasteljau and bezier) came up with bezier curves to assist designing automobiles. their power is so incredible, like in this instance, they are still very common today.

    the decasteljau algorithm for determining what points on a bezier curve are is quite simple. the bezier curve takes four input XY pairs (p0,1,2,and 3), which is why they're called cubic beziers, as opposed to the similar three pointed quadratic spline (like the directional arrows on some atlases). anyways, getting back to the algorithm:

    ;check distance between p0 and p3
    ;if distance>threshold, print values

    ;Compute p01. (p0+p1)/2

    ;Compute p12. (p1+p2)/2

    ;Compute p23. (p2+p3/2)

    ;Compute P012 (p01+p12)/2

    ;Compute P123 (p12+p23)/2

    ;Compute P0123. (P012+P123)/2

    ;call DeCasteljau (p0,p01,p012,p0123)

    ;call DeCasteljau (p0123,p123,p23,p3)
    --
    so basically, one generates two pairs (left and right) of points, and a recursive call is made with each.
    .
    the implications of such a simple yet elegant system in 3d beziers is amazing. this site has many resources : http://www.daimi.au.dk/~mbl/cgcourse/wiki/curves_a nd_surfaces.html

    you may also want to check out
    http://www-unix.oit.umass.edu/~verts/software /software.html#BEZIER

    "bezeier madness", a beautiful bezier design program that 0wns windows paint.

    --
    http://siokaos.org/
  2. I hope this have a better fate by Per+Abrahamsen · · Score: 5, Informative

    There have been several attempts based on GhostScript to produce a real postscript API for X11.

  3. Re:Goals and intentions? by keithp · · Score: 5, Informative
    The email is pretty technical, and doesn't give any idea of what their goals are. Is this just fiddling around for the fun of it, or are they thinking about introducing a new extension for mainstream use?

    The Render extension is designed to replace the core X rendering model for general purpose applications. Its most visible effect today is the presence of anti-aliased text in Qt and Gtk+ 2.0 applications. However, the extension is more than just AA text; it provides a complete alternative to all of the existing rendering code using colors instead of pixel values and image compositing operators instead of boolean raster ops. It's a standard part of XFree86 today and future XFree86 releases will see the remaining parts of the extension fleshed out.

    Render is designed to offer the minimal extension necessary to take advantage of modern hardware acceleration. For geometric objects, the work of breaking it into primitive shapes is done on the client side of the wire; the only thing the server does is draw trapezoids (or triangles). Render is based on image compositing so it provides translucent images as well as anti-aliased objects.

    Once the extension had progressed to a point where anti-aliased text was possible, I got side tracked for a year dealing with the repercussions of client-side font support. I've recently drafted Carl to help get the graphics pieces finished. He and I implemented the fundamental geometric primitive (the trapezoid) a few months ago and now we're starting to build more complex shapes based on that. As those pieces are all done in the client, we're building the Xr and Xc libraries to provide them.

    Xr and Xc will likely become a part of XFree86 once they're a bit further along in development. Carl has plans to port Qt to Xr to replace the graphics operations in that toolkit, we'll see if we can't get TrollTech to pick up those changes much as they picked up the Xft changes last year. Gtk+ already has a relatively sophisticated rendering engine; I'm not sure what part Xr/Xc have to play in that environment.