gdkPixbufScaleSimple(object, dest.width, dest.height, interp.type)
gdkPixbufScale(object, dest, dest.x, dest.y, dest.width, dest.height, offset.x, offset.y, scale.x, scale.y, interp.type)
gdkPixbufCompositeColorSimple(object, dest.width, dest.height, interp.type, overall.alpha, check.size, color1, color2)
gdkPixbufComposite(object, dest, dest.x, dest.y, dest.width, dest.height, offset.x, offset.y, scale.x, scale.y, interp.type, overall.alpha)
gdkPixbufCompositeColor(object, dest, dest.x, dest.y, dest.width, dest.height, offset.x, offset.y, scale.x, scale.y, interp.type, overall.alpha, check.x, check.y, check.size, color1, color2)
gdkPixbufRotateSimple(object, angle)
gdkPixbufFlip(object, horizontal)
gdkPixbufScale
,
gdkPixbufComposite
, and gdkPixbufCompositeColor
) are
rather complex to use and have many arguments, two simple
convenience functions are provided, gdkPixbufScaleSimple
and
gdkPixbufCompositeColorSimple
which create a new pixbuf of a
given size, scale an original image to fit, and then return the
new pixbuf.
Scaling and compositing functions take advantage of MMX hardware
acceleration on systems where MMX is supported. If gdk-pixbuf is built
with the Sun mediaLib library, these functions are instead accelerated
using mediaLib, which provides hardware acceleration on Intel, AMD,
and Sparc chipsets. If desired, mediaLib support can be turned off by
setting the GDK_DISABLE_MEDIALIB environment variable.
The following example demonstrates handling an expose event by
rendering the appropriate area of a source image (which is scaled
to fit the widget) onto the widget's window. The source image is
rendered against a checkerboard, which provides a visual
representation of the alpha channel if the image has one. If the
image doesn't have an alpha channel, calling
gdkPixbufCompositeColor
function has exactly the same effect
as calling gdkPixbufScale
.
Handling an expose event.
expose_cb <- function(widget, event, data)
{
dest <- gdkPixbuf(color = "rgb", has.alpha = FALSE, bits = 8,
w = event[["area"]]$width, h = event[["area"]]$height)area <- event[["area"]] pixbuf$compositeColor(dest, 0, 0, area$width, area$height, -area$x, -area$y, widget[["allocation"]]$width / pixbuf$getWidth(), widget[["allocation"]]$height / pixbuf$getHeight(), "bilinear", 255, area$x, area$y, 16, 0xaaaaaa, 0x555555)
dest$renderToDrawable(widget[["window"]], widget[["style"]][["fgGc"]][[GtkStateType["normal"]+1]], 0, 0, area$x, area$y, area$width, area$height, "normal", area$x, area$y)
return(TRUE) }