Beispiel #1
0
// Scale will scale the image to the size provided.
// Note that this will destroy the current pixmap associated with this image.
// After scaling, XSurfaceSet will need to be called for each window that
// this image is painted to. (And obviously, XDraw and XPaint will need to
// be called again.)
func (im *Image) Scale(width, height int) *Image {
	dimg := New(im.X, image.Rect(0, 0, width, height))
	graphics.Scale(dimg, im)
	im.Destroy()

	return dimg
}
Beispiel #2
0
// Scale is a simple wrapper around graphics.Scale.
func Scale(img image.Image, width, height int) draw.Image {
	dimg := image.NewRGBA(image.Rect(0, 0, width, height))
	graphics.Scale(dimg, img)

	return dimg
}