[gsharp-cvs] CVS gsharp

rstrandh rstrandh at common-lisp.net
Thu Jun 1 18:57:40 UTC 2006


Update of /project/gsharp/cvsroot/gsharp
In directory clnet:/tmp/cvs-serv5096

Modified Files:
	bezier.lisp fontview.lisp sdl.lisp 
Log Message:
Fixed a bug in bezier.lisp that made the resulting pixmap positioned 
in the wrong place sometimes. 

Fixed a bug in sdl.lisp that computed the wrong xoffset (in particular
for noteheads). 

Fixed the whole notehead so that its vertical position is not offset
as it should. 

Fixed the C clef so that it no longer goes below the bottom line.

Improved the font viewer by having the bounding box of the glyph drawn
in :pixel mode. 




--- /project/gsharp/cvsroot/gsharp/bezier.lisp	2006/06/01 04:55:37	1.3
+++ /project/gsharp/cvsroot/gsharp/bezier.lisp	2006/06/01 18:57:40	1.4
@@ -703,6 +703,8 @@
 (defun render-through-pixmap (design medium positive-areas negative-areas)
   (multiple-value-bind (min-x min-y)
       (bounding-rectangle* design)
+    (setf min-x (floor min-x)
+	  min-y (floor min-y))
     (let ((pixmap (gethash (list (medium-sheet medium) (resolve-ink medium) design)
 			   *pixmaps*)))
       (when (null pixmap)
--- /project/gsharp/cvsroot/gsharp/fontview.lisp	2006/06/01 04:55:37	1.2
+++ /project/gsharp/cvsroot/gsharp/fontview.lisp	2006/06/01 18:57:40	1.3
@@ -9,9 +9,9 @@
   ((font :initform (make-instance 'sdl::font :staff-line-distance 6))
    (shape :initform :g-clef)
    (grid :initform t)
-   (staff :initform nil)
+   (staff :initform t)
    (staff-offset :initform 0)
-   (view :initform :pixel)
+   (view :initform :antialiased)
    (zoom :initform 1)
    (hoffset :initform 300)
    (voffset :initform 300))
@@ -72,6 +72,24 @@
 		    do (draw-rectangle* pane x -300 (1+ x) 300 :ink +blue+))
 	      (loop for x from 0 below 300 by (* 4 zoom)
 		    do (draw-rectangle* pane x -300 (1+ x) 300 :ink +blue+))
+	      ;; draw the bounding rectangle
+	      (draw-rectangle* pane
+			       (* zoom min-x) (* zoom min-y)
+			       (* zoom max-x) (1+ (* zoom min-y))
+			       :ink +red+)
+	      (draw-rectangle* pane
+			       (* zoom min-x) (* zoom max-y)
+			       (* zoom max-x) (1+ (* zoom max-y))
+			       :ink +red+)
+	      (draw-rectangle* pane
+			       (* zoom min-x) (* zoom min-y)
+			       (1+ (* zoom min-x)) (* zoom max-y)
+			       :ink +red+)
+	      (draw-rectangle* pane
+			       (* zoom max-x) (* zoom min-y)
+			       (1+ (* zoom max-x)) (* zoom max-y)
+			       :ink +red+)
+	      ;; draw the reference point
 	      (draw-rectangle* pane -300 0 300 1 :ink +red+)
 	      (draw-rectangle* pane 0 -300 1 300 :ink +red+))))))))
 
--- /project/gsharp/cvsroot/gsharp/sdl.lisp	2006/06/01 11:01:26	1.18
+++ /project/gsharp/cvsroot/gsharp/sdl.lisp	2006/06/01 18:57:40	1.19
@@ -151,7 +151,7 @@
 	       beam-hang-sit-offset) font
     (setf staff-line-thickness (round (/ (staff-line-distance font) 10)))
     (setf xoffset
-	  (if (oddp (round (* 1.5 staff-line-distance))) 1.5 0))
+	  (if (oddp (round (* 1.5 staff-line-distance))) 0.5 0))
     (setf yoffset
 	  (if (oddp staff-line-thickness) 0.5 0))
     (setf dot-diameter
@@ -610,12 +610,12 @@
 			       (mf (c xc (- staff-line-thickness)) -- (c xc 0)))))))
 	(clim:region-union
 	 (climi::close-path (mf (c 0 top) -- (c xa top) --
-				(c xa (- (- top) staff-line-thickness)) --
-				(c 0 (- (- top) staff-line-thickness)) -- (c 0 top)))
+				(c xa (- top)) --
+				(c 0 (- top)) -- (c 0 top)))
 	 (clim:region-union
 	  (climi::close-path (mf (c xb top) -- (c xc top) --
-				 (c xc (- (- top) staff-line-thickness)) --
-				 (c xb (- (- top) staff-line-thickness)) -- (c xb top)))
+				 (c xc (- top)) --
+				 (c xb (- top)) -- (c xb top)))
 	  (translate r (c 0 staff-line-thickness))))))))
 
 ;;;                                                                       
@@ -712,7 +712,7 @@
 	       (complex xoffset yoffset))))
 
 (defmethod compute-design ((font font) (shape (eql :whole-notehead)))
-  (with-slots ((sld staff-line-distance)) font
+  (with-slots (xoffset yoffset (sld staff-line-distance)) font
     (let ((op (scale (superellipse #c(0.75 0.0) #c(0.0 0.58)
 				   #c(-0.75 0.0) #c(0.0 -0.58) 0.7)
 		     sld))
@@ -720,7 +720,8 @@
 				   #c(-0.3 0.0) #c(0.0 -0.35) 0.8)
 			    -0.3)
 		     sld)))
-      (clim:region-difference op (climi::reverse-path ip)))))
+      (translate (clim:region-difference op (climi::reverse-path ip))
+		 (complex xoffset yoffset)))))
 
 (defmethod compute-design ((font font) (shape (eql :half-notehead)))
   (with-slots (xoffset yoffset (sld staff-line-distance)) font




More information about the Gsharp-cvs mailing list