[cells-gtk-devel] gtk first app / cairo-drawing-area patch
Johan Ur Riise
johan at riise-data.no
Sat Jan 17 21:12:15 UTC 2009
lø., 17.01.2009 kl. 13.01 +0100, skrev Peter Hildebrandt:
> (2) The cairo drawing area is distinct from the cairo-x11 thingy. The
> cairo-x11 canvas uses x11 directly to display its own window which is
> solely for drawing. The cairo-drawing-area is a gtk widget which
> allows the use of cairo for drawing.
>
> Just like the threading, the latter is disabled by default (for folks
> who do not have cairo). Therefore you need to push the
> cairo-drawing-area feature (or something like this, I forget. It is
> commented out in one of the asds, I believe. Chekc the sources), then
> kill the fasls, and recompile.
>
(pushnew :cells-gtk-cairo *features*)
To make it compile, these patches are needed:
johan at perle:~/prg/cl-cairo2$ cat
0001-added-gtk-context-and-exported-a-symbol.patch
>From 5547bf2f16fff8c4a6620c135b1d2f657034e454 Mon Sep 17 00:00:00 2001
From: Johan Ur Riise <johan at perle.riise-data.net>
Date: Sat, 17 Jan 2009 22:06:00 +0100
Subject: [PATCH] added gtk-context and exported a symbol
---
cl-cairo2.asd | 3 ++-
package.lisp | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/cl-cairo2.asd b/cl-cairo2.asd
index c8a2e2d..f070ece 100644
--- a/cl-cairo2.asd
+++ b/cl-cairo2.asd
@@ -20,6 +20,7 @@
"transformations"))
(:file "path" :depends-on ("context"))
(:file "text" :depends-on ("context"))
- (:file "transformations" :depends-on ("context")))
+ (:file "transformations" :depends-on ("context"))
+ (:file "gtk-context" :depends-on ("context")))
:depends-on (:cffi :cl-colors :cl-utilities :trivial-garbage
:trivial-features))
diff --git a/package.lisp b/package.lisp
index e8a1921..97c814f 100644
--- a/package.lisp
+++ b/package.lisp
@@ -30,7 +30,7 @@
get-operator set-operator fill-path set-dash get-dash clip-extents
fill-extents in-fill in-stoke create-ps-context create-pdf-context
create-svg-context get-target set-source-surface
-
+ with-gtk-context
;;pattern
pattern create-rgb-pattern create-rgba-pattern
--
1.5.4.3
and this for cells-gtk:
johan at perle:~/prg/cells-gtk$ cvs diff -u8p
cells-gtk/cairo-drawing-area.lisp
Index: cells-gtk/cairo-drawing-area.lisp
===================================================================
RCS
file: /project/cells-gtk/cvsroot/cells-gtk3/cells-gtk/cairo-drawing-area.lisp,v
retrieving revision 1.1.1.1
diff -u -8 -p -r1.1.1.1 cairo-drawing-area.lisp
--- cells-gtk/cairo-drawing-area.lisp 3 Jun 2008 16:33:44 -0000
1.1.1.1
+++ cells-gtk/cairo-drawing-area.lisp 17 Jan 2009 21:02:33 -0000
@@ -568,18 +568,18 @@ anchor-point."))
(italic nil)
(bold nil)
(alignment :center)
(vertical-alignment :center)))
(defdraw text-label (p text font-face font-size italic bold alignment
vertical-alignment rgb alpha)
(cl-cairo2:set-font-size font-size context)
(cl-cairo2:select-font-face font-face
- (if italic 'cl-cairo2:font-slant-italic
'cl-cairo2:font-slant-normal)
- (if bold 'cl-cairo2:font-weight-bold
'cl-cairo2:font-weight-normal)
+ (if italic :italic :normal)
+ (if bold :bold :normal)
context)
(multiple-value-bind (x-bearing y-bearing text-width text-height)
(cl-cairo2:text-extents text context)
(let ((pos-x (- (2d:x p) (case alignment
(:left x-bearing)
(:center (+ x-bearing (/ text-width 2)))
(:right (+ x-bearing text-width))
(t (error "unknown alignment ~a.
allowed: :left, :center, :right" alignment)))))
johan at perle:~/prg/cells-gtk$
More information about the cells-gtk-devel
mailing list