92 Octet *data,
int flags)
100 if (width > 255 || height > 255)
101 new->infofield = 0x10;
103 new->infofield = 0x00;
106 new->height = height;
108 siz = (width * height + 7)/8;
110 new->main_image = gw_malloc(siz);
111 osiz = (width+7)/8 * height;
112 for(i=j=0; i<osiz; i++, j+=8) {
117 if (i > 0 && i % ((width+7)/8) == 0 && width % 8 > 0)
121 new->main_image[j/8] = val;
124 new->main_image[j/8] |= val >> (j % 8);
125 new->main_image[j/8 + 1] = val << (8 - j % 8);
139 Octet tmp_header[10];
144 sprintf(tmp_header,
"%c%c%c%c%c%c", pic->
infofield, pic->
width/256,
148 sprintf(tmp_header,
"%c%c%c%c", pic->
infofield,
155 *stream = gw_malloc(pic_size+pic_size);
156 memcpy(*stream, tmp_header, hdr_len);
157 memcpy(*stream + hdr_len, pic->
main_image, pic_size);
159 debug(
"util", 0,
"picture %d x %d, stream length %d",
162 return (hdr_len + pic_size);
int OTAbitmap_create_stream(OTAbitmap *pic, Octet **stream)
Octet reverse_octet(Octet source)
void debug(const char *place, int err, const char *fmt,...)
OTAbitmap * OTAbitmap_create_empty(void)
void OTAbitmap_delete(OTAbitmap *pic)
OTAbitmap * OTAbitmap_create(int width, int height, int depth, Octet *data, int flags)