示例#1
0
文件: surface.go 项目: willemvds/sdl
func (s *Surface) SetColorKey(flag bool, key uint32) error {
	var cflag C.int
	if flag {
		cflag = 1
	}

	if C.SDL_SetColorKey(s.c(), cflag, C.Uint32(key)) != 0 {
		return getError()
	}

	return nil
}
示例#2
0
文件: sdl.go 项目: kearsley/Go-SDL
// Sets the color key (transparent pixel)  in  a  blittable  surface  and
// enables or disables RLE blit acceleration.
func (s *Surface) SetColorKey(flags uint32, ColorKey uint32) int {
	s.mutex.Lock()
	status := int(C.SDL_SetColorKey(s.cSurface, C.Uint32(flags), C.Uint32(ColorKey)))
	s.mutex.Unlock()
	return status
}
示例#3
0
func (surface *Surface) SetColorKey(flag int, key uint32) int {
	return int(C.SDL_SetColorKey(surface.cptr(), C.int(flag), C.Uint32(key)))
}
示例#4
0
文件: sdl.go 项目: gnanderson/Go-SDL
// Sets the color key (transparent pixel)  in  a  blittable  surface  and
// enables or disables RLE blit acceleration.
func (s *Surface) SetColorKey(flags uint32, ColorKey uint32) int {
	return int(C.SDL_SetColorKey((*C.SDL_Surface)(cast(s)),
		C.Uint32(flags), C.Uint32(ColorKey)))
}
示例#5
0
func (surface *Surface) SetColorKey(flag int, key uint32) int {
	_surface := (*C.SDL_Surface)(unsafe.Pointer(surface))
	_flag := (C.int)(flag)
	_key := (C.Uint32)(key)
	return (int)(C.SDL_SetColorKey(_surface, _flag, _key))
}
示例#6
0
func (s *Surface) SetColorKey(c color.Color) {
	C.SDL_SetColorKey(s.ptr, C.SDL_SRCCOLORKEY, C.Uint32(s.MapColor(c)))
}
示例#7
0
// Sets the color key (transparent pixel)  in  a  blittable  surface  and
// enables or disables RLE blit acceleration.
func (s *Surface) SetColorKey(flags uint32, ColorKey uint32) int {
	status := int(C.SDL_SetColorKey(s.cSurface, C.int(flags), C.Uint32(ColorKey)))
	return status
}
示例#8
0
文件: surface.go 项目: emlai/go-sdl2
// Surface (https://wiki.libsdl.org/SDL_SetColorKey)
func (surface *Surface) SetColorKey(flag int, key uint32) error {
	if C.SDL_SetColorKey(surface.cptr(), C.int(flag), C.Uint32(key)) != 0 {
		return GetError()
	}
	return nil
}
示例#9
0
文件: video.go 项目: beoran/fungo
// Sets the color key (transparent pixel) in a blittable surface.
// If 'flag' is SDL_SRCCOLORKEY (optionally OR'd with SDL_RLEACCEL),
// 'key' will be the transparent pixel in the source image of a blit.
// SDL_RLEACCEL requests RLE acceleration for the surface if present,
// and removes RLE acceleration if absent.
// If 'flag' is 0, this function clears any current color key.
// This function returns 0, or -1 if there was an error.
func setColorKey(surface *C.SDL_Surface, flag, key uint32) int {
	return int(C.SDL_SetColorKey(surface, C.Uint32(flag), C.Uint32(key)))
}