Introduction: This is a detailed page for making an xbm image. It introduces PHP, related knowledge, skills, experience, and some PHP source code.
Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 325349 'rolling = 'no'>
Xbm is a simple two-color image bitmap format, which is widely used in early CGI. Currently, xbm is mostly used on counters.
<? PHP
Setxbm (1234567890,0 );
Function setxbm ($ num, $ mode = 0 ){
Settype ($ num, "string ");
$ Mode = $ mode? 0xff: 0x00;
$ Int_width = strlen ($ num); // number of digits
$ Count_width = 8; // individual numeric width
$ Count_height = 16; // height
$ Bitmap = array (
0 => array (0xff, 0xff, 0xff, 0xc3, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0xc3, 0xff, 0xff, 0xff ),
1 => array (0xff, 0xff, 0xff, 0xcf, 0xc7, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0xff, 0xff, 0xff ),
2 => array (0xff, 0xff, 0xff, 0xc3, 0x99, 0x9f, 0x9f, 0xcf, 0xe7, 0xf3, 0xf9, 0xf9, 0x81, 0xff, 0xff, 0xff ),
3 => array (0xff, 0xff, 0xff, 0xc3, 0x99, 0x9f, 0x9f, 0xc7, 0x9f, 0x9f, 0x9f, 0x99, 0xc3, 0xff, 0xff, 0xff ),
4 => array (0xff, 0xff, 0xff, 0xcf, 0xcf, 0xc7, 0xc7, 0xcb, 0xcb, 0xcd, 0x81, 0xcf, 0x87, 0xff, 0xff, 0xff ),
5 => array (0xff, 0xff, 0xff, 0x81, 0xf9, 0xf9, 0xf9, 0xc1, 0x9f, 0x9f, 0x9f, 0x99, 0xc3, 0xff, 0xff, 0xff ),
6 => array (0xff, 0xff, 0xff, 0xc7, 0xf3, 0xf9, 0xf9, 0xc1, 0x99, 0x99, 0x99, 0x99, 0xc3, 0xff, 0xff, 0xff ),
7 => array (0xff, 0xff, 0xff, 0x81, 0x99, 0x9f, 0x9f, 0xcf, 0xcf, 0xe7, 0xe7, 0xf3, 0xf3, 0xff, 0xff, 0xff, 0xff ),
8 => array (0xff, 0xff, 0xff, 0xc3, 0x99, 0x99, 0x99, 0xc3, 0x99, 0x99, 0x99, 0x99, 0x99, 0xc3, 0xff, 0xff, 0xff ),
9 => array (0xff, 0xff, 0xff, 0xc3, 0x99, 0x99, 0x99, 0x99, 0x83, 0x9f, 0x9f, 0xcf, 0xe3, 0xff, 0xff, 0xff)
);
Echo "# define counter_width". ($ count_width * $ int_width). "\ r \ n ";
Echo "# define counter_height". $ count_height. "\ r \ n ";
Echo "static unsigned char counter_bits [] = {\ r \ n ";
For ($ I = 0; $ I <$ count_height; ++ $ I ){
For ($ J = 0; $ j <$ int_width; ++ $ J ){
Printf ("0x % 2x,", $ bitmap [$ num [$ J] [$ I] ^ $ mode );
}
}
Echo "\ r \ n };";
}
?>
Love J2EE follow Java Michael Jackson video station JSON online tools
http://biancheng.dnbcw.info/php/325349.html pageno: 14