Lines Matching refs:image
516 static int writeCroppedImage(TIFF *, TIFF *, struct image_data *image,
2197 struct image_data image; /* Image parameters for one image */ in main() local
2220 initImageData(&image); in main()
2345 if (loadImage(in, &image, &dump, &read_buff)) in main()
2353 if (image.adjustments != 0) in main()
2355 if (correct_orientation(&image, &read_buff)) in main()
2359 if (getCropOffsets(&image, &crop, &dump)) in main()
2367 if (processCropSelections(&image, &crop, &read_buff, seg_buffs)) in main()
2375 if (createCroppedImage(&image, &crop, &read_buff, &crop_buff)) in main()
2385 writeSelections(in, &out, &crop, &image, &dump, seg_buffs, in main()
2393 if (writeCroppedImage(in, out, &image, &dump,crop.combined_width, in main()
2411 if (computeOutputPixelOffsets(&crop, &image, &page, sections, &dump)) in main()
2422 if (writeImageSections(in, out, &image, &page, sections, &dump, sect_src, §_buff)) in main()
5000 initImageData (struct image_data *image) in initImageData() argument
5002 image->xres = 0.0; in initImageData()
5003 image->yres = 0.0; in initImageData()
5004 image->width = 0; in initImageData()
5005 image->length = 0; in initImageData()
5006 image->res_unit = RESUNIT_NONE; in initImageData()
5007 image->bps = 0; in initImageData()
5008 image->spp = 0; in initImageData()
5009 image->planar = 0; in initImageData()
5010 image->photometric = 0; in initImageData()
5011 image->orientation = 0; in initImageData()
5012 image->compression = COMPRESSION_NONE; in initImageData()
5013 image->adjustments = 0; in initImageData()
5072 computeInputPixelOffsets(struct crop_mask *crop, struct image_data *image, in computeInputPixelOffsets() argument
5086 if (image->res_unit != RESUNIT_INCH && image->res_unit != RESUNIT_CENTIMETER) in computeInputPixelOffsets()
5093 if (((image->xres == 0) || (image->yres == 0)) && in computeInputPixelOffsets()
5102 xres = image->xres; in computeInputPixelOffsets()
5103 yres = image->yres; in computeInputPixelOffsets()
5110 if (image->res_unit == RESUNIT_INCH) in computeInputPixelOffsets()
5114 if (image->res_unit == RESUNIT_CENTIMETER) in computeInputPixelOffsets()
5146 if (x2 > image->width - 1) in computeInputPixelOffsets()
5147 crop->regionlist[i].x2 = image->width - 1; in computeInputPixelOffsets()
5157 if (y2 > image->length - 1) in computeInputPixelOffsets()
5158 crop->regionlist[i].y2 = image->length - 1; in computeInputPixelOffsets()
5170 (((zwidth * image->bps * image->spp + 7 ) / 8) * (zlength + 1)); in computeInputPixelOffsets()
5215 if ((lmargin + rmargin) > image->width) in computeInputPixelOffsets()
5222 if ((tmargin + bmargin) > image->length) in computeInputPixelOffsets()
5244 width = image->width - lmargin - rmargin; in computeInputPixelOffsets()
5249 length = image->length - tmargin - bmargin; in computeInputPixelOffsets()
5254 width = (uint32)(crop->width * scale * image->xres); in computeInputPixelOffsets()
5256 width = image->width - lmargin - rmargin; in computeInputPixelOffsets()
5259 length = (uint32)(crop->length * scale * image->yres); in computeInputPixelOffsets()
5261 length = image->length - tmargin - bmargin; in computeInputPixelOffsets()
5275 if ((startx + width) >= (image->width - rmargin)) in computeInputPixelOffsets()
5276 endx = image->width - rmargin - 1; in computeInputPixelOffsets()
5280 endy = image->length - bmargin - 1; in computeInputPixelOffsets()
5287 endx = image->width - rmargin - 1; in computeInputPixelOffsets()
5294 if ((starty + length) >= (image->length - bmargin)) in computeInputPixelOffsets()
5295 endy = image->length - bmargin - 1; in computeInputPixelOffsets()
5303 if ((startx + width) >= (image->width - rmargin)) in computeInputPixelOffsets()
5304 endx = image->width - rmargin - 1; in computeInputPixelOffsets()
5309 if ((starty + length) >= (image->length - bmargin)) in computeInputPixelOffsets()
5310 endy = image->length - bmargin - 1; in computeInputPixelOffsets()
5329 if (crop_width > image->width) in computeInputPixelOffsets()
5330 crop_width = image->width; in computeInputPixelOffsets()
5338 if (crop_length > image->length) in computeInputPixelOffsets()
5339 crop_length = image->length; in computeInputPixelOffsets()
5359 getCropOffsets(struct image_data *image, struct crop_mask *crop, struct dump_opts *dump) in getCropOffsets() argument
5380 if (computeInputPixelOffsets(crop, image, &offsets)) in getCropOffsets()
5397 offsets.crop_width = image->width; in getCropOffsets()
5398 offsets.crop_length = image->length; in getCropOffsets()
5400 offsets.endx = image->width - 1; in getCropOffsets()
5402 offsets.endy = image->length - 1; in getCropOffsets()
5419 crop->combined_width = image->width; in getCropOffsets()
5420 crop->combined_length = image->length; in getCropOffsets()
5457 if (test > (int32)(image->width - 1)) in getCropOffsets()
5458 crop->regionlist[i].x2 = image->width - 1; in getCropOffsets()
5487 if (test > (int32)(image->length - 1)) in getCropOffsets()
5488 crop->regionlist[i].y2 = image->length - 1; in getCropOffsets()
5514 if (test > (int32)(image->width - 1)) in getCropOffsets()
5515 crop->regionlist[i].x2 = image->width - 1; in getCropOffsets()
5540 if (test > (int32)(image->length - 1)) in getCropOffsets()
5541 crop->regionlist[i].y2 = image->length - 1; in getCropOffsets()
5557 ((((zwidth * image->bps * image->spp) + 7 ) / 8) * (zlength + 1)); in getCropOffsets()
5576 computeOutputPixelOffsets (struct crop_mask *crop, struct image_data *image, in computeOutputPixelOffsets() argument
5592 page->res_unit = image->res_unit; in computeOutputPixelOffsets()
5594 switch (image->res_unit) { in computeOutputPixelOffsets()
5612 iwidth = image->width; in computeOutputPixelOffsets()
5616 ilength = image->length; in computeOutputPixelOffsets()
5619 page->hres = image->xres; in computeOutputPixelOffsets()
5621 page->vres = image->yres; in computeOutputPixelOffsets()
5658 hmargin = (uint32)(page->hmargin * scale * page->hres * ((image->bps + 7)/ 8)); in computeOutputPixelOffsets()
5659 vmargin = (uint32)(page->vmargin * scale * page->vres * ((image->bps + 7)/ 8)); in computeOutputPixelOffsets()
5663 hmargin = (uint32)(page->hmargin * scale * ((image->bps + 7)/ 8)); in computeOutputPixelOffsets()
5664 vmargin = (uint32)(page->vmargin * scale * ((image->bps + 7)/ 8)); in computeOutputPixelOffsets()
5771 line_bytes = TIFFhowmany8(owidth * image->bps) * image->spp; in computeOutputPixelOffsets()
5806 loadImage(TIFF* in, struct image_data *image, struct dump_opts *dump, unsigned char **read_ptr) in loadImage() argument
5912 image->bps = bps; in loadImage()
5913 image->spp = spp; in loadImage()
5914 image->planar = planar; in loadImage()
5915 image->width = width; in loadImage()
5916 image->length = length; in loadImage()
5917 image->xres = xres; in loadImage()
5918 image->yres = yres; in loadImage()
5919 image->res_unit = res_unit; in loadImage()
5920 image->compression = input_compression; in loadImage()
5921 image->photometric = input_photometric; in loadImage()
5970 image->orientation = orientation; in loadImage()
5975 image->adjustments = 0; in loadImage()
5978 image->adjustments = MIRROR_HORIZ; in loadImage()
5981 image->adjustments = ROTATECW_180; in loadImage()
5984 image->adjustments = MIRROR_VERT; in loadImage()
5987 image->adjustments = MIRROR_VERT | ROTATECW_90; in loadImage()
5990 image->adjustments = ROTATECW_90; in loadImage()
5993 image->adjustments = MIRROR_VERT | ROTATECW_270; in loadImage()
5996 image->adjustments = ROTATECW_270; in loadImage()
5999 image->adjustments = 0; in loadImage()
6000 image->orientation = ORIENTATION_TOPLEFT; in loadImage()
6220 static int correct_orientation(struct image_data *image, unsigned char **work_buff_ptr) in correct_orientation() argument
6226 if ((image == NULL) || (work_buff == NULL)) in correct_orientation()
6232 if ((image->adjustments & MIRROR_HORIZ) || (image->adjustments & MIRROR_VERT)) in correct_orientation()
6234 mirror = (uint16)(image->adjustments & MIRROR_BOTH); in correct_orientation()
6235 if (mirrorImage(image->spp, image->bps, mirror, in correct_orientation()
6236 image->width, image->length, work_buff)) in correct_orientation()
6243 if (image->adjustments & ROTATE_ANY) in correct_orientation()
6245 if (image->adjustments & ROTATECW_90) in correct_orientation()
6248 if (image->adjustments & ROTATECW_180) in correct_orientation()
6251 if (image->adjustments & ROTATECW_270) in correct_orientation()
6256 image->adjustments & ROTATE_ANY); in correct_orientation()
6260 if (rotateImage(rotation, image, &image->width, &image->length, work_buff_ptr)) in correct_orientation()
6265 image->orientation = ORIENTATION_TOPLEFT; in correct_orientation()
6274 extractCompositeRegions(struct image_data *image, struct crop_mask *crop, in extractCompositeRegions() argument
6287 img_width = image->width; in extractCompositeRegions()
6289 bps = image->bps; in extractCompositeRegions()
6290 spp = image->spp; in extractCompositeRegions()
6522 extractSeparateRegion(struct image_data *image, struct crop_mask *crop, in extractSeparateRegion() argument
6536 img_width = image->width; in extractSeparateRegion()
6538 bps = image->bps; in extractSeparateRegion()
6539 spp = image->spp; in extractSeparateRegion()
6645 extractImageSection(struct image_data *image, struct pageseg *section, in extractImageSection() argument
6673 img_width = image->width; in extractImageSection()
6675 img_length = image->length; in extractImageSection()
6677 bps = image->bps; in extractImageSection()
6678 spp = image->spp; in extractImageSection()
6878 struct image_data *image, struct dump_opts *dump, in writeSelections() argument
6895 if (writeCroppedImage(in, *out, image, dump, in writeSelections()
6912 if (writeCroppedImage(in, *out, image, dump, in writeSelections()
6928 if (writeCroppedImage(in, *out, image, dump, in writeSelections()
6947 if (writeCroppedImage(in, *out, image, dump, in writeSelections()
6967 if (writeCroppedImage(in, *out, image, dump, in writeSelections()
6984 writeImageSections(TIFF *in, TIFF *out, struct image_data *image, in writeImageSections() argument
7009 ceil((width * image->bps + 7) / (double)8) * image->spp * length; in writeImageSections()
7018 if (extractImageSection (image, §ions[i], src_buff, sect_buff)) in writeImageSections()
7025 if (writeSingleSection(in, out, image, dump, width, length, hres, vres, sect_buff)) in writeImageSections()
7042 writeSingleSection(TIFF *in, TIFF *out, struct image_data *image, in writeSingleSection() argument
7055 input_compression = image->compression; in writeSingleSection()
7056 input_photometric = image->photometric; in writeSingleSection()
7058 spp = image->spp; in writeSingleSection()
7059 bps = image->bps; in writeSingleSection()
7112 TIFFSetField(out, TIFFTAG_PHOTOMETRIC, image->photometric); in writeSingleSection()
7143 TIFFSetField(out, TIFFTAG_ORIENTATION, image->orientation); in writeSingleSection()
7358 processCropSelections(struct image_data *image, struct crop_mask *crop, in processCropSelections() argument
7404 if (extractCompositeRegions(image, crop, read_buff, crop_buff) != 0) in processCropSelections()
7414 image->photometric = crop->photometric; in processCropSelections()
7418 if (invertImage(image->photometric, image->spp, image->bps, in processCropSelections()
7427 switch (image->photometric) in processCropSelections()
7430 image->photometric = PHOTOMETRIC_MINISBLACK; in processCropSelections()
7433 image->photometric = PHOTOMETRIC_MINISWHITE; in processCropSelections()
7447 if (mirrorImage(image->spp, image->bps, crop->mirror, in processCropSelections()
7458 if (rotateImage(crop->rotation, image, &crop->combined_width, in processCropSelections()
7466 seg_buffs[0].size = (((crop->combined_width * image->bps + 7 ) / 8) in processCropSelections()
7467 * image->spp) * crop->combined_length; in processCropSelections()
7505 if (extractSeparateRegion(image, crop, read_buff, crop_buff, i)) in processCropSelections()
7521 image->photometric = crop->photometric; in processCropSelections()
7525 if (invertImage(image->photometric, image->spp, image->bps, in processCropSelections()
7534 switch (image->photometric) in processCropSelections()
7537 image->photometric = PHOTOMETRIC_MINISBLACK; in processCropSelections()
7540 image->photometric = PHOTOMETRIC_MINISWHITE; in processCropSelections()
7553 if (mirrorImage(image->spp, image->bps, crop->mirror, in processCropSelections()
7564 if (rotateImage(crop->rotation, image, &crop->regionlist[i].width, in processCropSelections()
7576 seg_buffs[i].size = (((crop->regionlist[i].width * image->bps + 7 ) / 8) in processCropSelections()
7577 * image->spp) * crop->regionlist[i].length; in processCropSelections()
7593 createCroppedImage(struct image_data *image, struct crop_mask *crop, in createCroppedImage() argument
7607 crop->combined_width = image->width; in createCroppedImage()
7608 crop->combined_length = image->length; in createCroppedImage()
7649 image->photometric = crop->photometric; in createCroppedImage()
7653 if (invertImage(image->photometric, image->spp, image->bps, in createCroppedImage()
7662 switch (image->photometric) in createCroppedImage()
7665 image->photometric = PHOTOMETRIC_MINISBLACK; in createCroppedImage()
7668 image->photometric = PHOTOMETRIC_MINISWHITE; in createCroppedImage()
7681 if (mirrorImage(image->spp, image->bps, crop->mirror, in createCroppedImage()
7692 if (rotateImage(crop->rotation, image, &crop->combined_width, in createCroppedImage()
7720 writeCroppedImage(TIFF *in, TIFF *out, struct image_data *image, in writeCroppedImage() argument
7729 input_compression = image->compression; in writeCroppedImage()
7730 input_photometric = image->photometric; in writeCroppedImage()
7731 spp = image->spp; in writeCroppedImage()
7732 bps = image->bps; in writeCroppedImage()
7792 TIFFSetField(out, TIFFTAG_PHOTOMETRIC, image->photometric); in writeCroppedImage()
7818 TIFFSetField(out, TIFFTAG_ORIENTATION, image->orientation); in writeCroppedImage()
8356 rotateImage(uint16 rotation, struct image_data *image, uint32 *img_width, in rotateImage() argument
8373 spp = image->spp; in rotateImage()
8374 bps = image->bps; in rotateImage()
8547 image->width = length; in rotateImage()
8548 image->length = width; in rotateImage()
8549 res_temp = image->xres; in rotateImage()
8550 image->xres = image->yres; in rotateImage()
8551 image->yres = res_temp; in rotateImage()
8624 image->width = length; in rotateImage()
8625 image->length = width; in rotateImage()
8626 res_temp = image->xres; in rotateImage()
8627 image->xres = image->yres; in rotateImage()
8628 image->yres = res_temp; in rotateImage()