Files
hdk-sdl/include/hdk/sdl/pixels/PixelFormatDetails.hpp
2026-05-11 10:28:21 +00:00

26 lines
1.1 KiB
C++

#pragma once
/// @file PixelFormatDetails.hpp
/// For complete documentation, see src/pixels/PixelFormatDetails.cpp
#include <SDL3/SDL_pixels.h>
#include <hdk/grid/PrimitiveWrapper.hpp>
namespace hdk::sdl {
class PixelFormatDetails : public hdk::grid::PrimitiveWrapper<const SDL_PixelFormatDetails*> {
public:
using hdk::grid::PrimitiveWrapper<const SDL_PixelFormatDetails*>::PrimitiveWrapper;
static PixelFormatDetails Get(SDL_PixelFormat format) {
return PixelFormatDetails(SDL_GetPixelFormatDetails(format));
}
void GetRGB(Uint32 pixel, SDL_Palette* palette, Uint8* r, Uint8* g, Uint8* b) const {
SDL_GetRGB(pixel, *this, palette, r, g, b);
}
void GetRGBA(Uint32 pixel, SDL_Palette* palette, Uint8* r, Uint8* g, Uint8* b, Uint8* a) const {
SDL_GetRGBA(pixel, *this, palette, r, g, b, a);
}
Uint32 MapRGB(SDL_Palette* palette, Uint8 r, Uint8 g, Uint8 b) const {
return SDL_MapRGB(*this, palette, r, g, b);
}
Uint32 MapRGBA(SDL_Palette* palette, Uint8 r, Uint8 g, Uint8 b, Uint8 a) const {
return SDL_MapRGBA(*this, palette, r, g, b, a);
}
};
}