24 lines
1.0 KiB
C++
24 lines
1.0 KiB
C++
#pragma once
|
|
/// @file PixelFormat.hpp
|
|
/// For complete documentation, see src/pixels/PixelFormat.cpp
|
|
#include <SDL3/SDL_pixels.h>
|
|
#include <hdk/grid/PrimitiveWrapper.hpp>
|
|
namespace hdk::sdl {
|
|
/// Forward declare to avoid circular dependency with PixelFormatDetails
|
|
class PixelFormatDetails;
|
|
class PixelFormat : public hdk::grid::PrimitiveWrapper<SDL_PixelFormat> {
|
|
public:
|
|
using hdk::grid::PrimitiveWrapper<SDL_PixelFormat>::PrimitiveWrapper;
|
|
bool GetMasks(int* bpp, Uint32* Rmask, Uint32* Gmask, Uint32* Bmask, Uint32* Amask) const {
|
|
return SDL_GetMasksForPixelFormat(*this, bpp, Rmask, Gmask, Bmask, Amask);
|
|
}
|
|
// Implemented in `../pixels.hpp` to avoid circular dependency
|
|
PixelFormatDetails GetDetails() const;
|
|
|
|
static SDL_PixelFormat GetForMasks(int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask) {
|
|
return SDL_GetPixelFormatForMasks(bpp, Rmask, Gmask, Bmask, Amask);
|
|
}
|
|
const char* GetName() const { return SDL_GetPixelFormatName(*this); }
|
|
|
|
};
|
|
} |