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

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

作者:badgerodo    项目:g   
func MapRGBA(pixelFormat PixelFormat, r, g, b, a uint8) uint32 {
	c_format := (*C.SDL_PixelFormat)(pixelFormat.Ptr)
	c_r := C.Uint8(r)
	c_g := C.Uint8(g)
	c_b := C.Uint8(b)
	c_a := C.Uint8(a)
	ret := C.SDL_MapRGBA(c_format, c_r, c_g, c_b, c_a)
	return uint32(ret)
}

作者:DeedleFak    项目:sd   
func (p *PixelFormat) MapRGBA(r, g, b, a uint8) uint32 {
	return uint32(C.SDL_MapRGBA(
		p.c(),
		C.Uint8(r),
		C.Uint8(g),
		C.Uint8(b),
		C.Uint8(a),
	))
}

作者:kearsle    项目:Go-SD   
// Map a RGBA color value to a pixel format.
func MapRGBA(format *PixelFormat, r, g, b, a uint8) uint32 {
	return (uint32)(C.SDL_MapRGBA((*C.SDL_PixelFormat)(cast(format)), (C.Uint8)(r), (C.Uint8)(g), (C.Uint8)(b), (C.Uint8)(a)))
}

作者:emla    项目:go-sdl   
// MapRGBA maps an RGBA quadruple to a pixel value for a given pixel format.
// MapRGBA (https://wiki.libsdl.org/SDL_MapRGBA)
func MapRGBA(format *PixelFormat, r, g, b, a uint8) uint32 {
	return uint32(C.SDL_MapRGBA((*C.SDL_PixelFormat)(unsafe.Pointer(format)),
		C.Uint8(r), C.Uint8(g), C.Uint8(b), C.Uint8(a)))
}

作者:rwcarlse    项目:sd   
func (s *Surface) sdlpix(c color.Color) C.Uint32 {
	r, g, b, a := c.RGBA()
	return C.SDL_MapRGBA(s.pixfmt, C.Uint8(r), C.Uint8(g), C.Uint8(b), C.Uint8(a))
}

作者:rsaarel    项目:teratoge   
func (s *Surface) MapColor(c color.Color) uint32 {
	r, g, b, a := c.RGBA()
	r8, g8, b8, a8 := C.Uint8(r>>8), C.Uint8(g>>8), C.Uint8(b>>8), C.Uint8(a>>8)
	return uint32(C.SDL_MapRGBA(s.ptr.format, r8, g8, b8, a8))
}

作者:beora    项目:fung   
// Maps an RGBA quadruple to a pixel value for a given pixel format
func mapRGBA(format *C.SDL_PixelFormat, r, g, b, a uint8) uint32 {
	return uint32(C.SDL_MapRGBA(format, C.Uint8(r), C.Uint8(g), C.Uint8(b), C.Uint8(a)))
}


问题


面经


文章

微信
公众号

扫码关注公众号