gtk/gdk/gdkpango.h
Owen Taylor 3d737ee8ba Add GdkPangoRenderer, a subclass of PangoRenderer targeting GDK drawables.
Sat Nov 20 15:13:51 2004  Owen Taylor  <otaylor@redhat.com>

	* gdk/gdkpango.[ch]: Add GdkPangoRenderer, a subclass of
	PangoRenderer targeting GDK drawables. Use to implement the old
	gdk_draw_layout() and friends.

	* gdk/gdkdraw.c gdk/gdkdrawable.h gdk/gdkwindow.c gdk/gdkpixmap.c:
	Add gdk_draw_glyphs_transformed() gdk_draw_trapezoids() and
	the corresponding members of GdkDrawableClass. Add a fallback
	implementation of gdk_draw_trapezoids() in terms of pixbufs.

	* gdk/gdkwindowing.h gdk/x11/gdkg-x11.h: Add
	_gdk_windowing_gc_get_foreground() to enable the fallback
	trapezoid implementation.

	* gdk/x11/gdkdrawable-x11.c gdk/x11/gdkdisplay-x11.h: Implement
	draw_glyph_transformed,	draw_trapezoids.

	* gdk/x11/gdkdrawable-x11.[ch]: Add
	_gdk_x11_drawable_draw_xtrapezoids, _gdk_x11_drawable_draw_xft_glyphs
	for use of GdkX11Renderer.

	* gdk/x11/gdkgc-x11.c gdk/x11/gdkprivate-x11.h: Implement
	GDK_TILED, GDK_STIPPLED, GDK_OPAQUE_STIPPLED in the RENDER codepath.

	* gdk/gdkpango-x11.c: Add GdkX11Renderer... a subclass of
	PangoXftRenderer that does tiles/stipples and fallback rendering
	of trapezoids without the RENDER extension.

	* gdk/gdkpango-x11.c gdk/x11/gdkscreen-x11.[ch] _gdk_x11_renderer_get:
	Add _gdk_x11_renderer_get() to get a singleton GdkX11Renderer
	for the screen.

	* gdk/x11/gdkdrawable-x11.c (get_impl_drawable): Fix a None/NULL
	confusion.

	* gtk/gtklabel.[ch] gtk/gtk.symbols: Add gtk_label_set/get_angle(),
	and an ::angle property.

	* gtk/gtklabel.c: Remove #if 0'd dead code gtk_label_paint_word().

	* gtk/gtktextdisplay.c: Switch to using a GtkTextRenderer subclass
	of GdkPangoRenderer for drawing.

	* gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c: Switch to using
	gtk_attr_shape_new_with_data() to store backreferences to
	embedded pixmaps and widgets. Leave line_display->shaped_objects
	around for backwords compatibility.

	* gdk/gdkpango.[ch] (gdk_pango_context_set_colormap): Describe
	as deprecated, remove implementation.

	* gtk/gtkwidget.c (gtk_widget_create_pango_context): Remove
	call to gdk_pango_context_set_colormap.

	* demos/gtk-demo/Makefile.am demos/gtk-demo/rotated_text.c: Add
	a demo showing drawing rotated text.

	* tests/testgtk.c: Add a rotated-label test, and also a rotated
	drawing test (differs from demos/gtk-demo/rotated_text by also
	using a tile)
2004-11-21 16:24:01 +00:00

159 lines
5.8 KiB
C

/* GDK - The GIMP Drawing Kit
* Copyright (C) 2000 Red Hat, Inc.
*
* 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.
*/
#ifndef __GDK_PANGO_H__
#define __GDK_PANGO_H__
#include <gdk/gdktypes.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* Pango interaction */
typedef struct _GdkPangoRenderer GdkPangoRenderer;
typedef struct _GdkPangoRendererClass GdkPangoRendererClass;
typedef struct _GdkPangoRendererPrivate GdkPangoRendererPrivate;
#define GDK_TYPE_PANGO_RENDERER (gdk_pango_renderer_get_type())
#define GDK_PANGO_RENDERER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PANGO_RENDERER, GdkPangoRenderer))
#define GDK_IS_PANGO_RENDERER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PANGO_RENDERER))
#define GDK_PANGO_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PANGO_RENDERER, GdkPangoRendererClass))
#define GDK_IS_PANGO_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PANGO_RENDERER))
#define GDK_PANGO_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PANGO_RENDERER, GdkPangoRendererClass))
/**
* GdkPangoRenderer:
*
* #GdkPangoRenderer is a subclass of #PangoRenderer used for rendering
* Pango objects into GDK drawables. The default renderer for a particular
* screen is obtained with gdk_pango_renderer_get_default(); Pango
* functions like pango_renderer_draw_layout() and
* pango_renderer_draw_layout_line() are then used to draw objects with
* the renderer.
*
* In most simple cases, applications can just use gdk_draw_layout(), and
* don't need to directly use #GdkPangoRenderer at all. Using the
* #GdkPangoRenderer directly is most useful when working with a
* transformation such as a rotation, because the Pango drawing functions
* take user space coordinates (coordinates before the transformation)
* instead of device coordinates.
*
* In certain cases it can be useful to subclass #GdkPangoRenderer. Examples
* of reasons to do this are to add handling of custom attributes by
* overriding 'prepare_run' or to do custom drawing of embedded objects
* by overriding 'draw_shape'.
*
* Since: 2.6
**/
struct _GdkPangoRenderer
{
/*< private >*/
PangoRenderer parent_instance;
GdkPangoRendererPrivate *priv;
};
/**
* GdkPangoRendererClass:
*
* #GdkPangoRenderer is the class structure for #GdkPangoRenderer.
*
* Since: 2.6
**/
struct _GdkPangoRendererClass
{
/*< private >*/
PangoRendererClass parent_class;
};
GType gdk_pango_renderer_get_type (void) G_GNUC_CONST;
PangoRenderer *gdk_pango_renderer_new (GdkScreen *screen);
PangoRenderer *gdk_pango_renderer_get_default (GdkScreen *screen);
void gdk_pango_renderer_set_drawable (GdkPangoRenderer *gdk_renderer,
GdkDrawable *drawable);
void gdk_pango_renderer_set_gc (GdkPangoRenderer *gdk_renderer,
GdkGC *gc);
void gdk_pango_renderer_set_stipple (GdkPangoRenderer *gdk_renderer,
PangoRenderPart part,
GdkBitmap *stipple);
void gdk_pango_renderer_set_override_color (GdkPangoRenderer *gdk_renderer,
PangoRenderPart part,
const GdkColor *color);
/************************************************************************/
PangoContext *gdk_pango_context_get_for_screen (GdkScreen *screen);
#ifndef GDK_MULTIHEAD_SAFE
PangoContext *gdk_pango_context_get (void);
#endif
#ifndef GDK_DISABLE_DEPRECATED
void gdk_pango_context_set_colormap (PangoContext *context,
GdkColormap *colormap);
#endif
/* Get a clip region to draw only part of a layout or
* line. index_ranges contains alternating range starts/stops. The
* region is the region which contains the given ranges, i.e. if you
* draw with the region as clip, only the given ranges are drawn.
*/
GdkRegion *gdk_pango_layout_line_get_clip_region (PangoLayoutLine *line,
gint x_origin,
gint y_origin,
gint *index_ranges,
gint n_ranges);
GdkRegion *gdk_pango_layout_get_clip_region (PangoLayout *layout,
gint x_origin,
gint y_origin,
gint *index_ranges,
gint n_ranges);
/* Attributes use to render insensitive text in GTK+. */
typedef struct _GdkPangoAttrStipple GdkPangoAttrStipple;
typedef struct _GdkPangoAttrEmbossed GdkPangoAttrEmbossed;
struct _GdkPangoAttrStipple
{
PangoAttribute attr;
GdkBitmap *stipple;
};
struct _GdkPangoAttrEmbossed
{
PangoAttribute attr;
gboolean embossed;
};
PangoAttribute *gdk_pango_attr_stipple_new (GdkBitmap *stipple);
PangoAttribute *gdk_pango_attr_embossed_new (gboolean embossed);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __GDK_FONT_H__ */