API: remove gdk_draw_glyphs() and gdk_draw_glyphs_transformed()

This commit is contained in:
Benjamin Otte 2010-07-14 16:03:51 +02:00
parent 92f4882497
commit 89d28eb09d
8 changed files with 4 additions and 296 deletions

View File

@ -342,8 +342,6 @@ gdk_draw_segments
GdkSegment
gdk_draw_rectangle
gdk_draw_polygon
gdk_draw_glyphs
gdk_draw_glyphs_transformed
gdk_draw_layout_line
gdk_draw_layout_line_with_colors
gdk_draw_layout

View File

@ -219,33 +219,6 @@ function.
@n_points:
<!-- ##### FUNCTION gdk_draw_glyphs ##### -->
<para>
</para>
@drawable:
@gc:
@font:
@x:
@y:
@glyphs:
<!-- ##### FUNCTION gdk_draw_glyphs_transformed ##### -->
<para>
</para>
@drawable:
@gc:
@matrix:
@font:
@x:
@y:
@glyphs:
<!-- ##### FUNCTION gdk_draw_layout_line ##### -->
<para>

View File

@ -25,11 +25,10 @@ linkend="PANGO-SCALE-CAPS">PANGO_SCALE</link> or the PANGO_PIXELS() macro.)
</para>
<para>
Rendering a Pango layout is done most simply with gdk_draw_layout();
you can also draw pieces of the layout with gdk_draw_layout() or
gdk_draw_glyphs(). #GdkPangoRenderer is a subclass of #PangoRenderer
that is used internally to implement these functions. Using it
directly or subclassing it can be useful in some cases. See the
#GdkPangoRenderer documentation for details.
you can also draw pieces of the layout with gdk_draw_layout().
#GdkPangoRenderer is a subclass of #PangoRenderer that is used internally
to implement these functions. Using it directly or subclassing it can be
useful in some cases. See the #GdkPangoRenderer documentation for details.
</para>
<example id="rotated-example">
<title>Using #GdkPangoRenderer to draw transformed text</title>

View File

@ -550,8 +550,6 @@ gdk_drawable_get_visible_region
gdk_drawable_get_visual
gdk_drawable_set_colormap
gdk_draw_drawable
gdk_draw_glyphs
gdk_draw_glyphs_transformed
gdk_draw_line
gdk_draw_lines
gdk_draw_point

View File

@ -530,113 +530,6 @@ gdk_draw_lines (GdkDrawable *drawable,
(GdkPoint *) points, n_points);
}
static void
real_draw_glyphs (GdkDrawable *drawable,
GdkGC *gc,
const PangoMatrix *matrix,
PangoFont *font,
gdouble x,
gdouble y,
PangoGlyphString *glyphs)
{
cairo_t *cr;
cr = gdk_cairo_create (drawable);
_gdk_gc_update_context (gc, cr, NULL, NULL, TRUE, drawable);
if (matrix)
{
cairo_matrix_t cairo_matrix;
cairo_matrix.xx = matrix->xx;
cairo_matrix.yx = matrix->yx;
cairo_matrix.xy = matrix->xy;
cairo_matrix.yy = matrix->yy;
cairo_matrix.x0 = matrix->x0;
cairo_matrix.y0 = matrix->y0;
cairo_set_matrix (cr, &cairo_matrix);
}
cairo_move_to (cr, x, y);
pango_cairo_show_glyph_string (cr, font, glyphs);
cairo_destroy (cr);
}
/**
* gdk_draw_glyphs:
* @drawable: a #GdkDrawable
* @gc: a #GdkGC
* @font: font to be used
* @x: X coordinate of baseline origin
* @y: Y coordinate of baseline origin
* @glyphs: the glyph string to draw
*
* This is a low-level function; 99% of text rendering should be done
* using gdk_draw_layout() instead.
*
* A glyph is a single image in a font. This function draws a sequence of
* glyphs. To obtain a sequence of glyphs you have to understand a
* lot about internationalized text handling, which you don't want to
* understand; thus, use gdk_draw_layout() instead of this function,
* gdk_draw_layout() handles the details.
*
**/
void
gdk_draw_glyphs (GdkDrawable *drawable,
GdkGC *gc,
PangoFont *font,
gint x,
gint y,
PangoGlyphString *glyphs)
{
g_return_if_fail (GDK_IS_DRAWABLE (drawable));
g_return_if_fail (GDK_IS_GC (gc));
real_draw_glyphs (drawable, gc, NULL, font,
x, y, glyphs);
}
/**
* gdk_draw_glyphs_transformed:
* @drawable: a #GdkDrawable
* @gc: a #GdkGC
* @matrix: (allow-none): a #PangoMatrix, or %NULL to use an identity transformation
* @font: the font in which to draw the string
* @x: the x position of the start of the string (in Pango
* units in user space coordinates)
* @y: the y position of the baseline (in Pango units
* in user space coordinates)
* @glyphs: the glyph string to draw
*
* Renders a #PangoGlyphString onto a drawable, possibly
* transforming the layed-out coordinates through a transformation
* matrix. Note that the transformation matrix for @font is not
* changed, so to produce correct rendering results, the @font
* must have been loaded using a #PangoContext with an identical
* transformation matrix to that passed in to this function.
*
* See also gdk_draw_glyphs(), gdk_draw_layout().
*
* Since: 2.6
**/
void
gdk_draw_glyphs_transformed (GdkDrawable *drawable,
GdkGC *gc,
const PangoMatrix *matrix,
PangoFont *font,
gint x,
gint y,
PangoGlyphString *glyphs)
{
g_return_if_fail (GDK_IS_DRAWABLE (drawable));
g_return_if_fail (GDK_IS_GC (gc));
real_draw_glyphs (drawable, gc, matrix, font,
x / PANGO_SCALE, y / PANGO_SCALE, glyphs);
}
static GdkDrawable *
gdk_drawable_real_get_composite_drawable (GdkDrawable *drawable,
gint x,

View File

@ -94,13 +94,6 @@ struct _GdkDrawableClass
GdkPoint *points,
gint npoints);
void (*draw_glyphs) (GdkDrawable *drawable,
GdkGC *gc,
PangoFont *font,
gint x,
gint y,
PangoGlyphString *glyphs);
gint (*get_depth) (GdkDrawable *drawable);
void (*get_size) (GdkDrawable *drawable,
gint *width,
@ -124,14 +117,6 @@ struct _GdkDrawableClass
gint *composite_x_offset,
gint *composite_y_offset);
void (*draw_glyphs_transformed) (GdkDrawable *drawable,
GdkGC *gc,
PangoMatrix *matrix,
PangoFont *font,
gint x,
gint y,
PangoGlyphString *glyphs);
cairo_surface_t *(*ref_cairo_surface) (GdkDrawable *drawable);
GdkDrawable *(*get_source_drawable) (GdkDrawable *drawable);
@ -226,12 +211,6 @@ void gdk_draw_lines (GdkDrawable *drawable,
const GdkPoint *points,
gint n_points);
void gdk_draw_glyphs (GdkDrawable *drawable,
GdkGC *gc,
PangoFont *font,
gint x,
gint y,
PangoGlyphString *glyphs);
void gdk_draw_layout_line (GdkDrawable *drawable,
GdkGC *gc,
gint x,
@ -258,14 +237,6 @@ void gdk_draw_layout_with_colors (GdkDrawable *drawable,
const GdkColor *foreground,
const GdkColor *background);
void gdk_draw_glyphs_transformed (GdkDrawable *drawable,
GdkGC *gc,
const PangoMatrix *matrix,
PangoFont *font,
gint x,
gint y,
PangoGlyphString *glyphs);
cairo_region_t *gdk_drawable_get_clip_region (GdkDrawable *drawable);
cairo_region_t *gdk_drawable_get_visible_region (GdkDrawable *drawable);

View File

@ -69,20 +69,6 @@ static void gdk_pixmap_draw_lines (GdkDrawable *drawable,
GdkPoint *points,
gint npoints);
static void gdk_pixmap_draw_glyphs (GdkDrawable *drawable,
GdkGC *gc,
PangoFont *font,
gint x,
gint y,
PangoGlyphString *glyphs);
static void gdk_pixmap_draw_glyphs_transformed (GdkDrawable *drawable,
GdkGC *gc,
PangoMatrix *matrix,
PangoFont *font,
gint x,
gint y,
PangoGlyphString *glyphs);
static void gdk_pixmap_real_get_size (GdkDrawable *drawable,
gint *width,
gint *height);
@ -146,8 +132,6 @@ gdk_pixmap_class_init (GdkPixmapObjectClass *klass)
drawable_class->draw_points = gdk_pixmap_draw_points;
drawable_class->draw_segments = gdk_pixmap_draw_segments;
drawable_class->draw_lines = gdk_pixmap_draw_lines;
drawable_class->draw_glyphs = gdk_pixmap_draw_glyphs;
drawable_class->draw_glyphs_transformed = gdk_pixmap_draw_glyphs_transformed;
drawable_class->get_depth = gdk_pixmap_real_get_depth;
drawable_class->get_screen = gdk_pixmap_real_get_screen;
drawable_class->get_size = gdk_pixmap_real_get_size;
@ -315,35 +299,6 @@ gdk_pixmap_draw_lines (GdkDrawable *drawable,
gdk_draw_lines (private->impl, gc, points, npoints);
}
static void
gdk_pixmap_draw_glyphs (GdkDrawable *drawable,
GdkGC *gc,
PangoFont *font,
gint x,
gint y,
PangoGlyphString *glyphs)
{
GdkPixmapObject *private = (GdkPixmapObject *)drawable;
_gdk_gc_remove_drawable_clip (gc);
gdk_draw_glyphs (private->impl, gc, font, x, y, glyphs);
}
static void
gdk_pixmap_draw_glyphs_transformed (GdkDrawable *drawable,
GdkGC *gc,
PangoMatrix *matrix,
PangoFont *font,
gint x,
gint y,
PangoGlyphString *glyphs)
{
GdkPixmapObject *private = (GdkPixmapObject *)drawable;
_gdk_gc_remove_drawable_clip (gc);
gdk_draw_glyphs_transformed (private->impl, gc, matrix, font, x, y, glyphs);
}
static void
gdk_pixmap_real_get_size (GdkDrawable *drawable,
gint *width,

View File

@ -264,20 +264,6 @@ static void gdk_window_draw_lines (GdkDrawable *drawable,
GdkPoint *points,
gint npoints);
static void gdk_window_draw_glyphs (GdkDrawable *drawable,
GdkGC *gc,
PangoFont *font,
gint x,
gint y,
PangoGlyphString *glyphs);
static void gdk_window_draw_glyphs_transformed (GdkDrawable *drawable,
GdkGC *gc,
PangoMatrix *matrix,
PangoFont *font,
gint x,
gint y,
PangoGlyphString *glyphs);
static cairo_surface_t *gdk_window_ref_cairo_surface (GdkDrawable *drawable);
static cairo_surface_t *gdk_window_create_cairo_surface (GdkDrawable *drawable,
int width,
@ -461,8 +447,6 @@ gdk_window_class_init (GdkWindowObjectClass *klass)
drawable_class->draw_points = gdk_window_draw_points;
drawable_class->draw_segments = gdk_window_draw_segments;
drawable_class->draw_lines = gdk_window_draw_lines;
drawable_class->draw_glyphs = gdk_window_draw_glyphs;
drawable_class->draw_glyphs_transformed = gdk_window_draw_glyphs_transformed;
drawable_class->get_depth = gdk_window_real_get_depth;
drawable_class->get_screen = gdk_window_real_get_screen;
drawable_class->get_size = gdk_window_real_get_size;
@ -4369,69 +4353,6 @@ gdk_window_draw_lines (GdkDrawable *drawable,
END_DRAW;
}
static void
gdk_window_draw_glyphs (GdkDrawable *drawable,
GdkGC *gc,
PangoFont *font,
gint x,
gint y,
PangoGlyphString *glyphs)
{
if (GDK_WINDOW_DESTROYED (drawable))
return;
BEGIN_DRAW;
gdk_draw_glyphs (impl, gc, font,
x - x_offset, y - y_offset, glyphs);
END_DRAW;
}
static void
gdk_window_draw_glyphs_transformed (GdkDrawable *drawable,
GdkGC *gc,
PangoMatrix *matrix,
PangoFont *font,
gint x,
gint y,
PangoGlyphString *glyphs)
{
PangoMatrix tmp_matrix;
if (GDK_WINDOW_DESTROYED (drawable))
return;
BEGIN_DRAW;
if (x_offset != 0 || y_offset != 0)
{
if (matrix)
{
tmp_matrix = *matrix;
tmp_matrix.x0 -= x_offset;
tmp_matrix.y0 -= y_offset;
matrix = &tmp_matrix;
}
else if (GDK_PANGO_UNITS_OVERFLOWS (x_offset, y_offset))
{
PangoMatrix identity = PANGO_MATRIX_INIT;
tmp_matrix = identity;
tmp_matrix.x0 -= x_offset;
tmp_matrix.y0 -= y_offset;
matrix = &tmp_matrix;
}
else
{
x -= x_offset * PANGO_SCALE;
y -= y_offset * PANGO_SCALE;
}
}
gdk_draw_glyphs_transformed (impl, gc, matrix, font, x, y, glyphs);
END_DRAW;
}
static cairo_t *
setup_backing_rect (GdkWindow *window, GdkWindowPaint *paint, int x_offset_cairo, int y_offset_cairo)
{