Lines Matching refs:bh
181 bmphdr bh; int flags=O_RDONLY;
193 readme(fd, &bh.bfType, sizeof(unsigned short));
194 if(!littleendian()) bh.bfType=byteswap16(bh.bfType);
196 if(bh.bfType==0x3650)
201 if(bh.bfType==0x3350)
207 readme(fd, &bh.bfSize, sizeof(unsigned int));
208 readme(fd, &bh.bfReserved1, sizeof(unsigned short));
209 readme(fd, &bh.bfReserved2, sizeof(unsigned short));
210 readme(fd, &bh.bfOffBits, sizeof(unsigned int));
211 readme(fd, &bh.biSize, sizeof(unsigned int));
212 readme(fd, &bh.biWidth, sizeof(int));
213 readme(fd, &bh.biHeight, sizeof(int));
214 readme(fd, &bh.biPlanes, sizeof(unsigned short));
215 readme(fd, &bh.biBitCount, sizeof(unsigned short));
216 readme(fd, &bh.biCompression, sizeof(unsigned int));
217 readme(fd, &bh.biSizeImage, sizeof(unsigned int));
218 readme(fd, &bh.biXPelsPerMeter, sizeof(int));
219 readme(fd, &bh.biYPelsPerMeter, sizeof(int));
220 readme(fd, &bh.biClrUsed, sizeof(unsigned int));
221 readme(fd, &bh.biClrImportant, sizeof(unsigned int));
225 bh.bfSize=byteswap(bh.bfSize);
226 bh.bfOffBits=byteswap(bh.bfOffBits);
227 bh.biSize=byteswap(bh.biSize);
228 bh.biWidth=byteswap(bh.biWidth);
229 bh.biHeight=byteswap(bh.biHeight);
230 bh.biPlanes=byteswap16(bh.biPlanes);
231 bh.biBitCount=byteswap16(bh.biBitCount);
232 bh.biCompression=byteswap(bh.biCompression);
233 bh.biSizeImage=byteswap(bh.biSizeImage);
234 bh.biXPelsPerMeter=byteswap(bh.biXPelsPerMeter);
235 bh.biYPelsPerMeter=byteswap(bh.biYPelsPerMeter);
236 bh.biClrUsed=byteswap(bh.biClrUsed);
237 bh.biClrImportant=byteswap(bh.biClrImportant);
240 if(bh.bfType!=0x4d42 || bh.bfOffBits<BMPHDRSIZE
241 || bh.biWidth<1 || bh.biHeight==0)
243 if((bh.biBitCount!=24 && bh.biBitCount!=32) || bh.biCompression!=BI_RGB)
246 *w=bh.biWidth; *h=bh.biHeight; srcps=bh.biBitCount/8;
251 if(srcpitch*(*h)+bh.bfOffBits!=bh.bfSize) _throw("Corrupt bitmap header");
255 if(lseek(fd, (long)bh.bfOffBits, SEEK_SET)!=(long)bh.bfOffBits)
304 bmphdr bh; int mode;
325 bh.bfType=0x4d42;
326 bh.bfSize=BMPHDRSIZE+dstpitch*h;
327 bh.bfReserved1=0; bh.bfReserved2=0;
328 bh.bfOffBits=BMPHDRSIZE;
329 bh.biSize=40;
330 bh.biWidth=w; bh.biHeight=h;
331 bh.biPlanes=0; bh.biBitCount=24;
332 bh.biCompression=BI_RGB; bh.biSizeImage=0;
333 bh.biXPelsPerMeter=0; bh.biYPelsPerMeter=0;
334 bh.biClrUsed=0; bh.biClrImportant=0;
338 bh.bfType=byteswap16(bh.bfType);
339 bh.bfSize=byteswap(bh.bfSize);
340 bh.bfOffBits=byteswap(bh.bfOffBits);
341 bh.biSize=byteswap(bh.biSize);
342 bh.biWidth=byteswap(bh.biWidth);
343 bh.biHeight=byteswap(bh.biHeight);
344 bh.biPlanes=byteswap16(bh.biPlanes);
345 bh.biBitCount=byteswap16(bh.biBitCount);
346 bh.biCompression=byteswap(bh.biCompression);
347 bh.biSizeImage=byteswap(bh.biSizeImage);
348 bh.biXPelsPerMeter=byteswap(bh.biXPelsPerMeter);
349 bh.biYPelsPerMeter=byteswap(bh.biYPelsPerMeter);
350 bh.biClrUsed=byteswap(bh.biClrUsed);
351 bh.biClrImportant=byteswap(bh.biClrImportant);
354 writeme(fd, &bh.bfType, sizeof(unsigned short));
355 writeme(fd, &bh.bfSize, sizeof(unsigned int));
356 writeme(fd, &bh.bfReserved1, sizeof(unsigned short));
357 writeme(fd, &bh.bfReserved2, sizeof(unsigned short));
358 writeme(fd, &bh.bfOffBits, sizeof(unsigned int));
359 writeme(fd, &bh.biSize, sizeof(unsigned int));
360 writeme(fd, &bh.biWidth, sizeof(int));
361 writeme(fd, &bh.biHeight, sizeof(int));
362 writeme(fd, &bh.biPlanes, sizeof(unsigned short));
363 writeme(fd, &bh.biBitCount, sizeof(unsigned short));
364 writeme(fd, &bh.biCompression, sizeof(unsigned int));
365 writeme(fd, &bh.biSizeImage, sizeof(unsigned int));
366 writeme(fd, &bh.biXPelsPerMeter, sizeof(int));
367 writeme(fd, &bh.biYPelsPerMeter, sizeof(int));
368 writeme(fd, &bh.biClrUsed, sizeof(unsigned int));
369 writeme(fd, &bh.biClrImportant, sizeof(unsigned int));