Merge remote-tracking branch 'andy128k/master'
[cl-gtk2.git] / gdk / gdk.gc.lisp
blob9b274e2af731656a229323b6de8bf67cd591bf17
1 (in-package :gdk)
3 (define-g-boxed-cstruct gc-values nil
4 (foregound color :initform (make-color) :inline t)
5 (background color :initform (make-color) :inline t)
6 (font (g-boxed-foreign font) :initform nil)
7 (function gdk-function :initform :copy)
8 (fill gdk-fill :initform :solid)
9 (tile (g-object pixmap) :initform nil)
10 (stipple (g-object pixmap) :initform nil)
11 (clip-mask (g-object pixmap) :initform nil)
12 (subwindow-mode subwindow-mode :initform :clip-by-children)
13 (ts-x-origin :int :initform 0)
14 (ts-y-origin :int :initform 0)
15 (clip-x-origin :int :initform 0)
16 (clip-y-origin :int :initform 0)
17 (graphics-exposures :boolean :initform t)
18 (line-width :int :initform 0)
19 (line-style line-style :initform :solid)
20 (cap-style cap-style :initform :butt)
21 (join-style join-style :initform :miter))
23 (export (boxed-related-symbols 'gc-values))
25 (defcfun (graphics-context-new "gdk_gc_new") (g-object graphics-context :already-referenced)
26 (drawable (g-object drawable)))
28 (export 'graphics-context-new)
30 (defcfun (graphics-context-new-with-values "gdk_gc_new_with_values") (g-object graphics-context :already-referenced)
31 (drawable (g-object drawable))
32 (values (g-boxed-foreign gc-values))
33 (values-mask gc-values-mask))
35 (export 'graphics-context-new-with-values)
37 (defcfun (graphics-context-set-values "gdk_gc_set_values") :void
38 (graphics-context (g-object graphics-context))
39 (values (g-boxed-foreign gc-values))
40 (values-mask gc-values-mask))
42 (export 'graphics-context-set-values)
44 (defcfun gdk-gc-get-values :void
45 (gc (g-object graphics-context))
46 (values (g-boxed-foreign gc-values)))
48 (defun graphics-context-get-values (graphics-context)
49 (let ((values (make-gc-values)))
50 (gdk-gc-get-values graphics-context values)
51 values))
53 (export 'graphics-context-get-values)
55 (defcfun (graphics-context-set-ts-origin "gdk_gc_set_ts_origin") :void
56 (graphics-context (g-object graphics-context))
57 (x :int)
58 (y :int))
60 (export 'graphics-context-set-ts-origin)
62 (defcfun (graphics-context-set-clip-origin "gdk_gc_set_clip_origin") :void
63 (graphics-context (g-object graphics-context))
64 (x :int)
65 (y :int))
67 (export 'graphics-context-set-clip-origin)
69 (defcfun (graphics-context-set-line-attributes "gdk_gc_set_line_attributes") :void
70 (graphics-context (g-object graphics-context))
71 (line-width :int)
72 (line-style line-style)
73 (cap-style cap-style)
74 (join-style join-style))
76 (export 'graphics-context-set-line-attributes)
78 (defcfun gdk-gc-set-dashes :void
79 (graphics-context (g-object graphics-context))
80 (dash-offset :int)
81 (dash-list :pointer)
82 (n :int))
84 (defun graphics-context-set-dashes (graphics-context dash-offset dash-list)
85 (let ((n (length dash-list)))
86 (with-foreign-object (dash-list-ptr :int8 n)
87 (let ((i 0))
88 (map nil
89 (lambda (dash)
90 (setf (mem-aref dash-list-ptr :int8 i) dash)
91 (incf i))
92 dash-list))
93 (gdk-gc-set-dashes graphics-context dash-offset dash-list n))))
95 (export 'graphics-context-set-dashes)
97 (defcfun (graphics-context-copy "gdk_gc_copy") :void
98 (dst-gc (g-object graphics-context))
99 (src-gc (g-object graphics-context)))
101 (export 'graphics-context-copy)
103 (defcfun (graphics-context-offset "gdk_gc_offset") :void
104 (graphics-context (g-object graphics-context))
105 (x-offset :int)
106 (y-offset :int))
108 (export 'graphic-context-offset)