Ejemplo n.º 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))
}
Ejemplo n.º 2
0
// 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
}
Ejemplo n.º 3
0
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
}
Ejemplo n.º 4
0
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))
}
Ejemplo n.º 5
0
// 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))
}