Пример #1
0
func (s *Surface) FillRect(r *Rect, c uint32) error {
	if C.SDL_FillRect(s.c(), r.c(), C.Uint32(c)) != 0 {
		return getError()
	}

	return nil
}
Пример #2
0
func (s *Surface) FillRect(rect image.Rectangle, color color.Color) {
	mutex.Lock()
	defer mutex.Unlock()

	sdlRect := convertRect(rect)
	C.SDL_FillRect(s.ptr, &sdlRect, C.Uint32(s.MapColor(color)))
}
Пример #3
0
// This function performs a fast fill of the given rectangle with some color.
func (dst *Surface) FillRect(dstrect *Rect, color uint32) int {
	var ret = C.SDL_FillRect(
		dst.cSurface,
		(*C.SDL_Rect)(cast(dstrect)),
		C.Uint32(color))
	return int(ret)
}
Пример #4
0
func (s *Surface) FillRect(r *Rect, c color.Color) error {
	cr := sdlRect(r)
	if cr != nil {
		defer C.free(unsafe.Pointer(cr))
	}

	if C.SDL_FillRect(s.surf, cr, s.sdlpix(c)) != 0 {
		return sdlerr()
	}
	return nil
}
Пример #5
0
// This function performs a fast fill of the given rectangle with some color.
func (dst *Surface) FillRect(dstrect *Rect, color uint32) int {
	dst.mutex.Lock()

	var ret = C.SDL_FillRect(
		dst.cSurface,
		(*C.SDL_Rect)(cast(dstrect)),
		C.Uint32(color))

	dst.mutex.Unlock()

	return int(ret)
}
Пример #6
0
func (surface *Surface) FillRect(rect *Rect, color uint32) int {
	return int(C.SDL_FillRect(surface.cptr(), rect.cptr(), C.Uint32(color)))
}
Пример #7
0
func (surface *Surface) FillRect(rect *Rect, color uint32) int {
	_surface := (*C.SDL_Surface)(unsafe.Pointer(surface))
	_rect := (*C.SDL_Rect)(unsafe.Pointer(rect))
	_color := (C.Uint32)(color)
	return (int)(C.SDL_FillRect(_surface, _rect, _color))
}
Пример #8
0
func (s *Surface) Clear(color color.Color) {
	mutex.Lock()
	defer mutex.Unlock()

	C.SDL_FillRect(s.ptr, nil, C.Uint32(s.MapColor(color)))
}
Пример #9
0
// Surface (https://wiki.libsdl.org/SDL_FillRect)
func (surface *Surface) FillRect(rect *Rect, color uint32) error {
	if C.SDL_FillRect(surface.cptr(), rect.cptr(), C.Uint32(color)) != 0 {
		return GetError()
	}
	return nil
}
Пример #10
0
// This function performs a fast fill of the given rectangle with 'color'
// The given rectangle is clipped to the destination surface clip area
// and the final fill rectangle is saved in the passed in pointer.
// If 'dstrect' is NULL, the whole surface will be filled with 'color'
// The color should be a pixel of the format used by the surface, and
// can be generated by the SDL_MapRGB() function.
// This function returns 0 on success, or -1 on error.
func fillRect(dst *C.SDL_Surface, dstrect *C.SDL_Rect, color uint32) int {
	return int(C.SDL_FillRect(dst, dstrect, C.Uint32(color)))
}