Пример #1
0
// AllocPalette create a palette structure with the specified number of color
// entries.
// AllocPalette (https://wiki.libsdl.org/SDL_AllocPalette)
func AllocPalette(ncolors int) (*Palette, error) {
	r := (*Palette)(unsafe.Pointer(C.SDL_AllocPalette(C.int(ncolors))))
	if r == nil {
		return nil, GetError()
	}
	return r, nil
}
Пример #2
0
func AllocPalette(ncolors int) (*Palette, error) {
	p := C.SDL_AllocPalette(C.int(ncolors))
	if p == nil {
		return nil, getError()
	}

	return (*Palette)(unsafe.Pointer(p)), nil
}