示例#1
0
文件: canvas.go 项目: griffy/starfish
//Pushs a viewport to limit the drawing space to the given bounds within the current drawing space.
//Will not accept any negative values.
func (me *Canvas) PushViewport(x, y, width, height int) {
	me.origin.SubtractFrom(me.viewport.translate())
	me.viewport.push(util.Bounds{util.Point{X: int(x), Y: int(y)}, util.Size{Width: int(width), Height: int(height)}})
	r := toSDL_Rect(me.viewport.bounds())
	C.SDL_SetClipRect(me.pane, &r)
	me.origin = me.translation.AddOf(me.viewport.bounds().Point)
	me.origin.AddTo(me.viewport.translate())
}
示例#2
0
文件: canvas.go 项目: griffy/starfish
//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 := toSDL_Rect(me.viewport.bounds())
		C.SDL_SetClipRect(me.pane, &r)
		me.origin = me.translation.AddOf(me.viewport.bounds().Point)
		me.origin.AddTo(me.viewport.translate())
	}
}
示例#3
0
文件: sdl.go 项目: kearsley/Go-SDL
// Sets the clipping rectangle for a surface.
func (s *Surface) SetClipRect(r *Rect) {
	s.mutex.Lock()
	C.SDL_SetClipRect(s.cSurface, (*C.SDL_Rect)(cast(r)))
	s.mutex.Unlock()
}
示例#4
0
func (surface *Surface) SetClipRect(rect *Rect) bool {
	return C.SDL_SetClipRect(surface.cptr(), rect.cptr()) > 0
}
示例#5
0
文件: sdl.go 项目: gnanderson/Go-SDL
// Sets the clipping rectangle for a surface.
func (s *Surface) SetClipRect(r *Rect) {
	C.SDL_SetClipRect((*C.SDL_Surface)(cast(s)), (*C.SDL_Rect)(cast(r)))
	return
}
示例#6
0
func (surface *Surface) SetClipRect(rect *Rect) bool {
	_surface := (*C.SDL_Surface)(unsafe.Pointer(surface))
	_rect := (*C.SDL_Rect)(unsafe.Pointer(rect))
	return C.SDL_SetClipRect(_surface, _rect) > 0
}
示例#7
0
文件: surface.go 项目: willemvds/sdl
func (s *Surface) SetClipRect(r *Rect) bool {
	return C.SDL_SetClipRect(s.c(), r.c()) == C.SDL_TRUE
}
示例#8
0
func (s *Surface) ClearClipRect() {
	C.SDL_SetClipRect(s.ptr, nil)
}
示例#9
0
func (s *Surface) SetClipRect(rect image.Rectangle) {
	r := convertRect(rect)
	C.SDL_SetClipRect(s.ptr, &r)
}
示例#10
0
// Sets the clipping rectangle for a surface.
func (s *Surface) SetClipRect(r *Rect) {
	C.SDL_SetClipRect(s.cSurface, (*C.SDL_Rect)(cast(r)))
}
示例#11
0
文件: canvas.go 项目: griffy/starfish
//Loads the settings for this Pane onto the SDL Surface.
func (me *Canvas) load() {
	me.viewport.calcBounds()
	r := toSDL_Rect(me.viewport.bounds())
	C.SDL_SetClipRect(me.pane, &r)
}
示例#12
0
文件: video.go 项目: beoran/fungo
// Sets the clipping rectangle for the destination surface in a blit.
//
// If the clip rectangle is NULL, clipping will be disabled.
// If the clip rectangle doesn't intersect the surface, the function will
// return SDL_FALSE and blits will be completely clipped.  Otherwise the
// function returns SDL_TRUE and blits to the surface will be clipped to
// the intersection of the surface area and the clipping rectangle.
//
// Note that blits are automatically clipped to the edges of the source
// and destination surfaces.
func setClipRect(surface *C.SDL_Surface, rect *C.SDL_Rect) bool {
	return i2b(int(C.SDL_SetClipRect(surface, rect)))
}