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/pangoxft-render.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/pangoxft-render.h')
-rw-r--r-- | pango/pangoxft-render.h | 142 |
1 files changed, 142 insertions, 0 deletions
diff --git a/pango/pangoxft-render.h b/pango/pangoxft-render.h new file mode 100644 index 00000000..00390928 --- /dev/null +++ b/pango/pangoxft-render.h @@ -0,0 +1,142 @@ +/* Pango + * pangoxft-render.h: Rendering routines for the Xft library + * + * Copyright (C) 2004 Red Hat Software + * + * 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 __PANGOXFT_RENDER_H__ +#define __PANGOXFT_RENDER_H__ + +#include <pango/pango-renderer.h> + +G_BEGIN_DECLS + +#define _XFT_NO_COMPAT +#define _XFTCOMPAT_H_ +#include <X11/Xlib.h> +#include <X11/Xft/Xft.h> +#if defined(XftVersion) && XftVersion >= 20000 +#else +#error "must have Xft version 2 or newer" +#endif + +typedef struct _PangoXftRenderer PangoXftRenderer; +typedef struct _PangoXftRendererClass PangoXftRendererClass; +typedef struct _PangoXftRendererPrivate PangoXftRendererPrivate; + +#define PANGO_TYPE_XFT_RENDERER (pango_xft_renderer_get_type()) +#define PANGO_XFT_RENDERER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_XFT_RENDERER, PangoXftRenderer)) +#define PANGO_IS_XFT_RENDERER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_XFT_RENDERER)) +#define PANGO_XFT_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_XFT_RENDERER, PangoXftRendererClass)) +#define PANGO_IS_XFT_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_XFT_RENDERER)) +#define PANGO_XFT_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_XFT_RENDERER, PangoXftRendererClass)) + +/** + * PangoXftRenderer + * + * #PangoXftRenderer is a subclass of #PangoRenderer used for rendering + * with Pango's Xft backend. It can be used directly, or it can be + * further subclassed to modify exactly how drawing of individual + * elements occurs. + * + * Since: 1.8 + */ +struct _PangoXftRenderer +{ + /*< private >*/ + PangoRenderer parent_instance; + + Display *display; + int screen; + XftDraw *draw; + + PangoXftRendererPrivate *priv; +}; + +/** + * PangoXftRendererClass + * @composite_trapezoids: draw the specified trapezoids using + * the current color and other attributes for @part + * @composite_glyphs: draw the specified glyphs using + * the current color and other attributes for @part + * + * #PangoXftRenderer is a subclass of #PangoRenderer used for rendering + * Renders a #PangoGlyphString onto an Xrender <type>Picture</type> object. + * + * Since: 1.8 + */ +struct _PangoXftRendererClass +{ + /*< private >*/ + PangoRendererClass parent_class; + + /*< public >*/ + void (*composite_trapezoids) (PangoXftRenderer *xftrenderer, + PangoRenderPart part, + XTrapezoid *trapezoids, + int n_trapezoids); + void (*composite_glyphs) (PangoXftRenderer *xftrenderer, + XftFont *xft_font, + XftGlyphSpec *glyphs, + int n_glyphs); +}; + +GType pango_xft_renderer_get_type (void); + +PangoRenderer *pango_xft_renderer_new (Display *display, + int screen); +void pango_xft_renderer_set_draw (PangoXftRenderer *xftrenderer, + XftDraw *draw); +void pango_xft_renderer_set_default_color (PangoXftRenderer *xftrenderer, + PangoColor *default_color); + +void pango_xft_render (XftDraw *draw, + XftColor *color, + PangoFont *font, + PangoGlyphString *glyphs, + gint x, + gint y); +void pango_xft_picture_render (Display *display, + Picture src_picture, + Picture dest_picture, + PangoFont *font, + PangoGlyphString *glyphs, + gint x, + gint y); +void pango_xft_render_transformed (XftDraw *draw, + XftColor *color, + PangoMatrix *matrix, + PangoFont *font, + PangoGlyphString *glyphs, + int x, + int y); +void pango_xft_render_layout_line (XftDraw *draw, + XftColor *color, + PangoLayoutLine *line, + int x, + int y); +void pango_xft_render_layout (XftDraw *draw, + XftColor *color, + PangoLayout *layout, + int x, + int y); + +G_END_DECLS + +#endif /* __PANGOXFT_RENDER_H__ */ + |