sdl: pixels: Add SDL_PIXELFORMAT_RGBA32 and its variants
@@ -171,11 +171,32 @@ const (
PIXELFORMAT_YVYU = C.SDL_PIXELFORMAT_YVYU
)
+var (
+ PIXELFORMAT_RGBA32 int
+ PIXELFORMAT_ARGB32 int
+ PIXELFORMAT_BGRA32 int
+ PIXELFORMAT_ABGR32 int
+)
+
const (
ALPHA_OPAQUE = C.SDL_ALPHA_OPAQUE
ALPHA_TRANSPARENT = C.SDL_ALPHA_TRANSPARENT
)
+func init() {
+ if BYTEORDER == BIG_ENDIAN {
+ PIXELFORMAT_RGBA32 = PIXELFORMAT_RGBA8888
+ PIXELFORMAT_ARGB32 = PIXELFORMAT_ARGB8888
+ PIXELFORMAT_BGRA32 = PIXELFORMAT_BGRA8888
+ PIXELFORMAT_ABGR32 = PIXELFORMAT_ABGR8888
+ } else {
+ PIXELFORMAT_RGBA32 = PIXELFORMAT_ABGR8888
+ PIXELFORMAT_ARGB32 = PIXELFORMAT_BGRA8888
+ PIXELFORMAT_BGRA32 = PIXELFORMAT_ARGB8888
+ PIXELFORMAT_ABGR32 = PIXELFORMAT_RGBA8888
+ }
+}
+
func (fmt *PixelFormat) cptr() *C.SDL_PixelFormat {
return (*C.SDL_PixelFormat)(unsafe.Pointer(fmt))
}
