Changeset 2846
- Timestamp:
- 04/01/08 14:19:16 (9 months ago)
- Files:
-
- trunk/projects/bos/m2/allocation.lisp (modified) (1 diff)
- trunk/projects/bos/m2/geometry.lisp (modified) (1 diff)
- trunk/projects/bos/m2/packages.lisp (modified) (1 diff)
- trunk/projects/bos/tmp/contract-image-test.lisp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/projects/bos/m2/allocation.lisp
r2810 r2846 168 168 'vector))) 169 169 bounding-box)) 170 171 (defmethod allocation-area-bounding-box2 ((allocation-area allocation-area)) 172 "Returns the bounding-box in a standard rectangle representation." 173 (with-slots (left top width height) allocation-area 174 (list left top width height))) 175 176 (defun allocation-areas-bounding-box (&optional (allocation-areas (class-instances 'allocation-area))) 177 (geometry:with-bounding-box-collect (collect) 178 (dolist (area allocation-areas) 179 (geometry:with-rectangle ((allocation-area-bounding-box2 area)) 180 (collect (list left top)) 181 (collect (list (1- (+ left width)) (1- (+ top height)))))))) 170 182 171 183 (defun gauge (area) trunk/projects/bos/m2/geometry.lisp
r2838 r2846 21 21 ,@body)))) 22 22 23 (defmacro with-rectangle (rectangle &body body)24 (destructuring-bind (rectangle &key suffix) (ensure-list rectangle )23 (defmacro with-rectangle (rectangle-or-options &body body) 24 (destructuring-bind (rectangle &key suffix) (ensure-list rectangle-or-options) 25 25 (flet ((add-suffix (symbol) 26 26 (if suffix 27 (intern (format nil "~a-~a" (symbol-name symbol) (string-upcase suffix)) 28 (symbol-package rectangle)) 29 (intern (symbol-name symbol) (symbol-package rectangle))))) 27 (intern (format nil "~a-~a" (symbol-name symbol) (string-upcase suffix))) 28 (intern (symbol-name symbol))))) 30 29 `(destructuring-bind (,(add-suffix 'left) 31 30 ,(add-suffix 'top) trunk/projects/bos/m2/packages.lisp
r2838 r2846 163 163 #:all-allocation-areas 164 164 #:allocation-area-bounding-box 165 #:allocation-area-bounding-box2 166 #:allocation-areas-bounding-box 165 167 #:allocation-area-active-p 166 168 #:allocation-area-top trunk/projects/bos/tmp/contract-image-test.lisp
r2839 r2846 1 1 (in-package :bos.m2) 2 3 (pushnew 'hunchentoot:dispatch-easy-handlers hunchentoot:*dispatch-table*) 2 4 3 5 (defun contract-image (rectangle) … … 15 17 nil)) 16 18 19 20 21 (hunchentoot:define-easy-handler (ci :uri "/ci") 22 ((step :init-form 1 :parameter-type 'integer)) 23 (let ((rectangle '(6666 5467 700 500))) 24 (geometry:with-rectangle rectangle 25 (with-image (image width height t) 26 (with-default-image (image) 27 (fill-image 0 0 :color (find-color 255 255 255)) 28 (do-rows (y) 29 (do-pixels-in-row (x) 30 (let* ((m2 (get-m2 (+ left (* step (floor x step))) (+ top (* step (floor y step))))) 31 (contract (and m2 (m2-contract m2)))) 32 (when (and contract (contract-paidp contract)) 33 (setf (raw-pixel) (apply #'colorize-pixel (raw-pixel) (contract-color contract))))))) 34 (emit-image-to-browser image :png)))))) 35 36 37 (defun alpha-test () 38 (with-image (image 200 200 t) 39 (with-default-image (image) 40 (let ((color (find-color 200 200 200 :alpha 100))) 41 (assert color) 42 (fill-image 0 0 :color color)) 43 (cl-gd:write-image-to-file "/tmp/test3.png" :if-exists :supersede)))) 44 45 ;; (alpha-test) 46
