Lines Matching refs:im
37 static int bmp_read_direct(gdImagePtr im, gdIOCtxPtr infile, bmp_info_t *info, bmp_hdr_t *header);
38 static int bmp_read_1bit(gdImagePtr im, gdIOCtxPtr infile, bmp_info_t *info, bmp_hdr_t *header);
39 static int bmp_read_4bit(gdImagePtr im, gdIOCtxPtr infile, bmp_info_t *info, bmp_hdr_t *header);
40 static int bmp_read_8bit(gdImagePtr im, gdIOCtxPtr infile, bmp_info_t *info, bmp_hdr_t *header);
41 static int bmp_read_rle(gdImagePtr im, gdIOCtxPtr infile, bmp_info_t *info);
66 void * gdImageBmpPtr(gdImagePtr im, int *size, int compression) in gdImageBmpPtr() argument
71 gdImageBmpCtx(im, out, compression); in gdImageBmpPtr()
80 void gdImageBmp(gdImagePtr im, FILE *outFile, int compression) in gdImageBmp() argument
84 gdImageBmpCtx(im, out, compression); in gdImageBmp()
91 void gdImageBmpCtx(gdImagePtr im, gdIOCtxPtr out, int compression) in gdImageBmpCtx() argument
101 if (im->trueColor) { in gdImageBmpCtx()
119 bitmap_size = ((im->sx * (im->trueColor ? 24 : 8)) / 8) * im->sy; in gdImageBmpCtx()
125 if (!im->trueColor) { in gdImageBmpCtx()
126 info_size += im->colorsTotal * 4; in gdImageBmpCtx()
144 gdBMPPutInt(out, im->sx); /* width */ in gdImageBmpCtx()
145 gdBMPPutInt(out, im->sy); /* height */ in gdImageBmpCtx()
147 gdBMPPutWord(out, (im->trueColor ? 24 : 8)); /* bit count */ in gdImageBmpCtx()
152 gdBMPPutInt(out, im->colorsTotal); /* colours used */ in gdImageBmpCtx()
156 padding = ((int)(im->trueColor ? 3 : 1) * im->sx) % 4; in gdImageBmpCtx()
162 if (!im->trueColor) { in gdImageBmpCtx()
163 for(i = 0; i< im->colorsTotal; ++i) { in gdImageBmpCtx()
164 Putchar(gdImageBlue(im, i), out); in gdImageBmpCtx()
165 Putchar(gdImageGreen(im, i), out); in gdImageBmpCtx()
166 Putchar(gdImageRed(im, i), out); in gdImageBmpCtx()
172 …uncompressed_row = uncompressed_row_start = (unsigned char *) gdCalloc(gdImageSX(im) * 2, sizeof(c… in gdImageBmpCtx()
179 for (row = (im->sy - 1); row >= 0; row--) { in gdImageBmpCtx()
181 memset (uncompressed_row, 0, gdImageSX(im)); in gdImageBmpCtx()
184 for (xpos = 0; xpos < im->sx; xpos++) { in gdImageBmpCtx()
186 *uncompressed_row++ = (unsigned char)gdImageGetPixel(im, xpos, row); in gdImageBmpCtx()
188 Putchar(gdImageGetPixel(im, xpos, row), out); in gdImageBmpCtx()
200 if ((compressed_size = compress_row(uncompressed_row, gdImageSX(im))) < 0) { in gdImageBmpCtx()
234 for (row = (im->sy - 1); row >= 0; row--) { in gdImageBmpCtx()
235 for (xpos = 0; xpos < im->sx; xpos++) { in gdImageBmpCtx()
236 pixel = gdImageGetPixel(im, xpos, row); in gdImageBmpCtx()
414 gdImagePtr im = 0; in gdImageCreateFromBmp() local
417 im = gdImageCreateFromBmpCtx(in); in gdImageCreateFromBmp()
419 return im; in gdImageCreateFromBmp()
427 gdImagePtr im; in gdImageCreateFromBmpPtr() local
430 im = gdImageCreateFromBmpCtx(in); in gdImageCreateFromBmpPtr()
432 return im; in gdImageCreateFromBmpPtr()
442 gdImagePtr im = NULL; in gdImageCreateFromBmpCtx() local
478 im = gdImageCreateTrueColor(info->width, info->height); in gdImageCreateFromBmpCtx()
480 im = gdImageCreate(info->width, info->height); in gdImageCreateFromBmpCtx()
483 if (!im) { in gdImageCreateFromBmpCtx()
492 error = bmp_read_1bit(im, infile, info, hdr); in gdImageCreateFromBmpCtx()
496 error = bmp_read_4bit(im, infile, info, hdr); in gdImageCreateFromBmpCtx()
500 error = bmp_read_8bit(im, infile, info, hdr); in gdImageCreateFromBmpCtx()
506 error = bmp_read_direct(im, infile, info, hdr); in gdImageCreateFromBmpCtx()
517 gdImageDestroy(im); in gdImageCreateFromBmpCtx()
521 return im; in gdImageCreateFromBmpCtx()
672 static int bmp_read_direct(gdImagePtr im, gdIOCtxPtr infile, bmp_info_t *info, bmp_hdr_t *header) in bmp_read_direct() argument
753 gdImageSetPixel(im, xpos, row, gdTrueColor(red, green, blue)); in bmp_read_direct()
765 static int bmp_read_palette(gdImagePtr im, gdIOCtxPtr infile, int count, int read_four) in bmp_read_palette() argument
779 im->red[i] = r; in bmp_read_palette()
780 im->green[i] = g; in bmp_read_palette()
781 im->blue[i] = b; in bmp_read_palette()
782 im->open[i] = 1; in bmp_read_palette()
787 static int bmp_read_1bit(gdImagePtr im, gdIOCtxPtr infile, bmp_info_t *info, bmp_hdr_t *header) in bmp_read_1bit() argument
802 if (bmp_read_palette(im, infile, info->numcolors, (info->type == BMP_PALETTE_4))) { in bmp_read_1bit()
806 im->colorsTotal = info->numcolors; in bmp_read_1bit()
837 if (im->open[index]) { in bmp_read_1bit()
838 im->open[index] = 0; in bmp_read_1bit()
840 gdImageSetPixel(im, xpos + bit, row, index); in bmp_read_1bit()
857 static int bmp_read_4bit(gdImagePtr im, gdIOCtxPtr infile, bmp_info_t *info, bmp_hdr_t *header) in bmp_read_4bit() argument
872 if (bmp_read_palette(im, infile, info->numcolors, (info->type == BMP_PALETTE_4))) { in bmp_read_4bit()
876 im->colorsTotal = info->numcolors; in bmp_read_4bit()
907 if (im->open[index]) { in bmp_read_4bit()
908 im->open[index] = 0; in bmp_read_4bit()
910 gdImageSetPixel(im, xpos, row, index); in bmp_read_4bit()
918 if (im->open[index]) { in bmp_read_4bit()
919 im->open[index] = 0; in bmp_read_4bit()
921 gdImageSetPixel(im, xpos + 1, row, index); in bmp_read_4bit()
933 if (bmp_read_rle(im, infile, info)) { in bmp_read_4bit()
944 static int bmp_read_8bit(gdImagePtr im, gdIOCtxPtr infile, bmp_info_t *info, bmp_hdr_t *header) in bmp_read_8bit() argument
959 if (bmp_read_palette(im, infile, info->numcolors, (info->type == BMP_PALETTE_4))) { in bmp_read_8bit()
963 im->colorsTotal = info->numcolors; in bmp_read_8bit()
993 if (im->open[index]) { in bmp_read_8bit()
994 im->open[index] = 0; in bmp_read_8bit()
996 gdImageSetPixel(im, xpos, row, index); in bmp_read_8bit()
1008 if (bmp_read_rle(im, infile, info)) { in bmp_read_8bit()
1019 static int bmp_read_rle(gdImagePtr im, gdIOCtxPtr infile, bmp_info_t *info) in bmp_read_rle() argument
1034 if (im->open[rle_data]) { in bmp_read_rle()
1035 im->open[rle_data] = 0; in bmp_read_rle()
1041 if (im->open[index]) { in bmp_read_rle()
1042 im->open[index] = 0; in bmp_read_rle()
1044 gdImageSetPixel(im, xpos, row, index); in bmp_read_rle()
1064 if (im->open[temp]) { in bmp_read_rle()
1065 im->open[temp] = 0; in bmp_read_rle()
1067 gdImageSetPixel(im, xpos, row, temp); in bmp_read_rle()