Lines Matching refs:info
32 static int bmp_read_info(gdIOCtxPtr infile, bmp_info_t *info);
33 static int bmp_read_windows_v3_info(gdIOCtxPtr infile, bmp_info_t *info);
34 static int bmp_read_os2_v1_info(gdIOCtxPtr infile, bmp_info_t *info);
35 static int bmp_read_os2_v2_info(gdIOCtxPtr infile, bmp_info_t *info);
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);
441 bmp_info_t *info; in gdImageCreateFromBmpCtx() local
459 if (!(info = (bmp_info_t *)gdCalloc(1, sizeof(bmp_info_t)))) { in gdImageCreateFromBmpCtx()
464 if (bmp_read_info(infile, info)) { in gdImageCreateFromBmpCtx()
466 gdFree(info); in gdImageCreateFromBmpCtx()
470 BMP_DEBUG(printf("Numcolours: %d\n", info->numcolors)); in gdImageCreateFromBmpCtx()
471 BMP_DEBUG(printf("Width: %d\n", info->width)); in gdImageCreateFromBmpCtx()
472 BMP_DEBUG(printf("Height: %d\n", info->height)); in gdImageCreateFromBmpCtx()
473 BMP_DEBUG(printf("Planes: %d\n", info->numplanes)); in gdImageCreateFromBmpCtx()
474 BMP_DEBUG(printf("Depth: %d\n", info->depth)); in gdImageCreateFromBmpCtx()
477 if (info->depth >= 16) { in gdImageCreateFromBmpCtx()
478 im = gdImageCreateTrueColor(info->width, info->height); in gdImageCreateFromBmpCtx()
480 im = gdImageCreate(info->width, info->height); in gdImageCreateFromBmpCtx()
485 gdFree(info); in gdImageCreateFromBmpCtx()
489 switch (info->depth) { 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()
514 gdFree(info); in gdImageCreateFromBmpCtx()
538 static int bmp_read_info(gdIOCtx *infile, bmp_info_t *info) in bmp_read_info() argument
541 if (!gdGetIntLSB(&info->len, infile)) { in bmp_read_info()
545 switch (info->len) { in bmp_read_info()
551 if (bmp_read_windows_v3_info(infile, info)) { in bmp_read_info()
556 if (bmp_read_os2_v1_info(infile, info)) { in bmp_read_info()
561 if (bmp_read_os2_v2_info(infile, info)) { in bmp_read_info()
572 static int bmp_read_windows_v3_info(gdIOCtxPtr infile, bmp_info_t *info) in bmp_read_windows_v3_info() argument
575 !gdGetIntLSB(&info->width, infile) || in bmp_read_windows_v3_info()
576 !gdGetIntLSB(&info->height, infile) || in bmp_read_windows_v3_info()
577 !gdGetWordLSB(&info->numplanes, infile) || in bmp_read_windows_v3_info()
578 !gdGetWordLSB(&info->depth, infile) || in bmp_read_windows_v3_info()
579 !gdGetIntLSB(&info->enctype, infile) || in bmp_read_windows_v3_info()
580 !gdGetIntLSB(&info->size, infile) || in bmp_read_windows_v3_info()
581 !gdGetIntLSB(&info->hres, infile) || in bmp_read_windows_v3_info()
582 !gdGetIntLSB(&info->vres, infile) || in bmp_read_windows_v3_info()
583 !gdGetIntLSB(&info->numcolors, infile) || in bmp_read_windows_v3_info()
584 !gdGetIntLSB(&info->mincolors, infile) in bmp_read_windows_v3_info()
589 if (info->height < 0) { in bmp_read_windows_v3_info()
590 info->topdown = 1; in bmp_read_windows_v3_info()
591 info->height = -info->height; in bmp_read_windows_v3_info()
593 info->topdown = 0; in bmp_read_windows_v3_info()
596 info->type = BMP_PALETTE_4; in bmp_read_windows_v3_info()
598 if (info->width <= 0 || info->height <= 0 || info->numplanes <= 0 || in bmp_read_windows_v3_info()
599 info->depth <= 0 || info->numcolors < 0 || info->mincolors < 0) { in bmp_read_windows_v3_info()
606 static int bmp_read_os2_v1_info(gdIOCtxPtr infile, bmp_info_t *info) in bmp_read_os2_v1_info() argument
609 !gdGetWordLSB((signed short int *)&info->width, infile) || in bmp_read_os2_v1_info()
610 !gdGetWordLSB((signed short int *)&info->height, infile) || in bmp_read_os2_v1_info()
611 !gdGetWordLSB(&info->numplanes, infile) || in bmp_read_os2_v1_info()
612 !gdGetWordLSB(&info->depth, infile) in bmp_read_os2_v1_info()
618 info->topdown = 0; in bmp_read_os2_v1_info()
620 info->numcolors = 1 << info->depth; in bmp_read_os2_v1_info()
621 info->type = BMP_PALETTE_3; in bmp_read_os2_v1_info()
623 if (info->width <= 0 || info->height <= 0 || info->numplanes <= 0 || in bmp_read_os2_v1_info()
624 info->depth <= 0 || info->numcolors < 0) { in bmp_read_os2_v1_info()
631 static int bmp_read_os2_v2_info(gdIOCtxPtr infile, bmp_info_t *info) in bmp_read_os2_v2_info() argument
635 !gdGetIntLSB(&info->width, infile) || in bmp_read_os2_v2_info()
636 !gdGetIntLSB(&info->height, infile) || in bmp_read_os2_v2_info()
637 !gdGetWordLSB(&info->numplanes, infile) || in bmp_read_os2_v2_info()
638 !gdGetWordLSB(&info->depth, infile) || in bmp_read_os2_v2_info()
639 !gdGetIntLSB(&info->enctype, infile) || in bmp_read_os2_v2_info()
640 !gdGetIntLSB(&info->size, infile) || in bmp_read_os2_v2_info()
641 !gdGetIntLSB(&info->hres, infile) || in bmp_read_os2_v2_info()
642 !gdGetIntLSB(&info->vres, infile) || in bmp_read_os2_v2_info()
643 !gdGetIntLSB(&info->numcolors, infile) || in bmp_read_os2_v2_info()
644 !gdGetIntLSB(&info->mincolors, infile) in bmp_read_os2_v2_info()
654 if (info->height < 0) { in bmp_read_os2_v2_info()
655 info->topdown = 1; in bmp_read_os2_v2_info()
656 info->height = -info->height; in bmp_read_os2_v2_info()
658 info->topdown = 0; in bmp_read_os2_v2_info()
661 info->type = BMP_PALETTE_4; in bmp_read_os2_v2_info()
663 if (info->width <= 0 || info->height <= 0 || info->numplanes <= 0 || in bmp_read_os2_v2_info()
664 info->depth <= 0 || info->numcolors < 0 || info->mincolors < 0) { in bmp_read_os2_v2_info()
672 static int bmp_read_direct(gdImagePtr im, gdIOCtxPtr infile, bmp_info_t *info, bmp_hdr_t *header) in bmp_read_direct() argument
678 switch(info->enctype) { in bmp_read_direct()
684 if (info->depth == 24) { in bmp_read_direct()
693 if (info->depth != 8) { in bmp_read_direct()
699 if (info->depth != 4) { in bmp_read_direct()
720 padding = ((int)(info->depth / 8) * info->width) % 4; in bmp_read_direct()
726 for (ypos = 0; ypos < info->height; ++ypos) { in bmp_read_direct()
727 if (info->topdown) { in bmp_read_direct()
730 row = info->height - ypos - 1; in bmp_read_direct()
733 for (xpos = 0; xpos < info->width; xpos++) { in bmp_read_direct()
734 if (info->depth == 16) { in bmp_read_direct()
743 } else if (info->depth == 24) { in bmp_read_direct()
787 static int bmp_read_1bit(gdImagePtr im, gdIOCtxPtr infile, bmp_info_t *info, bmp_hdr_t *header) in bmp_read_1bit() argument
792 if (info->enctype != BMP_BI_RGB) { in bmp_read_1bit()
796 if (!info->numcolors) { in bmp_read_1bit()
797 info->numcolors = 2; in bmp_read_1bit()
798 } else if (info->numcolors < 0 || info->numcolors > 2) { in bmp_read_1bit()
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()
817 padding = (info->width + 7) / 8 % 4; in bmp_read_1bit()
822 for (ypos = 0; ypos < info->height; ++ypos) { in bmp_read_1bit()
823 if (info->topdown) { in bmp_read_1bit()
826 row = info->height - ypos - 1; in bmp_read_1bit()
829 for (xpos = 0; xpos < info->width; xpos += 8) { in bmp_read_1bit()
842 if ((xpos + bit) >= info->width) { 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
862 if (info->enctype != BMP_BI_RGB && info->enctype != BMP_BI_RLE4) { in bmp_read_4bit()
866 if (!info->numcolors) { in bmp_read_4bit()
867 info->numcolors = 16; in bmp_read_4bit()
868 } else if (info->numcolors < 0 || info->numcolors > 16) { in bmp_read_4bit()
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()
887 padding = ((int)ceil(0.5 * info->width)) % 4; in bmp_read_4bit()
892 switch (info->enctype) { in bmp_read_4bit()
894 for (ypos = 0; ypos < info->height; ++ypos) { in bmp_read_4bit()
895 if (info->topdown) { in bmp_read_4bit()
898 row = info->height - ypos - 1; in bmp_read_4bit()
901 for (xpos = 0; xpos < info->width; xpos += 2) { in bmp_read_4bit()
913 if (xpos >= info->width) { 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
949 if (info->enctype != BMP_BI_RGB && info->enctype != BMP_BI_RLE8) { in bmp_read_8bit()
953 if (!info->numcolors) { in bmp_read_8bit()
954 info->numcolors = 256; in bmp_read_8bit()
955 } else if (info->numcolors < 0 || info->numcolors > 256) { in bmp_read_8bit()
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()
974 padding = (1 * info->width) % 4; in bmp_read_8bit()
979 switch (info->enctype) { in bmp_read_8bit()
981 for (ypos = 0; ypos < info->height; ++ypos) { in bmp_read_8bit()
982 if (info->topdown) { in bmp_read_8bit()
985 row = info->height - ypos - 1; in bmp_read_8bit()
988 for (xpos = 0; xpos < info->width; ++xpos) { 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
1025 int pixels_per_byte = 8 / info->depth; in bmp_read_rle()
1027 for (ypos = 0; ypos < info->height && xpos <= info->width;) { in bmp_read_rle()
1031 row = info->height - ypos - 1; in bmp_read_rle()
1038 for (i = 0; (i < rle_length) && (xpos < info->width);) { in bmp_read_rle()
1039 …for (j = 1; (j <= pixels_per_byte) && (xpos < info->width) && (i < rle_length); j++, xpos++, i++) { in bmp_read_rle()
1040 …index = (rle_data & (((1 << info->depth) - 1) << (8 - (j * info->depth)))) >> (8 - (j * info->dept… in bmp_read_rle()
1050 for (i = 0; (i < rle_data) && (xpos < info->width); i += pixels_per_byte) { in bmp_read_rle()
1062 for (j = 1; (j <= max_pixels) && (xpos < info->width); j++, xpos++) { in bmp_read_rle()
1063 int temp = (index >> (8 - (j * info->depth))) & ((1 << info->depth) - 1); in bmp_read_rle()