1 #include "pixfmt-rgb32.hpp"
3 pixel_format_rgb32::~pixel_format_rgb32() throw() {}
5 void pixel_format_rgb32::decode(uint8_t* target
, const uint8_t* src
, size_t width
) throw()
7 const uint32_t* _src
= reinterpret_cast<const uint32_t*>(src
);
8 for(size_t i
= 0; i
< width
; i
++) {
9 target
[3 * i
+ 0] = _src
[i
] >> 16;
10 target
[3 * i
+ 1] = _src
[i
] >> 8;
11 target
[3 * i
+ 2] = _src
[i
];
15 void pixel_format_rgb32::decode(uint32_t* target
, const uint8_t* src
, size_t width
,
16 const pixel_format_aux_palette
<false>& auxp
) throw()
18 const uint32_t* _src
= reinterpret_cast<const uint32_t*>(src
);
19 for(size_t i
= 0; i
< width
; i
++) {
20 target
[i
] = ((_src
[i
] >> 16) & 0xFF) << auxp
.rshift
;
21 target
[i
] |= ((_src
[i
] >> 8) & 0xFF) << auxp
.gshift
;
22 target
[i
] |= (_src
[i
] & 0xFF) << auxp
.bshift
;
26 void pixel_format_rgb32::decode(uint64_t* target
, const uint8_t* src
, size_t width
,
27 const pixel_format_aux_palette
<true>& auxp
) throw()
29 const uint32_t* _src
= reinterpret_cast<const uint32_t*>(src
);
30 for(size_t i
= 0; i
< width
; i
++) {
31 target
[i
] = static_cast<uint64_t>((_src
[i
] >> 16) & 0xFF) << auxp
.rshift
;
32 target
[i
] |= static_cast<uint64_t>((_src
[i
] >> 8) & 0xFF) << auxp
.gshift
;
33 target
[i
] |= static_cast<uint64_t>(_src
[i
] & 0xFF) << auxp
.bshift
;
34 target
[i
] += (target
[i
] << 8);
38 void pixel_format_rgb32::set_palette(pixel_format_aux_palette
<false>& auxp
, uint8_t rshift
, uint8_t gshift
,
39 uint8_t bshift
) throw(std::bad_alloc
)
47 void pixel_format_rgb32::set_palette(pixel_format_aux_palette
<true>& auxp
, uint8_t rshift
, uint8_t gshift
,
48 uint8_t bshift
) throw(std::bad_alloc
)
56 uint8_t pixel_format_rgb32::get_bpp() throw()
61 uint8_t pixel_format_rgb32::get_ss_bpp() throw()
66 uint32_t pixel_format_rgb32::get_magic() throw()
71 pixel_format_rgb32 _pixel_format_rgb32
;