本文整理匯總了Golang中C.SDL_SetClipRect函數的典型用法代碼示例。如果您正苦於以下問題:Golang SDL_SetClipRect函數的具體用法?Golang SDL_SetClipRect怎麽用?Golang SDL_SetClipRect使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了SDL_SetClipRect函數的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: PushViewport
//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: PopViewport
//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: SetClipRect
// 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: SetClipRect
func (surface *Surface) SetClipRect(rect *Rect) bool {
return C.SDL_SetClipRect(surface.cptr(), rect.cptr()) > 0
}
示例5: SetClipRect
// 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: SetClipRect
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: SetClipRect
func (s *Surface) SetClipRect(r *Rect) bool {
return C.SDL_SetClipRect(s.c(), r.c()) == C.SDL_TRUE
}
示例8: ClearClipRect
func (s *Surface) ClearClipRect() {
C.SDL_SetClipRect(s.ptr, nil)
}
示例9: SetClipRect
func (s *Surface) SetClipRect(rect image.Rectangle) {
r := convertRect(rect)
C.SDL_SetClipRect(s.ptr, &r)
}
示例10: SetClipRect
// Sets the clipping rectangle for a surface.
func (s *Surface) SetClipRect(r *Rect) {
C.SDL_SetClipRect(s.cSurface, (*C.SDL_Rect)(cast(r)))
}
示例11: load
//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: setClipRect
// 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)))
}