Typo.
[cl-gtk2.git] / gdk / gdk.colors.lisp
1 (in-package :gdk)
2
3 (defcfun (colormap-new "gdk_colormap_new") (g-object colormap :already-referenced)
4   (visual (g-object visual))
5   (allocate :boolean))
6
7 (export 'colormap-new)
8
9 ;; deprecated
10 ;; GdkColormap*        gdk_colormap_ref                    (GdkColormap *cmap);
11 ;; void                gdk_colormap_unref                  (GdkColormap *cmap);
12
13 (defcfun (colormap-get-system "gdk_colormap_get_system") (g-object colormap))
14
15 (export 'colormap-get-system)
16
17 ;; deprecated
18 ;; gint                gdk_colormap_get_system_size        (void);
19 ;; void                gdk_colormap_change                 (GdkColormap *colormap,
20 ;;                                                          gint ncolors);
21
22 (defcfun gdk-colormap-alloc-colors :int
23   (colormap (g-object colormap))
24   (colors :pointer)
25   (n-colors :int)
26   (writeable :boolean)
27   (best-match :boolean)
28   (success (:pointer :boolean)))
29
30 (defun colormap-alloc-colors (colormap colors writeable best-match)
31   (with-foreign-boxed-array (n colors-ar color colors)
32     (with-foreign-object (success :boolean)
33       (gdk-colormap-alloc-colors colormap colors-ar n writeable best-match success)
34       (mem-ref success :boolean))))
35
36 (export 'colormap-alloc-colors)
37
38 (defcfun (colormap-alloc-color "gdk_colormap_alloc_color") :boolean
39   (colormap (g-object colormap))
40   (color (g-boxed-foreign color))
41   (writeable :boolean)
42   (best-match :boolean))
43
44 (export 'colormap-alloc-color)
45
46 (defcfun gdk-colormap-free-colors :void
47   (colormap (g-object colormap))
48   (colors :pointer)
49   (n-colors :int))
50
51 (defun colormap-free-colors (colormap colors)
52   (with-foreign-boxed-array (n colors-ptr color colors)
53     (gdk-colormap-free-colors colormap colors-ptr n)))
54
55 (export 'colormap-free-colors)
56
57 (defcfun gdk-colormap-query-color :void
58   (colormap (g-object colormap))
59   (pixel :ulong)
60   (result (g-boxed-foreign color)))
61
62 (defun colormap-query-color (colormap pixel)
63   (let ((color (make-color)))
64     (gdk-colormap-query-color colormap pixel color)
65     color))
66
67 (export 'colormap-query-color)
68
69 ;; ignored:
70 ;; void                gdk_colors_store                    (GdkColormap *colormap,
71 ;;                                                          GdkColor *colors,
72 ;;                                                          gint ncolors);
73 ;; gint                gdk_colors_alloc                    (GdkColormap *colormap,
74 ;;                                                          gboolean contiguous,
75 ;;                                                          gulong *planes,
76 ;;                                                          gint nplanes,
77 ;;                                                          gulong *pixels,
78 ;;                                                          gint npixels);
79 ;; void                gdk_colors_free                     (GdkColormap *colormap,
80 ;;                                                          gulong *pixels,
81 ;;                                                          gint npixels,
82 ;;                                                          gulong planes);
83 ;; gint                gdk_color_white                     (GdkColormap *colormap,
84 ;;                                                          GdkColor *color);
85 ;; gint                gdk_color_black                     (GdkColormap *colormap,
86 ;;                                                          GdkColor *color);
87
88 (defcfun gdk-color-parse :boolean
89   (spec :string)
90   (color (g-boxed-foreign color)))
91
92 (defun color-parse (color-spec)
93   (let ((color (make-color)))
94     (when (gdk-color-parse color-spec color)
95       color)))
96
97 (export 'color-parse)
98
99 ;; ignored:
100 ;; gint                gdk_color_alloc                     (GdkColormap *colormap,
101 ;;                                                          GdkColor *color);
102 ;; gint                gdk_color_change                    (GdkColormap *colormap,
103 ;;                                                          GdkColor *color);
104
105 (defcfun (color= "gdk_color_equal") :boolean
106   (color-a (g-boxed-foreign color))
107   (color-b (g-boxed-foreign color)))
108
109 (export 'color=)
110
111 (defcfun (gdk-color-hash "gdk_color_hash") :uint
112   (color (g-boxed-foreign color)))
113
114 (export 'gdk-color-hash)
115
116 (defcfun (color-to-string "gdk_color_to_string") (glib:g-string :free-from-foreign t)
117   (color (g-boxed-foreign color)))
118
119 (export 'color-to-string)