14 uint32_t Rmask_, uint8_t Rshift_, uint8_t Rloss_,
15 uint32_t Gmask_, uint8_t Gshift_, uint8_t Gloss_,
16 uint32_t Bmask_, uint8_t Bshift_, uint8_t Bloss_,
17 uint32_t Amask_, uint8_t Ashift_, uint8_t Aloss_)
18 : Rmask (Rmask_), Gmask (Gmask_), Bmask (Bmask_), Amask (Amask_)
19 , Rshift(Rshift_), Gshift(Gshift_), Bshift(Bshift_), Ashift(Ashift_)
20 , Rloss (Rloss_), Gloss (Gloss_), Bloss (Bloss_), Aloss (Aloss_)
21 , bpp(
narrow<uint8_t>(bpp_))
22 , bytesPerPixel(
narrow<uint8_t>((bpp + 7) / 8)) {}
24 [[nodiscard]]
unsigned getBpp()
const {
return bpp; }
27 [[nodiscard]]
unsigned getRmask()
const {
return Rmask; }
28 [[nodiscard]]
unsigned getGmask()
const {
return Gmask; }
29 [[nodiscard]]
unsigned getBmask()
const {
return Bmask; }
30 [[nodiscard]]
unsigned getAmask()
const {
return Amask; }
32 [[nodiscard]]
unsigned getRshift()
const {
return Rshift; }
33 [[nodiscard]]
unsigned getGshift()
const {
return Gshift; }
34 [[nodiscard]]
unsigned getBshift()
const {
return Bshift; }
35 [[nodiscard]]
unsigned getAshift()
const {
return Ashift; }
37 [[nodiscard]]
unsigned getRloss()
const {
return Rloss; }
38 [[nodiscard]]
unsigned getGloss()
const {
return Gloss; }
39 [[nodiscard]]
unsigned getBloss()
const {
return Bloss; }
40 [[nodiscard]]
unsigned getAloss()
const {
return Aloss; }
42 [[nodiscard]]
unsigned map(
unsigned r,
unsigned g,
unsigned b)
const
44 return ((r >> Rloss) << Rshift) |
45 ((
g >> Gloss) << Gshift) |
46 ((b >> Bloss) << Bshift) |
51 uint32_t Rmask, Gmask, Bmask, Amask;
52 uint8_t Rshift, Gshift, Bshift, Ashift;
53 uint8_t Rloss, Gloss, Bloss, Aloss;
54 uint8_t bpp, bytesPerPixel;
This file implemented 3 utility functions:
constexpr To narrow(From from) noexcept