<SUBSECTION>
gdk_draw_drawable
-gdk_draw_image
gdk_drawable_get_image
gdk_drawable_copy_to_image
@height:
-<!-- ##### FUNCTION gdk_draw_image ##### -->
-<para>
-</para>
-
-@drawable:
-@gc:
-@image:
-@xsrc:
-@ysrc:
-@xdest:
-@ydest:
-@width:
-@height:
-
-
<!-- ##### FUNCTION gdk_drawable_get_image ##### -->
<para>
temp_region_deinit( &clip );
}
-static void
-gdk_directfb_draw_image (GdkDrawable *drawable,
- GdkGC *gc,
- GdkImage *image,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height)
-{
- GdkDrawableImplDirectFB *impl;
- GdkImageDirectFB *image_private;
- cairo_region_t clip;
- GdkRectangle dest_rect = { xdest, ydest, width, height };
-
- gint pitch = 0;
- gint i;
-
- g_return_if_fail (GDK_IS_DRAWABLE (drawable));
- g_return_if_fail (image != NULL);
-
- D_DEBUG_AT( GDKDFB_Drawable, "%s( %p, %p, %p, %4d,%4d -> %4d,%4d - %dx%d )\n", G_STRFUNC,
- drawable, gc, image, xsrc, ysrc, xdest, ydest, width, height );
-
- impl = GDK_DRAWABLE_IMPL_DIRECTFB (drawable);
- image_private = image->windowing_data;
-
- if (!impl->surface)
- return;
-
- gdk_directfb_clip_region (drawable, gc, &dest_rect, &clip);
-
- if (!cairo_region_is_empty (&clip))
- {
- DFBRectangle src_rect = { xsrc, ysrc, width, height };
-
- image_private->surface->Unlock (image_private->surface);
-
- impl->surface->SetBlittingFlags (impl->surface, DSBLIT_NOFX);
-
- for (i = 0; i < clip.numRects; i++)
- {
- DFBRegion reg = { clip.rects[i].x1, clip.rects[i].y1,
- clip.rects[i].x2 , clip.rects[i].y2 };
-
- impl->surface->SetClip (impl->surface, ®);
- impl->surface->Blit (impl->surface,
- image_private->surface, &src_rect,
- xdest, ydest);
- }
-
- image_private->surface->Lock (image_private->surface, DSLF_WRITE,
- &image->mem, &pitch);
- image->bpl = pitch;
- }
-
- temp_region_deinit( &clip );
-}
-
static inline void
convert_rgba_pixbuf_to_image (guint32 *src,
guint src_pitch,
drawable_class->draw_points = gdk_directfb_draw_points;
drawable_class->draw_segments = gdk_directfb_draw_segments;
drawable_class->draw_lines = gdk_directfb_draw_lines;
- drawable_class->draw_image = gdk_directfb_draw_image;
drawable_class->ref_cairo_surface = gdk_directfb_ref_cairo_surface;
drawable_class->set_colormap = gdk_directfb_set_colormap;
gdk_draw_drawable
gdk_draw_glyphs
gdk_draw_glyphs_transformed
-gdk_draw_image
gdk_draw_line
gdk_draw_lines
gdk_draw_point
g_object_unref (composite);
}
-/**
- * gdk_draw_image:
- * @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
- * @gc: a #GdkGC.
- * @image: the #GdkImage to draw.
- * @xsrc: the left edge of the source rectangle within @image.
- * @ysrc: the top of the source rectangle within @image.
- * @xdest: the x coordinate of the destination within @drawable.
- * @ydest: the y coordinate of the destination within @drawable.
- * @width: the width of the area to be copied, or -1 to make the area
- * extend to the right edge of @image.
- * @height: the height of the area to be copied, or -1 to make the area
- * extend to the bottom edge of @image.
- *
- * Draws a #GdkImage onto a drawable.
- * The depth of the #GdkImage must match the depth of the #GdkDrawable.
- **/
-void
-gdk_draw_image (GdkDrawable *drawable,
- GdkGC *gc,
- GdkImage *image,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height)
-{
- g_return_if_fail (GDK_IS_DRAWABLE (drawable));
- g_return_if_fail (GDK_IS_IMAGE (image));
- g_return_if_fail (GDK_IS_GC (gc));
-
- if (width == -1)
- width = image->width;
- if (height == -1)
- height = image->height;
-
- GDK_DRAWABLE_GET_CLASS (drawable)->draw_image (drawable, gc, image, xsrc, ysrc,
- xdest, ydest, width, height);
-}
-
/**
* gdk_draw_points:
* @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
gint y,
PangoGlyphString *glyphs);
- void (*draw_image) (GdkDrawable *drawable,
- GdkGC *gc,
- GdkImage *image,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height);
-
gint (*get_depth) (GdkDrawable *drawable);
void (*get_size) (GdkDrawable *drawable,
gint *width,
gint ydest,
gint width,
gint height);
-void gdk_draw_image (GdkDrawable *drawable,
- GdkGC *gc,
- GdkImage *image,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height);
void gdk_draw_points (GdkDrawable *drawable,
GdkGC *gc,
const GdkPoint *points,
add_damage (offscreen, 0, 0, private->width, private->height, TRUE);
}
-static void
-gdk_offscreen_window_draw_image (GdkDrawable *drawable,
- GdkGC *gc,
- GdkImage *image,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height)
-{
- GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable);
- GdkDrawable *real_drawable = get_real_drawable (offscreen);
-
- gdk_draw_image (real_drawable,
- gc,
- image,
- xsrc,
- ysrc,
- xdest,
- ydest,
- width,
- height);
-
- add_damage (offscreen, xdest, ydest, width, height, FALSE);
-}
-
void
_gdk_offscreen_window_new (GdkWindow *window,
GdkScreen *screen,
drawable_class->draw_points = gdk_offscreen_window_draw_points;
drawable_class->draw_segments = gdk_offscreen_window_draw_segments;
drawable_class->draw_lines = gdk_offscreen_window_draw_lines;
- drawable_class->draw_image = gdk_offscreen_window_draw_image;
}
static void
gint y,
PangoGlyphString *glyphs);
-static void gdk_pixmap_draw_image (GdkDrawable *drawable,
- GdkGC *gc,
- GdkImage *image,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height);
static void gdk_pixmap_draw_trapezoids (GdkDrawable *drawable,
GdkGC *gc,
GdkTrapezoid *trapezoids,
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->draw_image = gdk_pixmap_draw_image;
drawable_class->draw_trapezoids = gdk_pixmap_draw_trapezoids;
drawable_class->get_depth = gdk_pixmap_real_get_depth;
drawable_class->get_screen = gdk_pixmap_real_get_screen;
gdk_draw_glyphs_transformed (private->impl, gc, matrix, font, x, y, glyphs);
}
-static void
-gdk_pixmap_draw_image (GdkDrawable *drawable,
- GdkGC *gc,
- GdkImage *image,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height)
-{
- GdkPixmapObject *private = (GdkPixmapObject *)drawable;
-
- _gdk_gc_remove_drawable_clip (gc);
- gdk_draw_image (private->impl, gc, image, xsrc, ysrc, xdest, ydest,
- width, height);
-}
-
static void
gdk_pixmap_draw_trapezoids (GdkDrawable *drawable,
GdkGC *gc,
gint y,
PangoGlyphString *glyphs);
-static void gdk_window_draw_image (GdkDrawable *drawable,
- GdkGC *gc,
- GdkImage *image,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height);
-
static void gdk_window_draw_trapezoids (GdkDrawable *drawable,
GdkGC *gc,
GdkTrapezoid *trapezoids,
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->draw_image = gdk_window_draw_image;
drawable_class->draw_trapezoids = gdk_window_draw_trapezoids;
drawable_class->get_depth = gdk_window_real_get_depth;
drawable_class->get_screen = gdk_window_real_get_screen;
TRUE);
}
-static void
-gdk_window_draw_image (GdkDrawable *drawable,
- GdkGC *gc,
- GdkImage *image,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height)
-{
- if (GDK_WINDOW_DESTROYED (drawable))
- return;
-
- BEGIN_DRAW;
- gdk_draw_image (impl, gc, image, xsrc, ysrc,
- xdest - x_offset, ydest - y_offset,
- width, height);
- END_DRAW;
-}
-
static void
gdk_window_draw_trapezoids (GdkDrawable *drawable,
GdkGC *gc,
gdk_quartz_drawable_release_context (drawable, context);
}
-static void
-gdk_quartz_draw_image (GdkDrawable *drawable,
- GdkGC *gc,
- GdkImage *image,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height)
-{
- CGContextRef context = gdk_quartz_drawable_get_context (drawable, FALSE);
- CGColorSpaceRef colorspace;
- CGDataProviderRef data_provider;
- CGImageRef cgimage;
-
- if (!context)
- return;
-
- colorspace = CGColorSpaceCreateDeviceRGB ();
- data_provider = CGDataProviderCreateWithData (NULL, image->mem, image->height * image->bpl, NULL);
-
- /* FIXME: Make sure that this function draws 32-bit images correctly,
- * also check endianness wrt kCGImageAlphaNoneSkipFirst */
- cgimage = CGImageCreate (image->width, image->height, 8,
- 32, image->bpl,
- colorspace,
- kCGImageAlphaNoneSkipFirst,
- data_provider, NULL, FALSE, kCGRenderingIntentDefault);
-
- CGDataProviderRelease (data_provider);
- CGColorSpaceRelease (colorspace);
-
- _gdk_quartz_gc_update_cg_context (gc, drawable, context,
- GDK_QUARTZ_CONTEXT_STROKE);
-
- CGContextClipToRect (context, CGRectMake (xdest, ydest, width, height));
- CGContextTranslateCTM (context, xdest - xsrc, ydest - ysrc + image->height);
- CGContextScaleCTM (context, 1, -1);
-
- CGContextDrawImage (context, CGRectMake (0, 0, image->width, image->height), cgimage);
- CGImageRelease (cgimage);
-
- gdk_quartz_drawable_release_context (drawable, context);
-}
-
static void
gdk_drawable_impl_quartz_finalize (GObject *object)
{
drawable_class->draw_points = gdk_quartz_draw_points;
drawable_class->draw_segments = gdk_quartz_draw_segments;
drawable_class->draw_lines = gdk_quartz_draw_lines;
- drawable_class->draw_image = gdk_quartz_draw_image;
drawable_class->ref_cairo_surface = gdk_quartz_ref_cairo_surface;
GdkGC *gc,
GdkPoint *points,
gint npoints);
-static void gdk_win32_draw_image (GdkDrawable *drawable,
- GdkGC *gc,
- GdkImage *image,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height);
static cairo_surface_t *gdk_win32_ref_cairo_surface (GdkDrawable *drawable);
drawable_class->draw_points = gdk_win32_draw_points;
drawable_class->draw_segments = gdk_win32_draw_segments;
drawable_class->draw_lines = gdk_win32_draw_lines;
- drawable_class->draw_image = gdk_win32_draw_image;
drawable_class->ref_cairo_surface = gdk_win32_ref_cairo_surface;
gdk_win32_hdc_release (&draw_impl->parent_instance, gc, GDK_GC_FOREGROUND);
}
-static void
-gdk_win32_draw_image (GdkDrawable *drawable,
- GdkGC *gc,
- GdkImage *image,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height)
-{
- g_assert (GDK_IS_DRAWABLE_IMPL_WIN32 (drawable));
-
- _gdk_win32_blit (TRUE, (GdkDrawableImplWin32 *) drawable,
- gc, (GdkPixmap *) image->windowing_data,
- xsrc, ysrc, xdest, ydest, width, height);
-}
-
/**
* _gdk_win32_drawable_acquire_dc
* @drawable: a Win32 #GdkDrawable implementation
GdkPoint *points,
gint npoints);
-static void gdk_x11_draw_image (GdkDrawable *drawable,
- GdkGC *gc,
- GdkImage *image,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height);
-
static cairo_surface_t *gdk_x11_ref_cairo_surface (GdkDrawable *drawable);
static void gdk_x11_set_colormap (GdkDrawable *drawable,
drawable_class->draw_points = gdk_x11_draw_points;
drawable_class->draw_segments = gdk_x11_draw_segments;
drawable_class->draw_lines = gdk_x11_draw_lines;
- drawable_class->draw_image = gdk_x11_draw_image;
drawable_class->ref_cairo_surface = gdk_x11_ref_cairo_surface;
g_free (tmp_points);
}
-static void
-gdk_x11_draw_image (GdkDrawable *drawable,
- GdkGC *gc,
- GdkImage *image,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height)
-{
- GdkDrawableImplX11 *impl;
-
- impl = GDK_DRAWABLE_IMPL_X11 (drawable);
-
-#ifdef USE_SHM
- if (image->type == GDK_IMAGE_SHARED)
- XShmPutImage (GDK_SCREEN_XDISPLAY (impl->screen), impl->xid,
- GDK_GC_GET_XGC (gc), GDK_IMAGE_XIMAGE (image),
- xsrc, ysrc, xdest, ydest, width, height, False);
- else
-#endif
- XPutImage (GDK_SCREEN_XDISPLAY (impl->screen), impl->xid,
- GDK_GC_GET_XGC (gc), GDK_IMAGE_XIMAGE (image),
- xsrc, ysrc, xdest, ydest, width, height);
-}
-
static gint
gdk_x11_get_depth (GdkDrawable *drawable)
{