Ejemplo n.º 1
0
// PixelFormatEnumToMasks converts format into a bpp and RGBA masks.
// PixelFormatEnumToMasks (https://wiki.libsdl.org/SDL_PixelFormatEnumToMasks)
func PixelFormatEnumToMasks(format uint) (bpp int, rmask, gmask, bmask, amask uint32, err error) {
	result := C.SDL_PixelFormatEnumToMasks(C.Uint32(format), (*C.int)(unsafe.Pointer(&bpp)),
		(*C.Uint32)(&rmask), (*C.Uint32)(&gmask), (*C.Uint32)(&bmask),
		(*C.Uint32)(&amask))
	if result == C.SDL_FALSE {
		err = GetError()
	}
	return
}
Ejemplo n.º 2
0
func PixelFormatEnumToMasks(f uint32) (bpp int, rm, gm, bm, am uint32, err error) {
	var cbpp C.int
	var crm, cgm, cbm, cam C.Uint32
	if C.SDL_PixelFormatEnumToMasks(C.Uint32(f), &cbpp, &crm, &cgm, &cbm, &cam) == C.SDL_FALSE {
		return 0, 0, 0, 0, 0, getError()
	}

	return int(cbpp), uint32(crm), uint32(cgm), uint32(cbm), uint32(cam), nil
}