本文整理汇总了Golang中exp/draw.Rectangle.Add方法的典型用法代码示例。如果您正苦于以下问题:Golang Rectangle.Add方法的具体用法?Golang Rectangle.Add怎么用?Golang Rectangle.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类exp/draw.Rectangle
的用法示例。
在下文中一共展示了Rectangle.Add方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: setpiece
func setpiece(p *Piece) {
draw.Draw(bb, bbr, draw.White, nil, draw.ZP)
draw.Draw(bbmask, bbr, draw.Transparent, nil, draw.ZP)
br = draw.Rect(0, 0, 0, 0)
br2 = br
piece = p
if p == nil {
return
}
var op draw.Point
var r draw.Rectangle
r.Min = bbr.Min
for i, pt := range p.d {
r.Min.X += pt.X * pcsz
r.Min.Y += pt.Y * pcsz
r.Max.X = r.Min.X + pcsz
r.Max.Y = r.Min.Y + pcsz
if i == 0 {
draw.Draw(bb, r, draw.Black, nil, draw.ZP)
draw.Draw(bb, r.Inset(1), txpix[piece.tx], nil, draw.ZP)
draw.Draw(bbmask, r, draw.Opaque, nil, draw.ZP)
op = r.Min
} else {
draw.Draw(bb, r, bb, nil, op)
draw.Draw(bbmask, r, bbmask, nil, op)
}
if br.Max.X < r.Max.X {
br.Max.X = r.Max.X
}
if br.Max.Y < r.Max.Y {
br.Max.Y = r.Max.Y
}
}
br.Max = br.Max.Sub(bbr.Min)
delta := draw.Pt(0, DY)
br2.Max = br.Max.Add(delta)
r = br.Add(bb2r.Min)
r2 := br2.Add(bb2r.Min)
draw.Draw(bb2, r2, draw.White, nil, draw.ZP)
draw.Draw(bb2, r.Add(delta), bb, nil, bbr.Min)
draw.Draw(bb2mask, r2, draw.Transparent, nil, draw.ZP)
draw.Draw(bb2mask, r, draw.Opaque, bbmask, bbr.Min)
draw.Draw(bb2mask, r.Add(delta), draw.Opaque, bbmask, bbr.Min)
}