Beispiel #1
0
func (this Surface) SetPalette(flags SetPaletteFlags, colors []Color) error {
	c_surface := (*C.SDL_Surface)(this.Ptr)
	c_flags := C.int(flags)
	var c_colors *C.SDL_Color
	if len(colors) > 0 {
		c_colors = (*C.SDL_Color)(unsafe.Pointer(&colors[0]))
	}
	c_firstcolor := C.int(0)
	c_ncolors := C.int(len(colors))
	C.SDL_SetPalette(c_surface, c_flags, c_colors, c_firstcolor, c_ncolors)
	return GetError()
}
Beispiel #2
0
func (s *Surface) SetColors(pal Palette) {
	colPtr := (*C.SDL_Color)(unsafe.Pointer(&pal[0]))
	C.SDL_SetPalette(s.ptr, C.SDL_LOGPAL, colPtr, 0, C.int(len(pal)))
}