38 : name(
"noname"), hot(NULL)
95 f <<
"#define " << opt.
name <<
"_width " << m_image.width() <<
"\n";
96 f <<
"#define " << opt.
name <<
"_height " << m_image.height() <<
"\n";
98 if ( opt.
hot != NULL )
100 f <<
"#define " << opt.
name <<
"_x_hot " << opt.
hot->
x <<
"\n";
101 f <<
"#define " << opt.
name <<
"_y_hot " << opt.
hot->
y <<
"\n";
104 f <<
"static unsigned char " << opt.
name <<
"_bits[] = {\n ";
114 void claw::graphic::xbm::writer::save_bits( std::ostream& f )
const
116 const unsigned int max_per_line = (80 - 1) / 6;
117 const unsigned int nb_pxl = m_image.width() * m_image.height();
119 unsigned int pxl_count = 0;
120 unsigned int per_line = 0;
122 for (
unsigned int y=0; y!=m_image.height(); ++y)
126 while ( x!=m_image.width() )
131 for ( bits=0; (x!=m_image.width()) && (bits != 8);
132 ++bits, ++x, ++pxl_count )
135 if ( m_image[y][x].luminosity() <= 127 )
143 f <<
" 0x" << std::setw(2) << std::setfill(
'0') << std::hex << v;
145 if ( pxl_count != nb_pxl )
149 if ( per_line == max_per_line )
158 f <<
"};" << std::endl;