Esempio n. 1
0
//Pushes a viewport to limit the drawing space to the given bounds within the current drawing space.
func (me *Canvas) PushViewport(x, y, width, height int) {
	me.origin.SubtractFrom(me.viewport.translate())
	me.viewport.push(starfish.Bounds{starfish.Point{X: int(x), Y: int(y)}, starfish.Size{Width: int(width), Height: int(height)}})
	r := me.viewport.bounds()
	p.SetClipRect(r.X, r.Y, r.Width, r.Height)
	me.origin = me.translation.AddOf(me.viewport.bounds().Point)
	me.origin.AddTo(me.viewport.translate())
}
Esempio n. 2
0
//Exits the current viewport, unless there is no viewport.
func (me *Canvas) PopViewport() {
	if me.viewport.pt != 0 {
		me.origin.SubtractFrom(me.viewport.translate())
		me.viewport.pop()
		r := me.viewport.bounds()

		if r.Width == -1 {
			r.Width = p.DisplayWidth()
		}
		if r.Height == -1 {
			r.Height = p.DisplayHeight()
		}

		p.SetClipRect(r.X, r.Y, r.Width, r.Height)
		me.origin = me.translation.AddOf(me.viewport.bounds().Point)
		me.origin.AddTo(me.viewport.translate())
	}
}
Esempio n. 3
0
//Loads the settings for this Pane onto the SDL Surface.
func (me *Canvas) load() {
	me.viewport.calcBounds()
	r := me.viewport.bounds()
	p.SetClipRect(r.X, r.Y, r.Width, r.Height)
}