1 /* GDK - The GIMP Drawing Kit 2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with this library; if not, write to the 16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 * Boston, MA 02111-1307, USA. 18 */ 19 20 /* 21 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS 22 * file for a list of people on the GTK+ Team. See the ChangeLog 23 * files for a list of changes. These files are distributed with 24 * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 25 */ 26 27 #ifndef __GDK_GC_H__ 28 #define __GDK_GC_H__ 29 30 #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION) 31 #error "Only <gdk/gdk.h> can be included directly." 32 #endif 33 34 #include <gdk/gdkcolor.h> 35 #include <gdk/gdktypes.h> 36 37 G_BEGIN_DECLS 38 39 typedef struct _GdkGCValues GdkGCValues; 40 typedef struct _GdkGCClass GdkGCClass; 41 42 /* GC cap styles 43 * CapNotLast: 44 * CapButt: 45 * CapRound: 46 * CapProjecting: 47 */ 48 typedef enum 49 { 50 GDK_CAP_NOT_LAST, 51 GDK_CAP_BUTT, 52 GDK_CAP_ROUND, 53 GDK_CAP_PROJECTING 54 } GdkCapStyle; 55 56 /* GC fill types. 57 * Solid: 58 * Tiled: 59 * Stippled: 60 * OpaqueStippled: 61 */ 62 typedef enum 63 { 64 GDK_SOLID, 65 GDK_TILED, 66 GDK_STIPPLED, 67 GDK_OPAQUE_STIPPLED 68 } GdkFill; 69 70 /* GC function types. 71 * Copy: Overwrites destination pixels with the source pixels. 72 * Invert: Inverts the destination pixels. 73 * Xor: Xor's the destination pixels with the source pixels. 74 * Clear: set pixels to 0 75 * And: source AND destination 76 * And Reverse: source AND (NOT destination) 77 * And Invert: (NOT source) AND destination 78 * Noop: destination 79 * Or: source OR destination 80 * Nor: (NOT source) AND (NOT destination) 81 * Equiv: (NOT source) XOR destination 82 * Xor Reverse: source OR (NOT destination) 83 * Copy Inverted: NOT source 84 * Xor Inverted: (NOT source) OR destination 85 * Nand: (NOT source) OR (NOT destination) 86 * Set: set pixels to 1 87 */ 88 typedef enum 89 { 90 GDK_COPY, 91 GDK_INVERT, 92 GDK_XOR, 93 GDK_CLEAR, 94 GDK_AND, 95 GDK_AND_REVERSE, 96 GDK_AND_INVERT, 97 GDK_NOOP, 98 GDK_OR, 99 GDK_EQUIV, 100 GDK_OR_REVERSE, 101 GDK_COPY_INVERT, 102 GDK_OR_INVERT, 103 GDK_NAND, 104 GDK_NOR, 105 GDK_SET 106 } GdkFunction; 107 108 /* GC join styles 109 * JoinMiter: 110 * JoinRound: 111 * JoinBevel: 112 */ 113 typedef enum 114 { 115 GDK_JOIN_MITER, 116 GDK_JOIN_ROUND, 117 GDK_JOIN_BEVEL 118 } GdkJoinStyle; 119 120 /* GC line styles 121 * Solid: 122 * OnOffDash: 123 * DoubleDash: 124 */ 125 typedef enum 126 { 127 GDK_LINE_SOLID, 128 GDK_LINE_ON_OFF_DASH, 129 GDK_LINE_DOUBLE_DASH 130 } GdkLineStyle; 131 132 typedef enum 133 { 134 GDK_CLIP_BY_CHILDREN = 0, 135 GDK_INCLUDE_INFERIORS = 1 136 } GdkSubwindowMode; 137 138 typedef enum 139 { 140 GDK_GC_FOREGROUND = 1 << 0, 141 GDK_GC_BACKGROUND = 1 << 1, 142 GDK_GC_FONT = 1 << 2, 143 GDK_GC_FUNCTION = 1 << 3, 144 GDK_GC_FILL = 1 << 4, 145 GDK_GC_TILE = 1 << 5, 146 GDK_GC_STIPPLE = 1 << 6, 147 GDK_GC_CLIP_MASK = 1 << 7, 148 GDK_GC_SUBWINDOW = 1 << 8, 149 GDK_GC_TS_X_ORIGIN = 1 << 9, 150 GDK_GC_TS_Y_ORIGIN = 1 << 10, 151 GDK_GC_CLIP_X_ORIGIN = 1 << 11, 152 GDK_GC_CLIP_Y_ORIGIN = 1 << 12, 153 GDK_GC_EXPOSURES = 1 << 13, 154 GDK_GC_LINE_WIDTH = 1 << 14, 155 GDK_GC_LINE_STYLE = 1 << 15, 156 GDK_GC_CAP_STYLE = 1 << 16, 157 GDK_GC_JOIN_STYLE = 1 << 17 158 } GdkGCValuesMask; 159 160 struct _GdkGCValues 161 { 162 GdkColor foreground; 163 GdkColor background; 164 GdkFont *font; 165 GdkFunction function; 166 GdkFill fill; 167 GdkPixmap *tile; 168 GdkPixmap *stipple; 169 GdkPixmap *clip_mask; 170 GdkSubwindowMode subwindow_mode; 171 gint ts_x_origin; 172 gint ts_y_origin; 173 gint clip_x_origin; 174 gint clip_y_origin; 175 gint graphics_exposures; 176 gint line_width; 177 GdkLineStyle line_style; 178 GdkCapStyle cap_style; 179 GdkJoinStyle join_style; 180 }; 181 182 #define GDK_TYPE_GC (gdk_gc_get_type ()) 183 #define GDK_GC(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_GC, GdkGC)) 184 #define GDK_GC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_GC, GdkGCClass)) 185 #define GDK_IS_GC(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_GC)) 186 #define GDK_IS_GC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_GC)) 187 #define GDK_GC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_GC, GdkGCClass)) 188 189 struct _GdkGC 190 { 191 GObject parent_instance; 192 193 gint GSEAL (clip_x_origin); 194 gint GSEAL (clip_y_origin); 195 gint GSEAL (ts_x_origin); 196 gint GSEAL (ts_y_origin); 197 198 GdkColormap *GSEAL (colormap); 199 }; 200 201 struct _GdkGCClass 202 { 203 GObjectClass parent_class; 204 205 void (*get_values) (GdkGC *gc, 206 GdkGCValues *values); 207 void (*set_values) (GdkGC *gc, 208 GdkGCValues *values, 209 GdkGCValuesMask mask); 210 void (*set_dashes) (GdkGC *gc, 211 gint dash_offset, 212 gint8 dash_list[], 213 gint n); 214 215 /* Padding for future expansion */ 216 void (*_gdk_reserved1) (void); 217 void (*_gdk_reserved2) (void); 218 void (*_gdk_reserved3) (void); 219 void (*_gdk_reserved4) (void); 220 }; 221 222 223 #ifndef GDK_DISABLE_DEPRECATED 224 GType gdk_gc_get_type (void) G_GNUC_CONST; 225 GdkGC *gdk_gc_new (GdkDrawable *drawable); 226 GdkGC *gdk_gc_new_with_values (GdkDrawable *drawable, 227 GdkGCValues *values, 228 GdkGCValuesMask values_mask); 229 230 GdkGC *gdk_gc_ref (GdkGC *gc); 231 void gdk_gc_unref (GdkGC *gc); 232 233 void gdk_gc_get_values (GdkGC *gc, 234 GdkGCValues *values); 235 void gdk_gc_set_values (GdkGC *gc, 236 GdkGCValues *values, 237 GdkGCValuesMask values_mask); 238 void gdk_gc_set_foreground (GdkGC *gc, 239 const GdkColor *color); 240 void gdk_gc_set_background (GdkGC *gc, 241 const GdkColor *color); 242 void gdk_gc_set_font (GdkGC *gc, 243 GdkFont *font); 244 void gdk_gc_set_function (GdkGC *gc, 245 GdkFunction function); 246 void gdk_gc_set_fill (GdkGC *gc, 247 GdkFill fill); 248 void gdk_gc_set_tile (GdkGC *gc, 249 GdkPixmap *tile); 250 void gdk_gc_set_stipple (GdkGC *gc, 251 GdkPixmap *stipple); 252 void gdk_gc_set_ts_origin (GdkGC *gc, 253 gint x, 254 gint y); 255 void gdk_gc_set_clip_origin (GdkGC *gc, 256 gint x, 257 gint y); 258 void gdk_gc_set_clip_mask (GdkGC *gc, 259 GdkBitmap *mask); 260 void gdk_gc_set_clip_rectangle (GdkGC *gc, 261 const GdkRectangle *rectangle); 262 void gdk_gc_set_clip_region (GdkGC *gc, 263 const GdkRegion *region); 264 void gdk_gc_set_subwindow (GdkGC *gc, 265 GdkSubwindowMode mode); 266 void gdk_gc_set_exposures (GdkGC *gc, 267 gboolean exposures); 268 void gdk_gc_set_line_attributes (GdkGC *gc, 269 gint line_width, 270 GdkLineStyle line_style, 271 GdkCapStyle cap_style, 272 GdkJoinStyle join_style); 273 void gdk_gc_set_dashes (GdkGC *gc, 274 gint dash_offset, 275 gint8 dash_list[], 276 gint n); 277 void gdk_gc_offset (GdkGC *gc, 278 gint x_offset, 279 gint y_offset); 280 void gdk_gc_copy (GdkGC *dst_gc, 281 GdkGC *src_gc); 282 283 284 void gdk_gc_set_colormap (GdkGC *gc, 285 GdkColormap *colormap); 286 GdkColormap *gdk_gc_get_colormap (GdkGC *gc); 287 void gdk_gc_set_rgb_fg_color (GdkGC *gc, 288 const GdkColor *color); 289 void gdk_gc_set_rgb_bg_color (GdkGC *gc, 290 const GdkColor *color); 291 GdkScreen * gdk_gc_get_screen (GdkGC *gc); 292 293 #define gdk_gc_destroy g_object_unref 294 #endif /* GDK_DISABLE_DEPRECATED */ 295 296 G_END_DECLS 297 298 #endif /* __GDK_DRAWABLE_H__ */ 299