[bknr-cvs] hans changed trunk/projects/quickhoney/src/

BKNR Commits bknr at bknr.net
Thu Dec 18 17:32:05 UTC 2008


Revision: 4143
Author: hans
URL: http://bknr.net/trac/changeset/4143

checkpoint
U   trunk/projects/quickhoney/src/pixel-pdf.lisp
U   trunk/projects/quickhoney/src/turtle.lisp

Modified: trunk/projects/quickhoney/src/pixel-pdf.lisp
===================================================================
--- trunk/projects/quickhoney/src/pixel-pdf.lisp	2008-12-18 11:38:27 UTC (rev 4142)
+++ trunk/projects/quickhoney/src/pixel-pdf.lisp	2008-12-18 17:32:05 UTC (rev 4143)
@@ -1,7 +1,7 @@
 (in-package :pixel-pdf)
 
 (defvar *colors* nil)
-(defconstant +paper-width+ 800)
+(defconstant +paper-width+ 600)
 (defvar *converter*)
 
 (defclass converter ()
@@ -126,11 +126,6 @@
 (defun forward ()
   (turtle:forward))
 
-(defun set-color (color)
-  (pdf:set-rgb-fill (/ (float (ldb (byte 8 0) color)) 256.0)
-                    (/ (float (ldb (byte 8 8) color)) 256.0)
-                    (/ (float (ldb (byte 8 16) color)) 256.0)))
-
 (defun move-to-pixel (x y)
   (setf (x *converter*) x
         (y *converter*) y))
@@ -150,8 +145,6 @@
     (recurse (x *converter*) (y *converter*))))
 
 (defun fill-from (from-x from-y)
-  ;; XXX true-color-behandlung fehlt.
-  #+(or) (format t "filling at ~A/~A~%" from-x from-y)
   (setf (looking-in-direction *converter*) :east
         (x *converter*) from-x
         (y *converter*) from-y
@@ -159,7 +152,7 @@
   (flood-fill)
   (turtle:reset)
   (turtle:move-to from-x from-y)
-  (set-color (color *converter*))
+  (pdf:set-color-fill (color *converter*))
   (turtle:pen-down)
   (turtle:forward)
   (do ()
@@ -167,26 +160,16 @@
             (eql from-y (turtle:y))))
     (cond
       ((can-turn-right)
-       #+(or) (format t " RIGHT~%")
        (look :right #'move-to-pixel)
        (turn :right)
        (turtle:forward))
       ((can-go-forward)
-       #+(or) (format t " FORWARD~%")
        (look :forward #'move-to-pixel)
        (turtle:forward))
       (t
-       #+(or) (format t " LEFT~%")
        (turn :left)
-       (turtle:forward)))
-    #+(or) (format t "at ~A/~A looking ~A ~A~%"
-            (x *converter*) (y *converter*)
-            (looking-in-direction *converter*)
-            turtle::*turtle*)
-    #+(or) (assert (and (<= (abs (- (x *converter*) (turtle:x))) 1)
-                        (<= (abs (- (y *converter*) (turtle:y))) 1))))
-  (turtle:pen-up)
-  #+(or) (print-seen))
+       (turtle:forward))))
+  (turtle:pen-up))
 
 (defun pixels-pdf (image-pathname)
   (let ((*converter* (make-instance 'converter :image-pathname image-pathname)))
@@ -196,7 +179,7 @@
         (let ((scale (float (/ +paper-width+ (max (width *converter*)
                                                   (height *converter*)))))
               (*print-pretty* nil))
-          (pdf:translate 30.0 80.0)
+          (pdf:set-transform-matrix 1.0 0.0 0.0 -1.0 80.0 800.0)
           (pdf:scale scale scale)
           (dotimes (y (height *converter*))
             (dotimes (x (width *converter*))

Modified: trunk/projects/quickhoney/src/turtle.lisp
===================================================================
--- trunk/projects/quickhoney/src/turtle.lisp	2008-12-18 11:38:27 UTC (rev 4142)
+++ trunk/projects/quickhoney/src/turtle.lisp	2008-12-18 17:32:05 UTC (rev 4143)
@@ -52,6 +52,7 @@
 (defun pen-down ()
   (setf (turtle-drawing *turtle*) t)
   (pdf:move-to (turtle-x *turtle*) (turtle-y *turtle*))
+  (pdf:set-line-width 0.1)
   *turtle*)
 
 (defun move-to (x y)





More information about the Bknr-cvs mailing list