9fans.net/go@v0.0.5/draw/replclipr.go (about)

     1  package draw
     2  
     3  // ReplClipr sets the replication boolean and clip rectangle for the specified image.
     4  func (dst *Image) ReplClipr(repl bool, clipr Rectangle) {
     5  	dst.Display.mu.Lock()
     6  	defer dst.Display.mu.Unlock()
     7  	b := dst.Display.bufimage(22)
     8  	b[0] = 'c'
     9  	bplong(b[1:], uint32(dst.id))
    10  	byteRepl := byte(0)
    11  	if repl {
    12  		byteRepl = 1
    13  	}
    14  	b[5] = byteRepl
    15  	bplong(b[6:], uint32(clipr.Min.X))
    16  	bplong(b[10:], uint32(clipr.Min.Y))
    17  	bplong(b[14:], uint32(clipr.Max.X))
    18  	bplong(b[18:], uint32(clipr.Max.Y))
    19  	dst.Repl = repl
    20  	dst.Clipr = clipr
    21  }