Golang C.SDL_GetRGBA类(方法)实例源码

下面列出了Golang C.SDL_GetRGBA 类(方法)源码代码实例,从而了解它的用法。

作者:beora    项目:fung   
// Maps a pixel value into the RGBA components for a given pixel format
func getRGBA(format *C.SDL_PixelFormat, pixel uint32) (byte, byte, byte, byte) {
	var r, b, g, a uint8
	pr := cbyteptr(&r)
	pb := cbyteptr(&b)
	pg := cbyteptr(&g)
	pa := cbyteptr(&a)
	C.SDL_GetRGBA(C.Uint32(pixel), format, pr, pg, pb, pa)
	return r, g, b, a
}

作者:kearsle    项目:Go-SD   
// Gets RGBA values from a pixel in the specified pixel format.
func GetRGBA(color uint32, format *PixelFormat, r, g, b, a *uint8) {
	C.SDL_GetRGBA(C.Uint32(color), (*C.SDL_PixelFormat)(cast(format)), (*C.Uint8)(r), (*C.Uint8)(g), (*C.Uint8)(b), (*C.Uint8)(a))
}

作者:emla    项目:go-sdl   
// GetRGBA gets the RGBA components from a pixel of the specified format.
// GetRGBA (https://wiki.libsdl.org/SDL_GetRGBA)
func GetRGBA(pixel uint32, format *PixelFormat) (r, g, b, a uint8) {
	C.SDL_GetRGBA(C.Uint32(pixel), (*C.SDL_PixelFormat)(unsafe.Pointer(format)),
		(*C.Uint8)(&r), (*C.Uint8)(&g), (*C.Uint8)(&b), (*C.Uint8)(&a))
	return
}

作者:DeedleFak    项目:sd   
func (p *PixelFormat) GetRGBA(pix uint32) (r, g, b, a uint8) {
	var cr, cg, cb, ca C.Uint8
	C.SDL_GetRGBA(C.Uint32(pix), p.c(), &cr, &cg, &cb, &ca)

	return uint8(cr), uint8(cg), uint8(cb), uint8(ca)
}

作者:rsaarel    项目:teratoge   
func (s *Surface) GetColor(c32 uint32) color.Color {
	var r8, g8, b8, a8 C.Uint8
	C.SDL_GetRGBA(C.Uint32(c32), s.ptr.format, &r8, &g8, &b8, &a8)
	return color.RGBA{uint8(r8), uint8(g8), uint8(b8), uint8(a8)}
}


问题


面经


文章

微信
公众号

扫码关注公众号