Commit 1ac8d80e authored by Benjamin Otte's avatar Benjamin Otte

API: remove GdkPangoRenderer

Also removes the pango attributes for stipple, emboss and emboss color
parent fea39c07
...@@ -717,35 +717,8 @@ GDK_TYPE_PROP_MODE ...@@ -717,35 +717,8 @@ GDK_TYPE_PROP_MODE
<SECTION> <SECTION>
<TITLE>Pango Interaction</TITLE> <TITLE>Pango Interaction</TITLE>
<FILE>pango_interaction</FILE> <FILE>pango_interaction</FILE>
GdkPangoRenderer
GdkPangoRendererClass
gdk_pango_renderer_new
gdk_pango_renderer_get_default
gdk_pango_renderer_set_drawable
gdk_pango_renderer_set_gc
gdk_pango_renderer_set_stipple
gdk_pango_renderer_set_override_color
gdk_pango_context_get
gdk_pango_context_get_for_screen
GdkPangoAttrEmbossed
GdkPangoAttrEmbossColor
GdkPangoAttrStipple
gdk_pango_attr_emboss_color_new
gdk_pango_attr_embossed_new
gdk_pango_attr_stipple_new
gdk_pango_layout_get_clip_region gdk_pango_layout_get_clip_region
gdk_pango_layout_line_get_clip_region gdk_pango_layout_line_get_clip_region
<SUBSECTION Standard>
GDK_TYPE_PANGO_RENDERER
GDK_PANGO_RENDERER
GDK_IS_PANGO_RENDERER
GDK_PANGO_RENDERER_CLASS
GDK_IS_PANGO_RENDERER_CLASS
GDK_PANGO_RENDERER_GET_CLASS
<SUBSECTION Private>
gdk_pango_renderer_get_type
GdkPangoRendererPrivate
</SECTION> </SECTION>
<SECTION> <SECTION>
......
...@@ -5,7 +5,6 @@ gdk_display_manager_get_type ...@@ -5,7 +5,6 @@ gdk_display_manager_get_type
gdk_screen_get_type gdk_screen_get_type
gdk_drawable_get_type gdk_drawable_get_type
gdk_window_object_get_type gdk_window_object_get_type
gdk_pango_renderer_get_type
gdk_pixmap_get_type gdk_pixmap_get_type
gdk_gc_get_type gdk_gc_get_type
gdk_keymap_get_type gdk_keymap_get_type
......
...@@ -134,150 +134,6 @@ g_object_unref (gc); ...@@ -134,150 +134,6 @@ g_object_unref (gc);
<!-- ##### SECTION Image ##### --> <!-- ##### SECTION Image ##### -->
<!-- ##### STRUCT GdkPangoRenderer ##### -->
<para>
</para>
<!-- ##### ARG GdkPangoRenderer:screen ##### -->
<para>
</para>
<!-- ##### STRUCT GdkPangoRendererClass ##### -->
<para>
</para>
<!-- ##### FUNCTION gdk_pango_renderer_new ##### -->
<para>
</para>
@screen:
@Returns:
<!-- ##### FUNCTION gdk_pango_renderer_get_default ##### -->
<para>
</para>
@screen:
@Returns:
<!-- ##### FUNCTION gdk_pango_renderer_set_drawable ##### -->
<para>
</para>
@gdk_renderer:
@drawable:
<!-- ##### FUNCTION gdk_pango_renderer_set_gc ##### -->
<para>
</para>
@gdk_renderer:
@gc:
<!-- ##### FUNCTION gdk_pango_renderer_set_stipple ##### -->
<para>
</para>
@gdk_renderer:
@part:
@stipple:
<!-- ##### FUNCTION gdk_pango_renderer_set_override_color ##### -->
<para>
</para>
@gdk_renderer:
@part:
@color:
<!-- ##### FUNCTION gdk_pango_context_get ##### -->
<para>
</para>
@void:
@Returns:
<!-- ##### FUNCTION gdk_pango_context_get_for_screen ##### -->
<para>
</para>
@screen:
@Returns:
<!-- ##### STRUCT GdkPangoAttrEmbossed ##### -->
<para>
A Pango text attribute containing a embossed bitmap to be used when
rendering the text.
</para>
@attr: the #PangoAttribute.
@embossed: the embossed bitmap.
<!-- ##### STRUCT GdkPangoAttrEmbossColor ##### -->
<para>
A Pango text attribute specifying the color to emboss text with.
</para>
@attr: the #PangoAttribute
@color: the color
<!-- ##### STRUCT GdkPangoAttrStipple ##### -->
<para>
A Pango text attribute containing a stipple bitmap to be used when
rendering the text.
</para>
@attr: the #PangoAttribute.
@stipple: the stipple bitmap.
<!-- ##### FUNCTION gdk_pango_attr_emboss_color_new ##### -->
<para>
</para>
@color:
@Returns:
<!-- ##### FUNCTION gdk_pango_attr_embossed_new ##### -->
<para>
</para>
@embossed:
@Returns:
<!-- ##### FUNCTION gdk_pango_attr_stipple_new ##### -->
<para>
</para>
@stipple:
@Returns:
<!-- ##### FUNCTION gdk_pango_layout_get_clip_region ##### --> <!-- ##### FUNCTION gdk_pango_layout_get_clip_region ##### -->
<para> <para>
......
...@@ -870,20 +870,10 @@ gdk_visual_get_type G_GNUC_CONST ...@@ -870,20 +870,10 @@ gdk_visual_get_type G_GNUC_CONST
#if IN_HEADER(__GDK_PANGO_H__) #if IN_HEADER(__GDK_PANGO_H__)
#if IN_FILE(__GDK_PANGO_C__) #if IN_FILE(__GDK_PANGO_C__)
gdk_pango_attr_emboss_color_new
gdk_pango_attr_embossed_new
gdk_pango_attr_stipple_new
gdk_pango_context_get gdk_pango_context_get
gdk_pango_context_get_for_screen gdk_pango_context_get_for_screen
gdk_pango_layout_get_clip_region gdk_pango_layout_get_clip_region
gdk_pango_layout_line_get_clip_region gdk_pango_layout_line_get_clip_region
gdk_pango_renderer_get_default
gdk_pango_renderer_get_type G_GNUC_CONST
gdk_pango_renderer_new
gdk_pango_renderer_set_drawable
gdk_pango_renderer_set_gc
gdk_pango_renderer_set_override_color
gdk_pango_renderer_set_stipple
#endif #endif
#endif #endif
......
...@@ -1242,225 +1242,3 @@ gdk_gc_set_rgb_bg_color (GdkGC *gc, ...@@ -1242,225 +1242,3 @@ gdk_gc_set_rgb_bg_color (GdkGC *gc,
gdk_gc_set_background (gc, &tmp_color); gdk_gc_set_background (gc, &tmp_color);
} }
static cairo_surface_t *
make_stipple_tile_surface (cairo_t *cr,
GdkBitmap *stipple,
GdkColor *foreground,
GdkColor *background)
{
cairo_t *tmp_cr;
cairo_surface_t *surface;
cairo_surface_t *alpha_surface;
gint width, height;
gdk_drawable_get_size (stipple,
&width, &height);
alpha_surface = _gdk_drawable_ref_cairo_surface (stipple);
surface = cairo_surface_create_similar (cairo_get_target (cr),
CAIRO_CONTENT_COLOR_ALPHA,
width, height);
tmp_cr = cairo_create (surface);
cairo_set_operator (tmp_cr, CAIRO_OPERATOR_SOURCE);
if (background)
gdk_cairo_set_source_color (tmp_cr, background);
else
cairo_set_source_rgba (tmp_cr, 0, 0, 0 ,0);
cairo_paint (tmp_cr);
cairo_set_operator (tmp_cr, CAIRO_OPERATOR_OVER);
gdk_cairo_set_source_color (tmp_cr, foreground);
cairo_mask_surface (tmp_cr, alpha_surface, 0, 0);
cairo_destroy (tmp_cr);
cairo_surface_destroy (alpha_surface);
return surface;
}
static void
gc_get_foreground (GdkGC *gc,
GdkColor *color)
{
GdkGCPrivate *priv = GDK_GC_GET_PRIVATE (gc);
color->pixel = priv->bg_pixel;
if (gc->colormap)
gdk_colormap_query_color (gc->colormap, priv->fg_pixel, color);
else
g_warning ("No colormap in gc_get_foreground");
}
static void
gc_get_background (GdkGC *gc,
GdkColor *color)
{
GdkGCPrivate *priv = GDK_GC_GET_PRIVATE (gc);
color->pixel = priv->bg_pixel;
if (gc->colormap)
gdk_colormap_query_color (gc->colormap, priv->bg_pixel, color);
else
g_warning ("No colormap in gc_get_background");
}
/**
* _gdk_gc_update_context:
* @gc: a #GdkGC
* @cr: a #cairo_t
* @override_foreground: a foreground color to use to override the
* foreground color of the GC
* @override_stipple: a stipple pattern to use to override the
* stipple from the GC. If this is present and the fill mode
* of the GC isn't %GDK_STIPPLED or %GDK_OPAQUE_STIPPLED
* the fill mode will be forced to %GDK_STIPPLED
* @gc_changed: pass %FALSE if the @gc has not changed since the
* last call to this function
* @target_drawable: The drawable you're drawing in. If passed in
* this is used for client side window clip emulation.
*
* Set the attributes of a cairo context to match those of a #GdkGC
* as far as possible. Some aspects of a #GdkGC, such as clip masks
* and functions other than %GDK_COPY are not currently handled.
**/
void
_gdk_gc_update_context (GdkGC *gc,
cairo_t *cr,
const GdkColor *override_foreground,
GdkBitmap *override_stipple,
gboolean gc_changed,
GdkDrawable *target_drawable)
{
GdkGCPrivate *priv;
GdkFill fill;
GdkColor foreground;
GdkColor background;
cairo_surface_t *tile_surface = NULL;
GdkBitmap *stipple = NULL;
g_return_if_fail (GDK_IS_GC (gc));
g_return_if_fail (cr != NULL);
g_return_if_fail (override_stipple == NULL || GDK_IS_PIXMAP (override_stipple));
priv = GDK_GC_GET_PRIVATE (gc);
_gdk_gc_remove_drawable_clip (gc);
fill = priv->fill;
if (override_stipple && fill != GDK_OPAQUE_STIPPLED)
fill = GDK_STIPPLED;
if (fill != GDK_TILED)
{
if (override_foreground)
foreground = *override_foreground;
else
gc_get_foreground (gc, &foreground);
}
if (fill == GDK_OPAQUE_STIPPLED)
gc_get_background (gc, &background);
switch (fill)
{
case GDK_SOLID:
break;
case GDK_TILED:
if (!priv->tile)
fill = GDK_SOLID;
break;
case GDK_STIPPLED:
case GDK_OPAQUE_STIPPLED:
if (override_stipple)
stipple = override_stipple;
else
stipple = priv->stipple;
if (!stipple)
fill = GDK_SOLID;
break;
}
switch (fill)
{
case GDK_SOLID:
gdk_cairo_set_source_color (cr, &foreground);
break;
case GDK_TILED:
tile_surface = _gdk_drawable_ref_cairo_surface (priv->tile);
break;
case GDK_STIPPLED:
tile_surface = make_stipple_tile_surface (cr, stipple, &foreground, NULL);
break;
case GDK_OPAQUE_STIPPLED:
tile_surface = make_stipple_tile_surface (cr, stipple, &foreground, &background);
break;
}
/* Tiles, stipples, and clip regions are all specified in device space,
* not user space. For the clip region, we can simply change the matrix,
* clip, then clip back, but for the source pattern, we need to
* compute the right matrix.
*
* What we want is:
*
* CTM_inverse * Pattern_matrix = Translate(- ts_x, - ts_y)
*
* (So that ts_x, ts_y in device space is taken to 0,0 in pattern
* space). So, pattern_matrix = CTM * Translate(- ts_x, - tx_y);
*/
if (tile_surface)
{
cairo_pattern_t *pattern = cairo_pattern_create_for_surface (tile_surface);
cairo_matrix_t user_to_device;
cairo_matrix_t user_to_pattern;
cairo_matrix_t device_to_pattern;
cairo_get_matrix (cr, &user_to_device);
cairo_matrix_init_translate (&device_to_pattern,
- gc->ts_x_origin, - gc->ts_y_origin);
cairo_matrix_multiply (&user_to_pattern,
&user_to_device, &device_to_pattern);
cairo_pattern_set_matrix (pattern, &user_to_pattern);
cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
cairo_set_source (cr, pattern);
cairo_surface_destroy (tile_surface);
cairo_pattern_destroy (pattern);
}
if (!gc_changed)
return;
cairo_reset_clip (cr);
/* The reset above resets the window clip rect, so we want to re-set that */
if (target_drawable && GDK_DRAWABLE_GET_CLASS (target_drawable)->set_cairo_clip)
GDK_DRAWABLE_GET_CLASS (target_drawable)->set_cairo_clip (target_drawable, cr);
if (priv->clip_region)
{
cairo_save (cr);
cairo_identity_matrix (cr);
cairo_translate (cr, gc->clip_x_origin, gc->clip_y_origin);
cairo_new_path (cr);
gdk_cairo_region (cr, priv->clip_region);
cairo_restore (cr);
cairo_clip (cr);
}
}
...@@ -327,13 +327,6 @@ cairo_surface_t * _gdk_drawable_create_cairo_surface (GdkDrawable *drawable, ...@@ -327,13 +327,6 @@ cairo_surface_t * _gdk_drawable_create_cairo_surface (GdkDrawable *drawable,
/* GC caching */ /* GC caching */
GdkGC *_gdk_drawable_get_subwindow_scratch_gc (GdkDrawable *drawable); GdkGC *_gdk_drawable_get_subwindow_scratch_gc (GdkDrawable *drawable);
void _gdk_gc_update_context (GdkGC *gc,
cairo_t *cr,
const GdkColor *override_foreground,
GdkBitmap *override_stipple,
gboolean gc_changed,
GdkDrawable *target_drawable);
/************************************* /*************************************
* Interfaces used by windowing code * * Interfaces used by windowing code *
*************************************/ *************************************/
......
This diff is collapsed.
...@@ -28,73 +28,6 @@ ...@@ -28,73 +28,6 @@
G_BEGIN_DECLS G_BEGIN_DECLS
/* 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 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); PangoContext *gdk_pango_context_get_for_screen (GdkScreen *screen);
...@@ -120,36 +53,6 @@ cairo_region_t *gdk_pango_layout_get_clip_region (PangoLayout *layou ...@@ -120,36 +53,6 @@ cairo_region_t *gdk_pango_layout_get_clip_region (PangoLayout *layou
const gint *index_ranges, const gint *index_ranges,
gint n_ranges); gint n_ranges);
/* Attributes use to render insensitive text in GTK+. */
typedef struct _GdkPangoAttrStipple GdkPangoAttrStipple;
typedef struct _GdkPangoAttrEmbossed GdkPangoAttrEmbossed;
typedef struct _GdkPangoAttrEmbossColor GdkPangoAttrEmbossColor;
struct _GdkPangoAttrStipple
{
PangoAttribute attr;
GdkBitmap *stipple;
};
struct _GdkPangoAttrEmbossed
{
PangoAttribute attr;
gboolean embossed;
};
struct _GdkPangoAttrEmbossColor
{
PangoAttribute attr;
PangoColor color;
};
PangoAttribute *gdk_pango_attr_stipple_new (GdkBitmap *stipple);
PangoAttribute *gdk_pango_attr_embossed_new (gboolean embossed);
PangoAttribute *gdk_pango_attr_emboss_color_new (const GdkColor *color);
G_END_DECLS G_END_DECLS
#endif /* __GDK_PANGO_H__ */ #endif /* __GDK_PANGO_H__ */
...@@ -84,8 +84,6 @@ test_type (gconstpointer data) ...@@ -84,8 +84,6 @@ test_type (gconstpointer data)
if (g_type_is_a (type, GTK_TYPE_SETTINGS)) if (g_type_is_a (type, GTK_TYPE_SETTINGS))
instance = g_object_ref (gtk_settings_get_default ()); instance = g_object_ref (gtk_settings_get_default ());
else if (g_type_is_a (type, GDK_TYPE_PANGO_RENDERER))
instance = g_object_ref (gdk_pango_renderer_get_default (gdk_screen_get_default ()));
else if (g_type_is_a (type, GDK_TYPE_PIXMAP)) else if (g_type_is_a (type, GDK_TYPE_PIXMAP))
instance = g_object_ref (gdk_pixmap_new (NULL, 1, 1, 1)); instance = g_object_ref (gdk_pixmap_new (NULL, 1, 1, 1));
else if (g_type_is_a (type, GDK_TYPE_COLORMAP)) else if (g_type_is_a (type, GDK_TYPE_COLORMAP))
...@@ -121,10 +119,6 @@ test_type (gconstpointer data) ...@@ -121,10 +119,6 @@ test_type (gconstpointer data)
(strcmp (pspec->name, "default-display") == 0)) (strcmp (pspec->name, "default-display") == 0))
continue; continue;
if (g_type_is_a (type, GDK_TYPE_PANGO_RENDERER) &&
(strcmp (pspec->name, "screen") == 0))
continue;
if (g_type_is_a (type, GTK_TYPE_ABOUT_DIALOG) && if (g_type_is_a (type, GTK_TYPE_ABOUT_DIALOG) &&
(strcmp (pspec->name, "program-name") == 0)) (strcmp (pspec->name, "program-name") == 0))
continue; continue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment