13#include <l4/cxx/minmax> 
   15namespace L4Re { 
namespace Video {
 
   37  : _bits(bits), _shift(
shift) {}
 
 
   43  unsigned char size()
 const { 
return _bits; }
 
   49  unsigned char shift()
 const { 
return _shift; }
 
   56  { 
return _shift == o._shift && _bits == o._bits; }
 
 
   63  int get(
unsigned long v)
 const 
   65    return ((v >> _shift) & ~(~0UL << _bits)) << (16UL - _bits);
 
 
   73  long unsigned set(
int v)
 const 
   74  { 
return (
static_cast<unsigned long>(v) >> (16UL - _bits)) << _shift; }
 
 
   80  template< 
typename OUT >
 
   83    s.printf(
"%d(%d)", 
static_cast<int>(
size()), 
static_cast<int>(
shift()));
 
 
   85} __attribute__((packed));
 
 
  133    unsigned char top_bit = cxx::max<unsigned char>(_r.size() + _r.shift(),
 
  134                                                    _g.size() + _g.shift());
 
  135    top_bit = cxx::max<unsigned char>(top_bit, _b.size() + _b.shift());
 
  136    top_bit = cxx::max<unsigned char>(top_bit, _a.size() + _a.shift());
 
  138    unsigned char bits = _bpp * 8;
 
 
  157  { 
return _r.size() + _g.size() + _b.size() + _a.size(); }
 
 
  213             char b, 
char bs, 
char a = 0, 
char as = 0)
 
  214  : _r(
r, rs), _g(
g, gs), _b(
b, bs), _a(
a, as), _bpp(bpp)
 
 
  223  template<
typename VBI>
 
  225  : _r(vbi->red_mask_size, vbi->red_field_position),
 
  226    _g(vbi->green_mask_size, vbi->green_field_position),
 
  227    _b(vbi->blue_mask_size, vbi->blue_field_position),
 
 
  238    return _r == o._r && _g == o._g && _b == o._b && _a == o._a && _bpp == o._bpp;
 
 
  245  template< 
typename OUT >
 
  248    s.printf(
"RGBA(%d):%d(%d):%d(%d):%d(%d):%d(%d)",
 
  250             static_cast<int>(
r().size()), 
static_cast<int>(
r().shift()),
 
  251             static_cast<int>(
g().size()), 
static_cast<int>(
g().shift()),
 
  252             static_cast<int>(
b().size()), 
static_cast<int>(
b().shift()),
 
  253             static_cast<int>(
a().size()), 
static_cast<int>(
a().shift()));
 
 
 
void dump(OUT &s) const
Dump information on the view information to a stream.
 
long unsigned set(int v) const
Transform 16bit normalized value to the component in the color space.
 
unsigned char size() const
Return the number of bits used by the component.
 
Color_component()
Constructor.
 
int get(unsigned long v) const
Get component from value (normalized to 16bits).
 
Color_component(unsigned char bits, unsigned char shift)
Constructor.
 
unsigned char shift() const
Return the position of the component in the pixel.
 
Color_component const & g() const
Return the green color compoment of the pixel.
 
Color_component const & b() const
Return the blue color compoment of the pixel.
 
Pixel_info(VBI const *vbi)
Convenience constructor.
 
Pixel_info(unsigned char bpp, char r, char rs, char g, char gs, char b, char bs, char a=0, char as=0)
Constructor.
 
Color_component const & a() const
Return the alpha color compoment of the pixel.
 
void a(Color_component const &c)
Set the alpha color component of the pixel.
 
void g(Color_component const &c)
Set the green color component of the pixel.
 
bool has_alpha() const
Return whether the pixel has an alpha channel.
 
Color_component const & r() const
Return the red color compoment of the pixel.
 
void bytes_per_pixel(unsigned char bpp)
Set the size of the pixel in bytes.
 
void r(Color_component const &c)
Set the red color component of the pixel.
 
void b(Color_component const &c)
Set the blue color component of the pixel.
 
void dump(OUT &s) const
Dump information on the pixel to a stream.
 
unsigned char bits_per_pixel() const
Number of bits of the pixel.
 
unsigned char bytes_per_pixel() const
Query size of pixel in bytes.
 
Color_component const padding() const
Compute the padding pseudo component.
 
L4 compiler related defines.
 
#define L4_EXPORT
Attribute to mark functions, variables, and data types as being exported from a library.