Skip to content

Commit

Permalink
Update SDL_ISPIXELFORMAT_ALPHA
Browse files Browse the repository at this point in the history
  • Loading branch information
Susko3 committed Nov 17, 2024
1 parent 1bbb729 commit 2590a72
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions SDL3-CS/SDL3/SDL_pixels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

namespace SDL
{
using static SDL_ArrayOrder;
using static SDL_PixelFormat;
using static SDL_PixelType;
using static SDL_PackedOrder;
Expand All @@ -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);
Expand Down Expand Up @@ -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) &&
Expand All @@ -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) |
Expand Down

0 comments on commit 2590a72

Please sign in to comment.