예제 #1
0
func (surface *Surface) Convert(fmt *PixelFormat, flags uint32) *Surface {
	_surface := (*C.SDL_Surface)(unsafe.Pointer(surface))
	_fmt := (*C.SDL_PixelFormat)(unsafe.Pointer(fmt))
	_flags := (C.Uint32)(flags)
	_surface = C.SDL_ConvertSurface(_surface, _fmt, _flags)
	return (*Surface)(unsafe.Pointer(_surface))
}
예제 #2
0
파일: surface.go 프로젝트: emlai/go-sdl2
// Surface (https://wiki.libsdl.org/SDL_ConvertSurface)
func (surface *Surface) Convert(fmt *PixelFormat, flags uint32) (*Surface, error) {
	_surface := (*Surface)(unsafe.Pointer(C.SDL_ConvertSurface(surface.cptr(), fmt.cptr(), C.Uint32(flags))))
	if _surface == nil {
		return nil, GetError()
	}
	return _surface, nil
}
예제 #3
0
파일: surface.go 프로젝트: willemvds/sdl
func (s *Surface) Convert(f *PixelFormat, flags uint32) (*Surface, error) {
	cs := C.SDL_ConvertSurface(s.c(), f.c(), C.Uint32(flags))
	if cs == nil {
		return nil, getError()
	}

	return (*Surface)(unsafe.Pointer(cs)), nil
}
예제 #4
0
파일: surface.go 프로젝트: JalfResi/go-sdl2
func (surface *Surface) Convert(fmt *PixelFormat, flags uint32) *Surface {
	_surface := C.SDL_ConvertSurface(surface.cptr(), fmt.cptr(), C.Uint32(flags))
	return (*Surface)(unsafe.Pointer(_surface))
}
예제 #5
0
파일: video.go 프로젝트: beoran/fungo
// Creates a new surface of the specified format, and then copies and maps
// the given surface to it so the blit of the converted surface will be as
// fast as possible.  If this function fails, it returns NULL.
//
// The 'flags' parameter is passed to SDL_CreateRGBSurface() and has those
// semantics.  You can also pass SDL_RLEACCEL in the flags parameter and
// SDL will try to RLE accelerate colorkey and alpha blits in the resulting
// surface.
//
// This function is used internally by SDL_DisplayFormat().
func convertSurface(src *C.SDL_Surface, fmt *C.SDL_PixelFormat,
	flags uint32) *C.SDL_Surface {
	return C.SDL_ConvertSurface(src, fmt, C.Uint32(flags))
}