From 2590a7205eff1d1a928ce5f9a700f16339fbb157 Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sun, 17 Nov 2024 21:51:08 +0000 Subject: [PATCH] Update SDL_ISPIXELFORMAT_ALPHA https://github.com/libsdl-org/SDL/commit/e027b85cc457556071cbb2f3f1bcf8803c1bc001 --- SDL3-CS/SDL3/SDL_pixels.cs | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/SDL3-CS/SDL3/SDL_pixels.cs b/SDL3-CS/SDL3/SDL_pixels.cs index 826aeb7..8c0322d 100644 --- a/SDL3-CS/SDL3/SDL_pixels.cs +++ b/SDL3-CS/SDL3/SDL_pixels.cs @@ -5,6 +5,7 @@ namespace SDL { + using static SDL_ArrayOrder; using static SDL_PixelFormat; using static SDL_PixelType; using static SDL_PackedOrder; @@ -29,7 +30,13 @@ public static SDL_PixelFormat SDL_DEFINE_PIXELFORMAT(int type, int order, int la public static SDL_PixelType SDL_PIXELTYPE(SDL_PixelFormat X) => (SDL_PixelType)(((int)X >> 24) & 0x0F); [Macro] - public static SDL_PackedOrder SDL_PIXELORDER(SDL_PixelFormat X) => (SDL_PackedOrder)(((int)X >> 20) & 0x0F); + public static int SDL_PIXELORDER(SDL_PixelFormat X) => (((int)X >> 20) & 0x0F); + + [Macro] + public static SDL_ArrayOrder SDL_PIXELORDER_Array(SDL_PixelFormat X) => (SDL_ArrayOrder)SDL_PIXELORDER(X); + + [Macro] + public static SDL_PackedOrder SDL_PIXELORDER_Packed(SDL_PixelFormat X) => (SDL_PackedOrder)SDL_PIXELORDER(X); [Macro] public static SDL_PackedLayout SDL_PIXELLAYOUT(SDL_PixelFormat X) => (SDL_PackedLayout)(((int)X >> 16) & 0x0F); @@ -72,14 +79,6 @@ public static bool SDL_ISPIXELFORMAT_ARRAY(SDL_PixelFormat format) => (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF16) || (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF32))); - [Macro] - public static bool SDL_ISPIXELFORMAT_ALPHA(SDL_PixelFormat format) => - ((SDL_ISPIXELFORMAT_PACKED(format) && - ((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || - (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || - (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || - (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA)))); - [Macro] public static bool SDL_ISPIXELFORMAT_10BIT(SDL_PixelFormat format) => (!SDL_ISPIXELFORMAT_FOURCC(format) && @@ -96,6 +95,19 @@ public static bool SDL_ISPIXELFORMAT_FLOAT(SDL_PixelFormat format) => public static bool SDL_ISPIXELFORMAT_FOURCC(SDL_PixelFormat format) => ((format != 0) && (SDL_PIXELFLAG(format) != 1)); + [Macro] + public static bool SDL_ISPIXELFORMAT_ALPHA(SDL_PixelFormat format) => + ((SDL_ISPIXELFORMAT_PACKED(format) && + ((SDL_PIXELORDER_Packed(format) == SDL_PACKEDORDER_ARGB) || + (SDL_PIXELORDER_Packed(format) == SDL_PACKEDORDER_RGBA) || + (SDL_PIXELORDER_Packed(format) == SDL_PACKEDORDER_ABGR) || + (SDL_PIXELORDER_Packed(format) == SDL_PACKEDORDER_BGRA))) || + (SDL_ISPIXELFORMAT_ARRAY(format) && + ((SDL_PIXELORDER_Array(format) == SDL_ARRAYORDER_ARGB) || + (SDL_PIXELORDER_Array(format) == SDL_ARRAYORDER_RGBA) || + (SDL_PIXELORDER_Array(format) == SDL_ARRAYORDER_ABGR) || + (SDL_PIXELORDER_Array(format) == SDL_ARRAYORDER_BGRA)))); + [Macro] public static SDL_Colorspace SDL_DEFINE_COLORSPACE(UInt32 type, UInt32 range, UInt32 primaries, UInt32 transfer, UInt32 matrix, UInt32 chroma) => (SDL_Colorspace)(((type) << 28) | ((range) << 24) | ((chroma) << 20) |