Update of /project/mcclim/cvsroot/mcclim/Backends/gtkairo In directory clnet:/tmp/cvs-serv14010/Backends/gtkairo
Modified Files: cairo.lisp ffi.lisp Log Message:
With Robert Strandh's permission, move gsharp/bezier.lisp into McCLIM. All symbols are still in the CLIMI package and undocumented, but should ultimately move into CLIME or a new package.
Try CLIM-FIG or gsharp to test.
* NEWS: updated. * mcclim.asd (CLIM-BASIC): Depend on flexichain. Added bezier.lisp * bezier.lisp: New file, from gsharp. Postscript methods taken out. * Backends/PostScript/graphics.lisp (MEDIUM-DRAW-BEZIER-DESIGN*): New methods, from gsharp/bezier.lisp. * Backends/gtkairo/cairo.lisp (MEDIUM-DRAW-BEZIER-DESIGN*): New methods.
* Backends/gtkairo/ffi.lisp: regenerated. * Examples/clim-fig.lisp (DRAW-FIGURE, HANDLE-DRAW-OBJECT): Added a bezier drawing mode.
--- /project/mcclim/cvsroot/mcclim/Backends/gtkairo/cairo.lisp 2006/12/26 12:11:04 1.1 +++ /project/mcclim/cvsroot/mcclim/Backends/gtkairo/cairo.lisp 2006/12/26 16:44:46 1.2 @@ -703,3 +703,51 @@ design (draw-design medium background) (draw-design medium foreground)))) + + +;;;; Bezier support + +(defmethod climi::medium-draw-bezier-design* + ((medium cairo-medium) (design climi::bezier-area)) + (with-medium (medium) + (sync-sheet medium) + (sync-transformation medium) + (sync-ink medium (medium-ink medium)) + (sync-clipping-region medium (medium-clipping-region medium)) + (sync-line-style medium (medium-line-style medium)) + (with-slots (cr) medium + (let ((p0 (slot-value (car (climi::segments design)) 'climi::p0))) + (cairo_move_to cr (df (point-x p0)) (df (point-y p0)))) + (dolist (segment (climi::segments design)) + (with-slots (climi::p1 climi::p2 climi::p3) segment + (cairo_curve_to cr + (df (point-x climi::p1)) (df (point-y climi::p1)) + (df (point-x climi::p2)) (df (point-y climi::p2)) + (df (point-x climi::p3)) (df (point-y climi::p3))))) + (cairo_fill cr)))) + +(defmethod climi::medium-draw-bezier-design* + ((medium cairo-medium) (design climi::bezier-union)) + (dolist (area (climi::areas design)) + (climi::medium-draw-bezier-design* medium area))) + +(defmethod climi::medium-draw-bezier-design* + ((medium cairo-medium) (design climi::bezier-difference)) + (dolist (area (climi::positive-areas design)) + (climi::medium-draw-bezier-design* medium area)) + (with-drawing-options (medium :ink +background-ink+) + (dolist (area (climi::negative-areas design)) + (climi::medium-draw-bezier-design* medium area)))) + +(defmethod climi::medium-draw-bezier-design* + ((medium cairo-medium) (design climi::translated-bezier-design)) + (let ((tx (climi::translation design))) + (setf tx + ;; + ;; FIXME: needed for gsharp, doesn't make sense to me + ;; + (compose-transformations tx (medium-transformation medium))) + (climi::medium-draw-bezier-design* medium + (climi::really-transform-region + tx + (climi::original-region design))))) --- /project/mcclim/cvsroot/mcclim/Backends/gtkairo/ffi.lisp 2006/12/25 19:55:11 1.14 +++ /project/mcclim/cvsroot/mcclim/Backends/gtkairo/ffi.lisp 2006/12/26 16:44:46 1.15 @@ -317,6 +317,11 @@ (arg4 :pointer) ;double * )
+(defcfun "cairo_fill_preserve" + :pointer + (arg0 :pointer) ;cairo_t * + ) + (defcfun "cairo_font_extents" :void (arg0 :pointer) ;cairo_t * @@ -672,6 +677,11 @@ (arg0 :pointer) ;cairo_t * )
+(defcfun "cairo_stroke_preserve" + :void + (arg0 :pointer) ;cairo_t * + ) + (defcfun "cairo_stroke_extents" :void (arg0 :pointer) ;cairo_t *