25 namespace L4Re {
namespace Video {
47 : _bits(bits), _shift(shift) {}
53 unsigned char size()
const {
return _bits; }
59 unsigned char shift()
const {
return _shift; }
66 {
return _shift == o._shift && _bits == o._bits; }
73 int get(
unsigned long v)
const 75 return ((v >> (
unsigned long)_shift)
76 & ~(~0UL << (
unsigned long)_bits)) << (
unsigned long)(16 - _bits);
84 long unsigned set(
int v)
const 85 {
return (v >> (
unsigned long)(16 - _bits)) << (
unsigned long)_shift; }
92 template<
typename OUT >
95 s.printf(
"%d(%d)", (
int)size(), (
int)shift());
97 } __attribute__((packed));
203 Pixel_info(
unsigned char bpp,
char r,
char rs,
char g,
char gs,
204 char b,
char bs,
char a = 0,
char as = 0)
205 : _r(r, rs), _g(g, gs), _b(b, bs), _a(a, as), _bpp(bpp)
214 template<
typename VBI>
216 : _r(vbi->red_mask_size, vbi->red_field_position),
217 _g(vbi->green_mask_size, vbi->green_field_position),
218 _b(vbi->blue_mask_size, vbi->blue_field_position),
219 _bpp((vbi->bits_per_pixel + 7) / 8)
229 return _r == o._r && _g == o._g && _b == o._b && _a == o._a && _bpp == o._bpp;
237 template<
typename OUT >
240 s.printf(
"RGBA(%d):%d(%d):%d(%d):%d(%d):%d(%d)",
241 (
int)bytes_per_pixel(),
242 (
int)r().size(), (
int)r().shift(),
243 (
int)g().size(), (
int)g().shift(),
244 (
int)b().size(), (
int)b().shift(),
245 (
int)a().size(), (
int)a().shift());
unsigned char shift() const
Return the position of the component in the pixel.
void dump(OUT &s) const
Dump information on the view information to a stream.
unsigned char size() const
Return the number of bits used by the component.
void r(Color_component const &c)
Set the red color component of the pixel.
Color_component(unsigned char bits, unsigned char shift)
Constructor.
Color_component const & r() const
Return the red color compoment of the pixel.
unsigned char bytes_per_pixel() const
Query size of pixel in bytes.
Color_component const & b() const
Return the blue color compoment of the pixel.
Color_component const & g() const
Return the green color compoment of the pixel.
L4 compiler related defines.
void dump(OUT &s) const
Dump information on the pixel to a stream.
Color_component const & a() const
Return the alpha color compoment of the pixel.
void b(Color_component const &c)
Set the blue color component of the pixel.
void a(Color_component const &c)
Set the alpha color component of the pixel.
bool has_alpha() const
Return whether the pixel has an alpha channel.
void bytes_per_pixel(unsigned char bpp)
Set the size of the pixel in bytes.
Color_component()
Constructor.
unsigned char bits_per_pixel() const
Number of bits of the pixel.
Pixel_info(unsigned char bpp, char r, char rs, char g, char gs, char b, char bs, char a=0, char as=0)
Constructor.
void g(Color_component const &c)
Set the green color component of the pixel.
Pixel_info(VBI const *vbi)
Convenience constructor.