11.07.2015 Views

Tutorial for the cl-cairo2 package - Common Lisp.net

Tutorial for the cl-cairo2 package - Common Lisp.net

Tutorial for the cl-cairo2 package - Common Lisp.net

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>cl</strong>-<strong>cairo2</strong> tutorialTamás K Papp(mark-at x y 2 1 0 0) ; red;; first text in a box(multiple-value-bind (x-bearing y-bearing text-width text-height)(text-extents text)(let ((rect-x (+ x x-bearing))(rect-y (+ y y-bearing)))(rectangle rect-x rect-y text-width text-height)(set-source-rgba 0 0 1 0.3) ; blue(set-line-width 1)(set-dash 0 ’(5 5))(stroke)))(set-source-rgba 0 0 0 0.6)(move-to x y)(show-text text);; text automatically aligned;; (dolist (x-align ’(0 0.5 1));; (dolist (y-align ’(0 0.5 1));; (show-text-with-marker text (+ x (* x-align 300)) (+ y (* y-align 300)100);; x-align y-align)))(dolist (x-align ’(0))(dolist (y-align ’(0))(show-text-with-marker text (+ x (* x-align 300)) (+ y (* y-align 300)100)x-align y-align)))(show-text-with-marker text x (+ y 100d0) 0d0 0d0);; done(destroy *context*);;;;;;;; text placement example;;;;;;;; This example demonstrates <strong>the</strong> use of text-extents, by placing;;;; text aligned relative to a red marker.10

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!