Example #1
0
func main() {
	source := loadFromPngFile("../resource/image/TestAndroid.png")
	dest := image.NewRGBA(image.Rect(0, 0, 1024, 768))
	width, height := float64(source.Bounds().Dx()), float64(source.Bounds().Dy())
	tr := draw2d.NewIdentityMatrix()
	tr.Translate(width/2, height/2)
	tr.Rotate(30 * math.Pi / 180)
	//tr.Scale(3, 3)
	tr.Translate(-width/2, -height/2)
	tr.Translate(200, 5)
	draw2d.DrawImage(source, dest, tr, draw.Over, draw2d.BilinearFilter)
	saveToPngFile("../resource/result/TestDrawImage.png", dest)
}
func defaultmatrix(interpreter *Interpreter) {
	tr := interpreter.Pop().(draw2d.MatrixTransform)
	ident := draw2d.NewIdentityMatrix()
	copy(tr[:], ident[:])
	interpreter.Push(tr)
}
func initmatrix(interpreter *Interpreter) {
	interpreter.Push(draw2d.NewIdentityMatrix())
}