diff options
author | Owen Taylor <otaylor@redhat.com> | 2004-09-24 17:40:46 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2004-09-24 17:40:46 +0000 |
commit | 0b140650f239bd8fec38c9e5a2d09e95dd8440c0 (patch) | |
tree | f5e9cda843855b2f5fbd2be472269660ead9aac3 /pango/pango-renderer.h | |
parent | 763ab93cb59c0f3ff1b540afbbe1b5a689d2a4fb (diff) | |
download | pango-0b140650f239bd8fec38c9e5a2d09e95dd8440c0.tar.gz |
Up version to 1.7.0.
Fri Sep 24 12:59:22 2004 Owen Taylor <otaylor@redhat.com>
* configure.in: Up version to 1.7.0.
* pango/pango-renderer.[ch] pango/pango.h pango/Makefile.am:
Add PangoRenderer, a base class that is subclassed to produce
rendering drivers for different backends and purposes.
* pango/pangoft2-private.h pango/pangoft2-render.c
pango/pangoft2.c: Move rendering into pangoft2-render.c,
use PangoRenderer.
* pango/pangoft2-fontmap.c pango/pangoft2-private.h: Add
_pango_ft2_font_map_get_renderer() to retrieve a singleton
fontmap for the fontmap.
* pango/pangoxft-render.[ch] pango/pangoxft.c pango/Makefile.am:
Make Xft rendering use PangoRenderer, add publically
visible, subclassable PangoXftRenderer.
* pango/pangoxft-fontmap.c pango/pangoxft-private.h: Add
_pango_xft_font_map_get_renderer() to retrieve a singleton
fontmap for the fontmap.
* examples/xftview.c examples/Makefile.am: Add a test program
using the Xft backend.
* docs/*: Update minimally for PangoRenderer.
Diffstat (limited to 'pango/pango-renderer.h')
-rw-r--r-- | pango/pango-renderer.h | 238 |
1 files changed, 238 insertions, 0 deletions
diff --git a/pango/pango-renderer.h b/pango/pango-renderer.h new file mode 100644 index 00000000..5c587f85 --- /dev/null +++ b/pango/pango-renderer.h @@ -0,0 +1,238 @@ +/* Pango + * pango-renderer.h: Base class for rendering + * + * Copyright (C) 2004, Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library 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. + */ +#ifndef __PANGO_RENDERER_H_ +#define __PANGO_RENDERER_H_ + +#include <pango/pango-layout.h> + +G_BEGIN_DECLS + +#define PANGO_TYPE_RENDERER (pango_renderer_get_type()) +#define PANGO_RENDERER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_RENDERER, PangoRenderer)) +#define PANGO_IS_RENDERER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_RENDERER)) +#define PANGO_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_RENDERER, PangoRendererClass)) +#define PANGO_IS_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_RENDERER)) +#define PANGO_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_RENDERER, PangoRendererClass)) + +typedef struct _PangoRenderer PangoRenderer; +typedef struct _PangoRendererClass PangoRendererClass; +typedef struct _PangoRendererPrivate PangoRendererPrivate; + +/** + * PangoRenderPart: + * @PANGO_RENDER_PART_FOREGROUND: the text itself + * @PANGO_RENDER_PART_BACKGROUND: the area behind the text + * @PANGO_RENDER_PART_UNDERLINE: underlines + * @PANGO_RENDER_PART_STRIKETHROUGH: strikethrough lines + * + * #PangoRenderPart defines different items to render for such + * purposes as setting colors. + * + * Since: 1.8 + **/ +/* When extending, note N_RENDER_PARTS #define in pango-renderer.c */ +typedef enum +{ + PANGO_RENDER_PART_FOREGROUND, + PANGO_RENDER_PART_BACKGROUND, + PANGO_RENDER_PART_UNDERLINE, + PANGO_RENDER_PART_STRIKETHROUGH +} PangoRenderPart; + +/** + * PangoRenderer: + * @matrix: the current transformation matrix for the Renderer; may + * be %NULL, which should be treated the same as the identity matrix. + * + * #PangoRenderer is a base class for objects that are used to + * render Pango objects such as #PangoGlyphString and + * #PangoLayout. + * + * Since: 1.8 + **/ +struct _PangoRenderer +{ + /*< private >*/ + GObject parent_instance; + + PangoUnderline underline; + gboolean strikethrough; + int active_count; + + /*< public >*/ + PangoMatrix *matrix; /* May be NULL */ + + /*< private >*/ + PangoRendererPrivate *priv; +}; + +/** + * PangoRendererClass: + * @draw_glyphs: draws a #PangoGlyphString + * @draw_rectangle: draws a rectangle + * @draw_error_underline: draws a squiggly line that approximately + * covers the given rectangle in the style of an underline used to + * indicate a spelling error. + * @draw_trapezoid: draws a trapezoidal filled area + * @draw_glyph: draws a single glyph + * @part_changed: do renderer specific processing when rendering + * attributes change + * @color_set: updates the renderer when a color has changed. + * if @color is %NULL, means that the color has been unset + * @begin: Do renderer-specific initialization before drawing + * @end: Do renderer-specific cleanup after drawing + * @prepare_run: updates the renderer for a new run + * + * Class structure for #PangoRenderer. + * + * Since: 1.8 + **/ +struct _PangoRendererClass +{ + /*< private >*/ + GObjectClass parent_class; + + /* vtable - not signals */ + /*< public >*/ + + /* All of the following have default implementations + * and take as coordinates user coordinates in Pango units + */ + void (*draw_glyphs) (PangoRenderer *renderer, + PangoFont *font, + PangoGlyphString *glyphs, + int x, + int y); + void (*draw_rectangle) (PangoRenderer *renderer, + PangoRenderPart part, + int x, + int y, + int width, + int height); + void (*draw_error_underline) (PangoRenderer *renderer, + int x, + int y, + int width, + int height); + + /* These two must be implemented and take coordinates in + * device space as doubles. + */ + void (*draw_trapezoid) (PangoRenderer *renderer, + PangoRenderPart part, + double y1, + double x11, + double x21, + double y2, + double x12, + double x22); + void (*draw_glyph) (PangoRenderer *renderer, + PangoFont *font, + PangoGlyph glyph, + double x, + double y); + + /* Notification of change in rendering attributes + */ + void (*part_changed) (PangoRenderer *renderer, + PangoRenderPart part); + void (*color_set) (PangoRenderer *renderer, + PangoRenderPart part, + PangoColor *color); + + /* Paired around drawing operations + */ + void (*begin) (PangoRenderer *renderer); + void (*end) (PangoRenderer *renderer); + + /* Hooks into the details of layout rendering + */ + void (*prepare_run) (PangoRenderer *renderer, + PangoLayoutRun *run); + + /*< private >*/ + + /* Padding for future expansion */ + void (*_pango_reserved1) (void); + void (*_pango_reserved2) (void); + void (*_pango_reserved3) (void); + void (*_pango_reserved4) (void); +}; + +GType pango_renderer_get_type (void); + +void pango_renderer_draw_layout (PangoRenderer *renderer, + PangoLayout *layout, + int x, + int y); +void pango_renderer_draw_layout_line (PangoRenderer *renderer, + PangoLayoutLine *line, + int x, + int y); +void pango_renderer_draw_glyphs (PangoRenderer *renderer, + PangoFont *font, + PangoGlyphString *glyphs, + int x, + int y); +void pango_renderer_draw_rectangle (PangoRenderer *renderer, + PangoRenderPart part, + int x, + int y, + int width, + int height); +void pango_renderer_draw_error_underline (PangoRenderer *renderer, + int x, + int y, + int width, + int height); +void pango_renderer_draw_trapezoid (PangoRenderer *renderer, + PangoRenderPart part, + double y1, + double x11, + double x21, + double y2, + double x12, + double x22); +void pango_renderer_draw_glyph (PangoRenderer *renderer, + PangoFont *font, + PangoGlyph glyph, + double x, + double y); + +void pango_renderer_activate (PangoRenderer *renderer); +void pango_renderer_deactivate (PangoRenderer *renderer); + +void pango_renderer_part_changed (PangoRenderer *renderer, + PangoRenderPart part); +void pango_renderer_set_color (PangoRenderer *renderer, + PangoRenderPart part, + PangoColor *color); +PangoColor *pango_renderer_get_color (PangoRenderer *renderer, + PangoRenderPart part); + +void pango_renderer_set_matrix (PangoRenderer *renderer, + const PangoMatrix *matrix); +G_CONST_RETURN PangoMatrix *pango_renderer_get_matrix (PangoRenderer *renderer); + +G_END_DECLS + +#endif /* __PANGO_RENDERER_H_ */ + |