3 (defcfun gdk-rectangle-intersect
:boolean
4 (src-1 (g-boxed-foreign rectangle
))
5 (src-2 (g-boxed-foreign rectangle
))
6 (dest (g-boxed-foreign rectangle
)))
8 (defun rectangle-intersect (rectangle-1 rectangle-2
)
9 (let ((dest (make-rectangle)))
10 (when (gdk-rectangle-intersect rectangle-1 rectangle-2 dest
)
13 (export 'rectangle-intersect
)
15 (defcfun gdk-rectangle-union
:boolean
16 (src-1 (g-boxed-foreign rectangle
))
17 (src-2 (g-boxed-foreign rectangle
))
18 (dest (g-boxed-foreign rectangle
)))
20 (defun rectangle-union (rectangle-1 rectangle-2
)
21 (let ((dest (make-rectangle)))
22 (when (gdk-rectangle-union rectangle-1 rectangle-2 dest
)
25 (export 'rectangle-union
)
27 (defcfun gdk-region-polygon
(g-boxed-foreign region
:return
)
30 (fill-rule gdk-fill-rule
))
32 (defun region-from-polygon (points fill-rule
)
33 (with-foreign-boxed-array (n pts point points
)
34 (gdk-region-polygon pts n fill-rule
)))
36 (export 'region-from-polygon
)
38 (defcfun (region-from-rectangle "gdk_region_rectangle") (g-boxed-foreign region
:return
)
39 (rectangle (g-boxed-foreign rectangle
)))
41 (export 'region-from-rectangle
)
43 (defcfun gdk-region-get-clipbox
:void
44 (region (g-boxed-foreign region
))
45 (rectangle (g-boxed-foreign rectangle
)))
47 (defun region-get-clipbox (region)
48 (let ((clipbox (make-rectangle)))
49 (gdk-region-get-clipbox region clipbox
)
52 (export 'region-get-clipbox
)
54 (defcfun gdk-region-get-rectangles
:void
55 (region (g-boxed-foreign region
))
57 (n-rectangles :pointer
))
59 (defun region-get-rectangles (region)
60 (with-foreign-objects ((rectangles-ptr :pointer
) (n-rectangles-ptr :int
))
61 (gdk-region-get-rectangles region rectangles-ptr n-rectangles-ptr
)
62 (let ((n (mem-ref n-rectangles-ptr
:int
))
63 (rectangles (mem-ref rectangles-ptr
:pointer
)))
65 (iter (for i from
0 below n
)
66 (for rect
= (convert-from-foreign (inc-pointer rectangles
(* i
(foreign-type-size 'rectangle-cstruct
)))
67 '(g-boxed-foreign rectangle
)))
69 (glib:g-free rectangles
)))))
71 (export 'region-get-rectangles
)
73 (defcfun (region-is-empty "gdk_region_empty") :boolean
74 (region (g-boxed-foreign region
)))
76 (export 'region-is-empty
)
78 (defcfun (region= "gdk_region_equal") :boolean
79 (region-1 (g-boxed-foreign region
))
80 (region-2 (g-boxed-foreign region
)))
84 (defcfun (region-point-in "gdk_region_point_in") :boolean
85 (region (g-boxed-foreign region
))
89 (export 'region-point-in
)
91 (defcfun (region-rect-in "gdk_region_rect_in") overlap-type
92 (region (g-boxed-foreign region
))
93 (rectangle (g-boxed-foreign rectangle
)))
95 (export 'region-rect-in
)
97 (defcfun (region-offset "gdk_region_offset") :void
98 (region (g-boxed-foreign region
))
102 (export 'region-offset
)
104 (defcfun (region-shrink "gdk_region_shrink") :void
105 (region (g-boxed-foreign region
))
109 (export 'region-shrink
)
111 (defcfun (region-union-with-rect "gdk_region_union_with_rect") :void
112 (region (g-boxed-foreign region
))
113 (rect (g-boxed-foreign rectangle
)))
115 (export 'region-union-with-rect
)
117 (defcfun (region-intersect "gdk_region_intersect") :void
118 (target (g-boxed-foreign region
))
119 (source (g-boxed-foreign region
)))
121 (export 'region-intersect
)
123 (defcfun (region-union "gdk_region_union") :void
124 (target (g-boxed-foreign region
))
125 (source (g-boxed-foreign region
)))
127 (export 'region-union
)
129 (defcfun (region-subtract "gdk_region_subtract") :void
130 (target (g-boxed-foreign region
))
131 (source (g-boxed-foreign region
)))
133 (export 'region-subtract
)
135 (defcfun (region-xor "gdk_region_xor") :void
136 (target (g-boxed-foreign region
))
137 (source (g-boxed-foreign region
)))
141 (defcallback gdk-span-func-callback
:void
142 ((span (g-boxed-foreign span
)) (data :pointer
))
143 (let ((fn (stable-pointer-value data
)))
146 (defcfun gdk-region-spans-intersect-foreach
:void
147 (region (g-boxed-foreign region
))
154 (defun region-spans-intersect-foreach (region spans sorted fn
)
155 (with-stable-pointer (ptr fn
)
156 (with-foreign-boxed-array (n spans-ptr span spans
)
157 (gdk-region-spans-intersect-foreach region spans-ptr n sorted
(callback gdk-region-spans-intersect-foreach
) ptr
))))
159 (export 'region-spans-intersect-foreach
)