本文整理汇总了Golang中C.SDL_DisplayFormatAlpha函数的典型用法代码示例。如果您正苦于以下问题:Golang SDL_DisplayFormatAlpha函数的具体用法?Golang SDL_DisplayFormatAlpha怎么用?Golang SDL_DisplayFormatAlpha使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SDL_DisplayFormatAlpha函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: DisplayFormatAlpha
// Converts a surface to the display format with alpha
func (s *Surface) DisplayFormatAlpha() *Surface {
s.mutex.RLock()
p := C.SDL_DisplayFormatAlpha(s.cSurface)
s.mutex.RUnlock()
return wrap(p)
}
示例2: DisplayFormatAlpha
// Converts a surface to the display format with alpha
func DisplayFormatAlpha(src *Surface) *Surface {
p := C.SDL_DisplayFormatAlpha((*C.SDL_Surface)(cast(src)))
return (*Surface)(cast(p))
}
示例3: String
type imageKey struct {
path string
width int
height int
}
func (me *imageKey) String() string {
return me.path + strconv.Itoa(me.width) + strconv.Itoa(me.height)
}
//Resizes images from imageFiles and caches them.
var images = newFlyweight(
func(path key) interface{} {
key := path.(*imageKey)
tmp := C.IMG_Load(C.CString(key.path))
i := C.SDL_DisplayFormatAlpha(tmp)
C.SDL_FreeSurface(tmp)
if key.width != -1 && key.height != -1 {
if (i != nil) && (int(i.w) != key.width || int(i.h) != key.height) {
i = resize(i, key.width, key.height)
}
}
return i
},
func(path key, img interface{}) {
i := img.(*C.SDL_Surface)
C.SDL_FreeSurface(i)
})
type Image struct {
img *C.SDL_Surface
示例4: DisplayFormatAlpha
func (s *Surface) DisplayFormatAlpha() *Surface {
return (*Surface)(C.SDL_DisplayFormatAlpha(s.Get()))
}
示例5: displayFormatAlpha
// This function takes a surface and copies it to a new surface of the
// pixel format and colors of the video framebuffer (if possible),
// suitable for fast alpha blitting onto the display surface.
// The new surface will always have an alpha channel.
//
// If you want to take advantage of hardware colorkey or alpha blit
// acceleration, you should set the colorkey and alpha value before
// calling this function.
//
// If the conversion fails or runs out of memory, it returns NULL
func displayFormatAlpha(surface *C.SDL_Surface) *C.SDL_Surface {
return C.SDL_DisplayFormatAlpha(surface)
}