29#define MAX_XBM_LINE_SIZE 255
38 unsigned int width = 0, height = 0;
44 int bit, x = 0, y = 0;
55 if (
sscanf(fline,
"#define %s %d", iname, &
value) == 2) {
63 width = (
unsigned int)
value;
66 height = (
unsigned int)
value;
69 if (
sscanf(fline,
"static unsigned char %s = {", iname) == 1
70 ||
sscanf(fline,
"static char %s = {", iname) == 1)
73 }
else if (
sscanf(fline,
"static unsigned short %s = {", iname) == 1
74 ||
sscanf(fline,
"static short %s = {", iname) == 1)
79 bytes = (width + 7) / 8 * height;
94 if (!bytes || !max_bit) {
105 for (i = 0; i < bytes; i++) {
107 if ((
ch=getc(
fd)) == EOF) {
119 if ((
ch=getc(
fd)) == EOF) {
123 if ((
ch=getc(
fd)) == EOF) {
127 if (max_bit == 32768) {
128 if ((
ch=getc(
fd)) == EOF) {
132 if ((
ch=getc(
fd)) == EOF) {
137 if (
sscanf(h,
"%x", &b) != 1) {
142 for (bit = 1; bit <= max_bit; bit = bit << 1) {
155 gd_error(
"EOF before image was complete");
168 va_start(
args, format);
179 int x, y, c, b, sx, sy,
p;
192 for (i=0; i<l; i++) {
194 if (!isupper(
name[i]) && !islower(
name[i]) && !isdigit(
name[i])) {
211 for (y = 0; y < sy; y++) {
212 for (x = 0; x < sx; x++) {
216 if ((b == 128) || (x == sx - 1)) {
sscanf(string $string, string $format, mixed &... $vars)
strrchr(string $haystack, string $needle, bool $before_needle=false)
fgets($stream, ?int $length=null)
zend_ffi_ctype_name_buf buf
gdImagePtr gdImageCreateFromXbm(FILE *fd)
void gdCtxPrintf(gdIOCtx *out, const char *format,...)
#define MAX_XBM_LINE_SIZE
void gdImageXbmCtx(gdImagePtr image, char *file_name, int fg, gdIOCtx *out)
gdImagePtr gdImageCreate(int sx, int sy)
int gdImageGetPixel(gdImagePtr im, int x, int y)
void gdImageDestroy(gdImagePtr im)
void gd_error(const char *format,...)
int gdImageColorAllocate(gdImagePtr im, int r, int g, int b)
void gdImageSetPixel(gdImagePtr im, int x, int y, int color)
strcmp(string $string1, string $string2)
#define strcasecmp(s1, s2)