gdkgc.h 8.09 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
/* GDK - The GIMP Drawing Kit
 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

/*
 * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
 * file for a list of people on the GTK+ Team.  See the ChangeLog
 * files for a list of changes.  These files are distributed with
 * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
 */

Owen Taylor's avatar
Owen Taylor committed
27 28 29 30 31 32
#ifndef __GDK_GC_H__
#define __GDK_GC_H__

#include <gdk/gdkcolor.h>
#include <gdk/gdktypes.h>

33
G_BEGIN_DECLS
Owen Taylor's avatar
Owen Taylor committed
34 35

typedef struct _GdkGCValues	      GdkGCValues;
36
typedef struct _GdkGCClass	      GdkGCClass;
Owen Taylor's avatar
Owen Taylor committed
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99

/* GC cap styles
 *  CapNotLast:
 *  CapButt:
 *  CapRound:
 *  CapProjecting:
 */
typedef enum
{
  GDK_CAP_NOT_LAST,
  GDK_CAP_BUTT,
  GDK_CAP_ROUND,
  GDK_CAP_PROJECTING
} GdkCapStyle;

/* GC fill types.
 *  Solid:
 *  Tiled:
 *  Stippled:
 *  OpaqueStippled:
 */
typedef enum
{
  GDK_SOLID,
  GDK_TILED,
  GDK_STIPPLED,
  GDK_OPAQUE_STIPPLED
} GdkFill;

/* GC function types.
 *   Copy: Overwrites destination pixels with the source pixels.
 *   Invert: Inverts the destination pixels.
 *   Xor: Xor's the destination pixels with the source pixels.
 *   Clear: set pixels to 0
 *   And: source AND destination
 *   And Reverse: source AND (NOT destination)
 *   And Invert: (NOT source) AND destination
 *   Noop: destination
 *   Or: source OR destination
 *   Nor: (NOT source) AND (NOT destination)
 *   Equiv: (NOT source) XOR destination
 *   Xor Reverse: source OR (NOT destination)
 *   Copy Inverted: NOT source
 *   Xor Inverted: (NOT source) OR destination
 *   Nand: (NOT source) OR (NOT destination)
 *   Set: set pixels to 1
 */
typedef enum
{
  GDK_COPY,
  GDK_INVERT,
  GDK_XOR,
  GDK_CLEAR,
  GDK_AND,
  GDK_AND_REVERSE,
  GDK_AND_INVERT,
  GDK_NOOP,
  GDK_OR,
  GDK_EQUIV,
  GDK_OR_REVERSE,
  GDK_COPY_INVERT,
  GDK_OR_INVERT,
  GDK_NAND,
Elliot Lee's avatar
Elliot Lee committed
100
  GDK_NOR,
Owen Taylor's avatar
Owen Taylor committed
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
  GDK_SET
} GdkFunction;

/* GC join styles
 *  JoinMiter:
 *  JoinRound:
 *  JoinBevel:
 */
typedef enum
{
  GDK_JOIN_MITER,
  GDK_JOIN_ROUND,
  GDK_JOIN_BEVEL
} GdkJoinStyle;

/* GC line styles
 *  Solid:
 *  OnOffDash:
 *  DoubleDash:
 */
typedef enum
{
  GDK_LINE_SOLID,
  GDK_LINE_ON_OFF_DASH,
  GDK_LINE_DOUBLE_DASH
} GdkLineStyle;

typedef enum
{
  GDK_CLIP_BY_CHILDREN	= 0,
  GDK_INCLUDE_INFERIORS = 1
} GdkSubwindowMode;

typedef enum
{
  GDK_GC_FOREGROUND    = 1 << 0,
  GDK_GC_BACKGROUND    = 1 << 1,
  GDK_GC_FONT	       = 1 << 2,
  GDK_GC_FUNCTION      = 1 << 3,
  GDK_GC_FILL	       = 1 << 4,
  GDK_GC_TILE	       = 1 << 5,
  GDK_GC_STIPPLE       = 1 << 6,
  GDK_GC_CLIP_MASK     = 1 << 7,
  GDK_GC_SUBWINDOW     = 1 << 8,
  GDK_GC_TS_X_ORIGIN   = 1 << 9,
  GDK_GC_TS_Y_ORIGIN   = 1 << 10,
  GDK_GC_CLIP_X_ORIGIN = 1 << 11,
  GDK_GC_CLIP_Y_ORIGIN = 1 << 12,
  GDK_GC_EXPOSURES     = 1 << 13,
  GDK_GC_LINE_WIDTH    = 1 << 14,
  GDK_GC_LINE_STYLE    = 1 << 15,
  GDK_GC_CAP_STYLE     = 1 << 16,
  GDK_GC_JOIN_STYLE    = 1 << 17
} GdkGCValuesMask;

struct _GdkGCValues
{
  GdkColor	    foreground;
  GdkColor	    background;
  GdkFont	   *font;
  GdkFunction	    function;
  GdkFill	    fill;
  GdkPixmap	   *tile;
  GdkPixmap	   *stipple;
  GdkPixmap	   *clip_mask;
  GdkSubwindowMode  subwindow_mode;
  gint		    ts_x_origin;
  gint		    ts_y_origin;
  gint		    clip_x_origin;
  gint		    clip_y_origin;
  gint		    graphics_exposures;
  gint		    line_width;
  GdkLineStyle	    line_style;
  GdkCapStyle	    cap_style;
  GdkJoinStyle	    join_style;
};

178 179 180 181 182 183 184
#define GDK_TYPE_GC              (gdk_gc_get_type ())
#define GDK_GC(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_GC, GdkGC))
#define GDK_GC_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_GC, GdkGCClass))
#define GDK_IS_GC(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_GC))
#define GDK_IS_GC_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_GC))
#define GDK_GC_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_GC, GdkGCClass))

Owen Taylor's avatar
Owen Taylor committed
185 186
struct _GdkGC
{
187 188 189 190 191 192
  GObject parent_instance;

  gint clip_x_origin;
  gint clip_y_origin;
  gint ts_x_origin;
  gint ts_y_origin;
193 194

  GdkColormap *colormap;
Owen Taylor's avatar
Owen Taylor committed
195 196
};

197 198
struct _GdkGCClass 
{
199 200
  GObjectClass parent_class;
  
201 202 203 204 205 206 207
  void (*get_values)     (GdkGC          *gc,
			  GdkGCValues    *values);
  void (*set_values)     (GdkGC          *gc,
			  GdkGCValues    *values,
			  GdkGCValuesMask mask);
  void (*set_dashes)     (GdkGC          *gc,
			  gint	          dash_offset,
208
			  gint8           dash_list[],
209
			  gint            n);
210 211 212 213 214 215
  
  /* Padding for future expansion */
  void         (*_gdk_reserved1)  (void);
  void         (*_gdk_reserved2)  (void);
  void         (*_gdk_reserved3)  (void);
  void         (*_gdk_reserved4)  (void);
216 217 218
};


Elliot Lee's avatar
Elliot Lee committed
219
GType  gdk_gc_get_type            (void) G_GNUC_CONST;
220 221
GdkGC *gdk_gc_new		  (GdkDrawable	    *drawable);
GdkGC *gdk_gc_new_with_values	  (GdkDrawable	    *drawable,
Owen Taylor's avatar
Owen Taylor committed
222 223
				   GdkGCValues	    *values,
				   GdkGCValuesMask   values_mask);
Matthias Clasen's avatar
Matthias Clasen committed
224 225

#ifndef GDK_DISABLE_DEPRECATED
226
GdkGC *gdk_gc_ref		  (GdkGC	    *gc);
Owen Taylor's avatar
Owen Taylor committed
227
void   gdk_gc_unref		  (GdkGC	    *gc);
Matthias Clasen's avatar
Matthias Clasen committed
228 229
#endif

Owen Taylor's avatar
Owen Taylor committed
230 231
void   gdk_gc_get_values	  (GdkGC	    *gc,
				   GdkGCValues	    *values);
232 233 234
void   gdk_gc_set_values          (GdkGC           *gc,
                                   GdkGCValues	   *values,
                                   GdkGCValuesMask  values_mask);
Owen Taylor's avatar
Owen Taylor committed
235
void   gdk_gc_set_foreground	  (GdkGC	    *gc,
236
				   const GdkColor   *color);
Owen Taylor's avatar
Owen Taylor committed
237
void   gdk_gc_set_background	  (GdkGC	    *gc,
238
				   const GdkColor   *color);
239
#ifndef GDK_DISABLE_DEPRECATED
Owen Taylor's avatar
Owen Taylor committed
240 241
void   gdk_gc_set_font		  (GdkGC	    *gc,
				   GdkFont	    *font);
242
#endif /* GDK_DISABLE_DEPRECATED */
Owen Taylor's avatar
Owen Taylor committed
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265
void   gdk_gc_set_function	  (GdkGC	    *gc,
				   GdkFunction	     function);
void   gdk_gc_set_fill		  (GdkGC	    *gc,
				   GdkFill	     fill);
void   gdk_gc_set_tile		  (GdkGC	    *gc,
				   GdkPixmap	    *tile);
void   gdk_gc_set_stipple	  (GdkGC	    *gc,
				   GdkPixmap	    *stipple);
void   gdk_gc_set_ts_origin	  (GdkGC	    *gc,
				   gint		     x,
				   gint		     y);
void   gdk_gc_set_clip_origin	  (GdkGC	    *gc,
				   gint		     x,
				   gint		     y);
void   gdk_gc_set_clip_mask	  (GdkGC	    *gc,
				   GdkBitmap	    *mask);
void   gdk_gc_set_clip_rectangle  (GdkGC	    *gc,
				   GdkRectangle	    *rectangle);
void   gdk_gc_set_clip_region	  (GdkGC	    *gc,
				   GdkRegion	    *region);
void   gdk_gc_set_subwindow	  (GdkGC	    *gc,
				   GdkSubwindowMode  mode);
void   gdk_gc_set_exposures	  (GdkGC	    *gc,
266
				   gboolean	     exposures);
Owen Taylor's avatar
Owen Taylor committed
267 268 269 270 271 272 273
void   gdk_gc_set_line_attributes (GdkGC	    *gc,
				   gint		     line_width,
				   GdkLineStyle	     line_style,
				   GdkCapStyle	     cap_style,
				   GdkJoinStyle	     join_style);
void   gdk_gc_set_dashes          (GdkGC            *gc,
				   gint	             dash_offset,
Owen Taylor's avatar
Owen Taylor committed
274
				   gint8             dash_list[],
Owen Taylor's avatar
Owen Taylor committed
275
				   gint              n);
276 277 278
void   gdk_gc_offset              (GdkGC            *gc,
				   gint              x_offset,
				   gint              y_offset);
279 280 281 282
void   gdk_gc_copy		  (GdkGC	    *dst_gc,
				   GdkGC	    *src_gc);


283 284 285 286 287 288 289 290
void         gdk_gc_set_colormap     (GdkGC          *gc,
				      GdkColormap    *colormap);
GdkColormap *gdk_gc_get_colormap     (GdkGC          *gc);
void         gdk_gc_set_rgb_fg_color (GdkGC          *gc,
				      const GdkColor *color);
void         gdk_gc_set_rgb_bg_color (GdkGC          *gc,
				      const GdkColor *color);
GdkScreen *  gdk_gc_get_screen	     (GdkGC          *gc);
Owen Taylor's avatar
Owen Taylor committed
291

292 293 294 295
#ifndef GDK_DISABLE_DEPRECATED
#define gdk_gc_destroy                 gdk_gc_unref
#endif /* GDK_DISABLE_DEPRECATED */

296
G_END_DECLS
Owen Taylor's avatar
Owen Taylor committed
297 298

#endif /* __GDK_DRAWABLE_H__ */