Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 
 
 

261 Zeilen
8.5 KiB

  1. /* Pango
  2. * pango-renderer.h: Base class for rendering
  3. *
  4. * Copyright (C) 2004, Red Hat, Inc.
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Library General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Library General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Library General Public
  17. * License along with this library; if not, write to the
  18. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19. * Boston, MA 02111-1307, USA.
  20. */
  21. #ifndef __PANGO_RENDERER_H_
  22. #define __PANGO_RENDERER_H_
  23. #include <pango/pango-layout.h>
  24. G_BEGIN_DECLS
  25. #define PANGO_TYPE_RENDERER (pango_renderer_get_type())
  26. #define PANGO_RENDERER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_RENDERER, PangoRenderer))
  27. #define PANGO_IS_RENDERER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_RENDERER))
  28. #define PANGO_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_RENDERER, PangoRendererClass))
  29. #define PANGO_IS_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_RENDERER))
  30. #define PANGO_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_RENDERER, PangoRendererClass))
  31. typedef struct _PangoRenderer PangoRenderer;
  32. typedef struct _PangoRendererClass PangoRendererClass;
  33. typedef struct _PangoRendererPrivate PangoRendererPrivate;
  34. /**
  35. * PangoRenderPart:
  36. * @PANGO_RENDER_PART_FOREGROUND: the text itself
  37. * @PANGO_RENDER_PART_BACKGROUND: the area behind the text
  38. * @PANGO_RENDER_PART_UNDERLINE: underlines
  39. * @PANGO_RENDER_PART_STRIKETHROUGH: strikethrough lines
  40. *
  41. * #PangoRenderPart defines different items to render for such
  42. * purposes as setting colors.
  43. *
  44. * Since: 1.8
  45. **/
  46. /* When extending, note N_RENDER_PARTS #define in pango-renderer.c */
  47. typedef enum
  48. {
  49. PANGO_RENDER_PART_FOREGROUND,
  50. PANGO_RENDER_PART_BACKGROUND,
  51. PANGO_RENDER_PART_UNDERLINE,
  52. PANGO_RENDER_PART_STRIKETHROUGH
  53. } PangoRenderPart;
  54. /**
  55. * PangoRenderer:
  56. * @matrix: the current transformation matrix for the Renderer; may
  57. * be %NULL, which should be treated the same as the identity matrix.
  58. *
  59. * #PangoRenderer is a base class for objects that are used to
  60. * render Pango objects such as #PangoGlyphString and
  61. * #PangoLayout.
  62. *
  63. * Since: 1.8
  64. **/
  65. struct _PangoRenderer
  66. {
  67. /*< private >*/
  68. GObject parent_instance;
  69. PangoUnderline underline;
  70. gboolean strikethrough;
  71. int active_count;
  72. /*< public >*/
  73. PangoMatrix *matrix; /* May be NULL */
  74. /*< private >*/
  75. PangoRendererPrivate *priv;
  76. };
  77. /**
  78. * PangoRendererClass:
  79. * @draw_glyphs: draws a #PangoGlyphString
  80. * @draw_rectangle: draws a rectangle
  81. * @draw_error_underline: draws a squiggly line that approximately
  82. * covers the given rectangle in the style of an underline used to
  83. * indicate a spelling error.
  84. * @draw_shape: draw content for a glyph shaped with #PangoAttrShape.
  85. * @x, @y are the coordinates of the left edge of the baseline,
  86. * in user coordinates.
  87. * @draw_trapezoid: draws a trapezoidal filled area
  88. * @draw_glyph: draws a single glyph
  89. * @part_changed: do renderer specific processing when rendering
  90. * attributes change
  91. * @begin: Do renderer-specific initialization before drawing
  92. * @end: Do renderer-specific cleanup after drawing
  93. * @prepare_run: updates the renderer for a new run
  94. * @draw_glyph_item: draws a #PangoGlyphItem
  95. *
  96. * Class structure for #PangoRenderer.
  97. *
  98. * Since: 1.8
  99. **/
  100. struct _PangoRendererClass
  101. {
  102. /*< private >*/
  103. GObjectClass parent_class;
  104. /* vtable - not signals */
  105. /*< public >*/
  106. /* All of the following have default implementations
  107. * and take as coordinates user coordinates in Pango units
  108. */
  109. void (*draw_glyphs) (PangoRenderer *renderer,
  110. PangoFont *font,
  111. PangoGlyphString *glyphs,
  112. int x,
  113. int y);
  114. void (*draw_rectangle) (PangoRenderer *renderer,
  115. PangoRenderPart part,
  116. int x,
  117. int y,
  118. int width,
  119. int height);
  120. void (*draw_error_underline) (PangoRenderer *renderer,
  121. int x,
  122. int y,
  123. int width,
  124. int height);
  125. /* Nothing is drawn for shaped glyphs unless this is implemented */
  126. void (*draw_shape) (PangoRenderer *renderer,
  127. PangoAttrShape *attr,
  128. int x,
  129. int y);
  130. /* These two must be implemented and take coordinates in
  131. * device space as doubles.
  132. */
  133. void (*draw_trapezoid) (PangoRenderer *renderer,
  134. PangoRenderPart part,
  135. double y1_,
  136. double x11,
  137. double x21,
  138. double y2,
  139. double x12,
  140. double x22);
  141. void (*draw_glyph) (PangoRenderer *renderer,
  142. PangoFont *font,
  143. PangoGlyph glyph,
  144. double x,
  145. double y);
  146. /* Notification of change in rendering attributes
  147. */
  148. void (*part_changed) (PangoRenderer *renderer,
  149. PangoRenderPart part);
  150. /* Paired around drawing operations
  151. */
  152. void (*begin) (PangoRenderer *renderer);
  153. void (*end) (PangoRenderer *renderer);
  154. /* Hooks into the details of layout rendering
  155. */
  156. void (*prepare_run) (PangoRenderer *renderer,
  157. PangoLayoutRun *run);
  158. /* All of the following have default implementations
  159. * and take as coordinates user coordinates in Pango units
  160. */
  161. void (*draw_glyph_item) (PangoRenderer *renderer,
  162. const char *text,
  163. PangoGlyphItem *glyph_item,
  164. int x,
  165. int y);
  166. /*< private >*/
  167. /* Padding for future expansion */
  168. void (*_pango_reserved2) (void);
  169. void (*_pango_reserved3) (void);
  170. void (*_pango_reserved4) (void);
  171. };
  172. GType pango_renderer_get_type (void) G_GNUC_CONST;
  173. void pango_renderer_draw_layout (PangoRenderer *renderer,
  174. PangoLayout *layout,
  175. int x,
  176. int y);
  177. void pango_renderer_draw_layout_line (PangoRenderer *renderer,
  178. PangoLayoutLine *line,
  179. int x,
  180. int y);
  181. void pango_renderer_draw_glyphs (PangoRenderer *renderer,
  182. PangoFont *font,
  183. PangoGlyphString *glyphs,
  184. int x,
  185. int y);
  186. void pango_renderer_draw_glyph_item (PangoRenderer *renderer,
  187. const char *text,
  188. PangoGlyphItem *glyph_item,
  189. int x,
  190. int y);
  191. void pango_renderer_draw_rectangle (PangoRenderer *renderer,
  192. PangoRenderPart part,
  193. int x,
  194. int y,
  195. int width,
  196. int height);
  197. void pango_renderer_draw_error_underline (PangoRenderer *renderer,
  198. int x,
  199. int y,
  200. int width,
  201. int height);
  202. void pango_renderer_draw_trapezoid (PangoRenderer *renderer,
  203. PangoRenderPart part,
  204. double y1_,
  205. double x11,
  206. double x21,
  207. double y2,
  208. double x12,
  209. double x22);
  210. void pango_renderer_draw_glyph (PangoRenderer *renderer,
  211. PangoFont *font,
  212. PangoGlyph glyph,
  213. double x,
  214. double y);
  215. void pango_renderer_activate (PangoRenderer *renderer);
  216. void pango_renderer_deactivate (PangoRenderer *renderer);
  217. void pango_renderer_part_changed (PangoRenderer *renderer,
  218. PangoRenderPart part);
  219. void pango_renderer_set_color (PangoRenderer *renderer,
  220. PangoRenderPart part,
  221. const PangoColor *color);
  222. PangoColor *pango_renderer_get_color (PangoRenderer *renderer,
  223. PangoRenderPart part);
  224. void pango_renderer_set_matrix (PangoRenderer *renderer,
  225. const PangoMatrix *matrix);
  226. G_CONST_RETURN PangoMatrix *pango_renderer_get_matrix (PangoRenderer *renderer);
  227. PangoLayout *pango_renderer_get_layout (PangoRenderer *renderer);
  228. PangoLayoutLine *pango_renderer_get_layout_line (PangoRenderer *renderer);
  229. G_END_DECLS
  230. #endif /* __PANGO_RENDERER_H_ */