You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

299 lines
8.2 KiB

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