func GenDrawOp(dst *Image, r image.Rectangle, src *Image, p0 image.Point, mask *Image, p1 image.Point, op Op) {
	dst.Display.mu.Lock()
	defer dst.Display.mu.Unlock()
	draw(dst, r, src, p0, mask, p1, op)
}
GenDrawOp copies the source image with upper left corner p1 to the destination
rectangle r, through the specified mask using the specified operation. The
coordinates are aligned so p1 in src and p0 in mask both correspond to r.min in
the destination.
package draw  
import (
	"image"
)
type Op int
const (
	Clear Op = 0
	SinD  Op = 8
	DinS  Op = 4
	SoutD Op = 2
	DoutS Op = 1
	S      = SinD | SoutD
	SoverD = SinD | SoutD | DoutS
	SatopD = SinD | DoutS
	SxorD  = SoutD | DoutS
	D      = DinS | DoutS
	DoverS = DinS | DoutS | SoutD
	DatopS = DinS | SoutD
	DxorS  = DoutS | SoutD  
	Ncomp = 12
)
func setdrawop(d *Display, op Op) {
	if op != SoverD {
		a := d.bufimage(2)
		a[0] = 'O'
		a[1] = byte(op)
	}
}
func draw(dst *Image, r image.Rectangle, src *Image, p0 image.Point, mask *Image, p1 image.Point, op Op) {
	setdrawop(dst.Display, op)
	a := dst.Display.bufimage(1 + 4 + 4 + 4 + 4*4 + 2*4 + 2*4)
	if src == nil {
		src = dst.Display.Black
	}
	if mask == nil {
		mask = dst.Display.Opaque
	}
	a[0] = 'd'
	bplong(a[1:], dst.id)
	bplong(a[5:], src.id)
	bplong(a[9:], mask.id)
	bplong(a[13:], uint32(r.Min.X))
	bplong(a[17:], uint32(r.Min.Y))
	bplong(a[21:], uint32(r.Max.X))
	bplong(a[25:], uint32(r.Max.Y))
	bplong(a[29:], uint32(p0.X))
	bplong(a[33:], uint32(p0.Y))
	bplong(a[37:], uint32(p1.X))
	bplong(a[41:], uint32(p1.Y))
}
func (dst *Image) draw(r image.Rectangle, src, mask *Image, p1 image.Point) {
	draw(dst, r, src, p1, mask, p1, SoverD)
}
func (dst *Image) Draw(r image.Rectangle, src, mask *Image, p1 image.Point) {
	dst.Display.mu.Lock()
	defer dst.Display.mu.Unlock()
	draw(dst, r, src, p1, mask, p1, SoverD)
}
func (dst *Image) DrawOp(r image.Rectangle, src, mask *Image, p1 image.Point, op Op) {
	dst.Display.mu.Lock()
	defer dst.Display.mu.Unlock()
	draw(dst, r, src, p1, mask, p1, op)
}
func (dst *Image) GenDraw(r image.Rectangle, src *Image, p0 image.Point, mask *Image, p1 image.Point) {
	dst.Display.mu.Lock()
	defer dst.Display.mu.Unlock()
	draw(dst, r, src, p0, mask, p1, SoverD)
}