[mcclim-cvs] CVS mcclim/Backends/PostScript

dlichteblau dlichteblau at common-lisp.net
Tue Dec 26 16:44:45 UTC 2006


Update of /project/mcclim/cvsroot/mcclim/Backends/PostScript
In directory clnet:/tmp/cvs-serv14010/Backends/PostScript

Modified Files:
	graphics.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/PostScript/graphics.lisp	2006/03/29 10:43:38	1.17
+++ /project/mcclim/cvsroot/mcclim/Backends/PostScript/graphics.lisp	2006/12/26 16:44:45	1.18
@@ -544,3 +544,39 @@
           (moveto* file-stream x y))
         (format file-stream "(~A) show~%" (postscript-escape-string string))))))
 
+
+;;; Bezier support
+
+(defmethod climi::medium-draw-bezier-design*
+    ((medium clim-postscript::postscript-medium) (design climi::bezier-area))
+  (let ((stream (clim-postscript::postscript-medium-file-stream medium))
+        (clim-postscript::*transformation* (sheet-native-transformation (medium-sheet medium))))
+    (clim-postscript::postscript-actualize-graphics-state stream medium :color)
+    (format stream "newpath~%")
+    (let ((p0 (slot-value (car (climi::segments design)) 'climi::p0)))
+      (clim-postscript::write-coordinates stream (point-x p0) (point-y p0))
+      (format stream "moveto~%"))
+    (loop for segment in (climi::segments design)
+          do (with-slots (climi::p1 climi::p2 climi::p3) segment
+               (clim-postscript::write-coordinates stream (point-x climi::p1) (point-y climi::p1))
+               (clim-postscript::write-coordinates stream (point-x climi::p2) (point-y climi::p2))
+               (clim-postscript::write-coordinates stream (point-x climi::p3) (point-y climi::p3))
+               (format stream "curveto~%")))
+    (format stream "fill~%")))
+
+(defmethod climi::medium-draw-bezier-design*
+    ((medium clim-postscript::postscript-medium) (design climi::bezier-union))
+  (dolist (area (climi::areas design))
+    (climi::medium-draw-bezier-design* medium area)))
+
+(defmethod climi::medium-draw-bezier-design*
+    ((medium clim-postscript::postscript-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 clim-postscript::postscript-medium) (design climi::translated-bezier-design))
+  (climi::medium-draw-bezier-design* medium (climi::really-transform-region (climi::translation design) (climi::original-region design))))




More information about the Mcclim-cvs mailing list