当前位置: 首页>>代码示例>>Golang>>正文


Golang C.SDL_MapRGBA函数代码示例

本文整理汇总了Golang中C.SDL_MapRGBA函数的典型用法代码示例。如果您正苦于以下问题:Golang SDL_MapRGBA函数的具体用法?Golang SDL_MapRGBA怎么用?Golang SDL_MapRGBA使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了SDL_MapRGBA函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: MapRGBA

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)
}
开发者ID:badgerodon,项目名称:go,代码行数:9,代码来源:video.go

示例2: MapRGBA

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),
	))
}
开发者ID:DeedleFake,项目名称:sdl,代码行数:9,代码来源:pixels.go

示例3: MapRGBA

// 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)))
}
开发者ID:kearsley,项目名称:Go-SDL,代码行数:4,代码来源:sdl.go

示例4: MapRGBA

// 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)))
}
开发者ID:emlai,项目名称:go-sdl2,代码行数:6,代码来源:pixels.go

示例5: sdlpix

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))
}
开发者ID:rwcarlsen,项目名称:sdl,代码行数:4,代码来源:sdl.go

示例6: MapColor

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))
}
开发者ID:rsaarelm,项目名称:teratogen,代码行数:5,代码来源:video.go

示例7: mapRGBA

// 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)))
}
开发者ID:beoran,项目名称:fungo,代码行数:4,代码来源:video.go


注:本文中的C.SDL_MapRGBA函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。