return $self;
}
- my $allow_partial = $input{allow_partial};
- defined $allow_partial or $allow_partial = 0;
+ my $allow_incomplete = $input{allow_incomplete};
+ defined $allow_incomplete or $allow_incomplete = 0;
if ( $input{'type'} eq 'tiff' ) {
my $page = $input{'page'};
defined $page or $page = 0;
- $self->{IMG}=i_readtiff_wiol( $IO, $allow_partial, $page );
+ $self->{IMG}=i_readtiff_wiol( $IO, $allow_incomplete, $page );
if ( !defined($self->{IMG}) ) {
$self->{ERRSTR}=$self->_error_as_msg(); return undef;
}
}
if ( $input{'type'} eq 'pnm' ) {
- $self->{IMG}=i_readpnm_wiol( $IO, $allow_partial );
+ $self->{IMG}=i_readpnm_wiol( $IO, $allow_incomplete );
if ( !defined($self->{IMG}) ) {
$self->{ERRSTR}='unable to read pnm image: '._error_as_msg();
return undef;
}
if ( $input{'type'} eq 'bmp' ) {
- $self->{IMG}=i_readbmp_wiol( $IO, $allow_partial );
+ $self->{IMG}=i_readbmp_wiol( $IO, $allow_incomplete );
if ( !defined($self->{IMG}) ) {
$self->{ERRSTR}=$self->_error_as_msg();
return undef;
#ifdef HAVE_LIBTIFF
Imager::ImgRaw
-i_readtiff_wiol(ig, allow_partial, page=0)
+i_readtiff_wiol(ig, allow_incomplete, page=0)
Imager::IO ig
- int allow_partial
+ int allow_incomplete
int page
void
Imager::ImgRaw
-i_readpnm_wiol(ig, allow_partial)
+i_readpnm_wiol(ig, allow_incomplete)
Imager::IO ig
- int allow_partial
+ int allow_incomplete
undef_int
Imager::IO ig
Imager::ImgRaw
-i_readbmp_wiol(ig, allow_partial=0)
+i_readbmp_wiol(ig, allow_incomplete=0)
Imager::IO ig
- int allow_partial
+ int allow_incomplete
undef_int
static int write_24bit_data(io_glue *ig, i_img *im);
static int read_bmp_pal(io_glue *ig, i_img *im, int count);
static i_img *read_1bit_bmp(io_glue *ig, int xsize, int ysize, int clr_used,
- int compression, long offbits, int allow_partial);
+ int compression, long offbits, int allow_incomplete);
static i_img *read_4bit_bmp(io_glue *ig, int xsize, int ysize, int clr_used,
- int compression, long offbits, int allow_partial);
+ int compression, long offbits, int allow_incomplete);
static i_img *read_8bit_bmp(io_glue *ig, int xsize, int ysize, int clr_used,
- int compression, long offbits, int allow_partial);
+ int compression, long offbits, int allow_incomplete);
static i_img *read_direct_bmp(io_glue *ig, int xsize, int ysize,
int bit_count, int clr_used, int compression,
- long offbits, int allow_partial);
+ long offbits, int allow_incomplete);
/*
=item i_writebmp_wiol(im, io_glue)
*/
i_img *
-i_readbmp_wiol(io_glue *ig, int allow_partial) {
+i_readbmp_wiol(io_glue *ig, int allow_incomplete) {
int b_magic, m_magic, filesize, res1, res2, infohead_size;
int xsize, ysize, planes, bit_count, compression, size_image, xres, yres;
int clr_used, clr_important, offbits;
&xsize, &ysize, &planes,
&bit_count, &compression, &size_image, &xres, &yres,
&clr_used, &clr_important)) {
- i_push_error(0, "file too short");
+ i_push_error(0, "file too short to be a BMP file");
return 0;
}
if (b_magic != 'B' || m_magic != 'M' || infohead_size != INFOHEAD_SIZE
switch (bit_count) {
case 1:
im = read_1bit_bmp(ig, xsize, ysize, clr_used, compression, offbits,
- allow_partial);
+ allow_incomplete);
break;
case 4:
im = read_4bit_bmp(ig, xsize, ysize, clr_used, compression, offbits,
- allow_partial);
+ allow_incomplete);
break;
case 8:
im = read_8bit_bmp(ig, xsize, ysize, clr_used, compression, offbits,
- allow_partial);
+ allow_incomplete);
break;
case 32:
case 24:
case 16:
im = read_direct_bmp(ig, xsize, ysize, bit_count, clr_used, compression,
- offbits, allow_partial);
+ offbits, allow_incomplete);
break;
default:
*/
static i_img *
read_1bit_bmp(io_glue *ig, int xsize, int ysize, int clr_used,
- int compression, long offbits, int allow_partial) {
+ int compression, long offbits, int allow_incomplete) {
i_img *im;
int x, y, lasty, yinc, start_y;
i_palidx *line, *p;
if (ig->readcb(ig, packed, line_size) != line_size) {
myfree(packed);
myfree(line);
- if (allow_partial) {
+ if (allow_incomplete) {
i_tags_setn(&im->tags, "i_incomplete", 1);
i_tags_setn(&im->tags, "i_lines_read", abs(start_y - y));
return im;
*/
static i_img *
read_4bit_bmp(io_glue *ig, int xsize, int ysize, int clr_used,
- int compression, long offbits, int allow_partial) {
+ int compression, long offbits, int allow_incomplete) {
i_img *im;
int x, y, lasty, yinc;
i_palidx *line, *p;
if (ig->readcb(ig, packed, line_size) != line_size) {
myfree(packed);
myfree(line);
- if (allow_partial) {
+ if (allow_incomplete) {
i_tags_setn(&im->tags, "i_incomplete", 1);
i_tags_setn(&im->tags, "i_lines_read", abs(y - starty));
return im;
if (ig->readcb(ig, packed, 2) != 2) {
myfree(packed);
myfree(line);
- if (allow_partial) {
+ if (allow_incomplete) {
i_tags_setn(&im->tags, "i_incomplete", 1);
i_tags_setn(&im->tags, "i_lines_read", abs(y - starty));
return im;
if (ig->readcb(ig, packed, 2) != 2) {
myfree(packed);
myfree(line);
- if (allow_partial) {
+ if (allow_incomplete) {
i_tags_setn(&im->tags, "i_incomplete", 1);
i_tags_setn(&im->tags, "i_lines_read", abs(y - starty));
return im;
if (ig->readcb(ig, packed, read_size) != read_size) {
myfree(packed);
myfree(line);
- if (allow_partial) {
+ if (allow_incomplete) {
i_tags_setn(&im->tags, "i_incomplete", 1);
i_tags_setn(&im->tags, "i_lines_read", abs(y - starty));
return im;
}
/*
-=item read_8bit_bmp(ig, xsize, ysize, clr_used, compression, allow_partial)
+=item read_8bit_bmp(ig, xsize, ysize, clr_used, compression, allow_incomplete)
Reads in the palette and image data for a 8-bit/pixel image.
*/
static i_img *
read_8bit_bmp(io_glue *ig, int xsize, int ysize, int clr_used,
- int compression, long offbits, int allow_partial) {
+ int compression, long offbits, int allow_incomplete) {
i_img *im;
int x, y, lasty, yinc, start_y;
i_palidx *line;
while (y != lasty) {
if (ig->readcb(ig, line, line_size) != line_size) {
myfree(line);
- if (allow_partial) {
+ if (allow_incomplete) {
i_tags_setn(&im->tags, "i_incomplete", 1);
i_tags_setn(&im->tags, "i_lines_read", abs(start_y - y));
return im;
/* there's always at least 2 bytes in a sequence */
if (ig->readcb(ig, packed, 2) != 2) {
myfree(line);
- if (allow_partial) {
+ if (allow_incomplete) {
i_tags_setn(&im->tags, "i_incomplete", 1);
i_tags_setn(&im->tags, "i_lines_read", abs(start_y-y));
return im;
case BMPRLE_DELTA:
if (ig->readcb(ig, packed, 2) != 2) {
myfree(line);
- if (allow_partial) {
+ if (allow_incomplete) {
i_tags_setn(&im->tags, "i_incomplete", 1);
i_tags_setn(&im->tags, "i_lines_read", abs(start_y-y));
return im;
read_size = (count+1) / 2 * 2;
if (ig->readcb(ig, line, read_size) != read_size) {
myfree(line);
- if (allow_partial) {
+ if (allow_incomplete) {
i_tags_setn(&im->tags, "i_incomplete", 1);
i_tags_setn(&im->tags, "i_lines_read", abs(start_y-y));
return im;
};
/*
-=item read_direct_bmp(ig, xsize, ysize, bit_count, clr_used, compression, allow_partial)
+=item read_direct_bmp(ig, xsize, ysize, bit_count, clr_used, compression, allow_incomplete)
Skips the palette and reads in the image data for a direct colour image.
static i_img *
read_direct_bmp(io_glue *ig, int xsize, int ysize, int bit_count,
int clr_used, int compression, long offbits,
- int allow_partial) {
+ int allow_incomplete) {
i_img *im;
int x, y, lasty, yinc;
i_color *line, *p;
unsigned pixel;
if (!read_packed(ig, unpack_code, &pixel)) {
myfree(line);
- if (allow_partial) {
+ if (allow_incomplete) {
i_tags_setn(&im->tags, "i_incomplete", 1);
i_tags_setn(&im->tags, "i_lines_read", lasty - y);
return im;
#endif /* HAVE_LIBJPEG */
#ifdef HAVE_LIBTIFF
-i_img * i_readtiff_wiol(io_glue *ig, int allow_partial, int page);
+i_img * i_readtiff_wiol(io_glue *ig, int allow_incomplete, int page);
i_img ** i_readtiff_multi_wiol(io_glue *ig, int length, int *count);
undef_int i_writetiff_wiol(i_img *im, io_glue *ig);
undef_int i_writetiff_multi_wiol(io_glue *ig, i_img **imgs, int count);
i_img * i_readraw_wiol(io_glue *ig, int x, int y, int datachannels, int storechannels, int intrl);
undef_int i_writeraw_wiol(i_img* im, io_glue *ig);
-i_img * i_readpnm_wiol(io_glue *ig, int allow_partial);
+i_img * i_readpnm_wiol(io_glue *ig, int allow_incomplete);
undef_int i_writeppm_wiol(i_img *im, io_glue *ig);
extern int i_writebmp_wiol(i_img *im, io_glue *ig);
-extern i_img *i_readbmp_wiol(io_glue *ig, int allow_partial);
+extern i_img *i_readbmp_wiol(io_glue *ig, int allow_incomplete);
int tga_header_verify(unsigned char headbuf[18]);
static
i_img *
read_pgm_ppm_bin8(mbuf *mb, i_img *im, int width, int height,
- int channels, int maxval, int allow_partial) {
+ int channels, int maxval, int allow_incomplete) {
i_color *line, *linep;
int read_size;
unsigned char *read_buf, *readp;
if (gread(mb, read_buf, read_size) != read_size) {
myfree(line);
myfree(read_buf);
- if (allow_partial) {
+ if (allow_incomplete) {
i_tags_setn(&im->tags, "i_incomplete", 1);
i_tags_setn(&im->tags, "i_lines_read", y);
return im;
static
i_img *
read_pgm_ppm_bin16(mbuf *mb, i_img *im, int width, int height,
- int channels, int maxval, int allow_partial) {
+ int channels, int maxval, int allow_incomplete) {
i_fcolor *line, *linep;
int read_size;
unsigned char *read_buf, *readp;
if (gread(mb, read_buf, read_size) != read_size) {
myfree(line);
myfree(read_buf);
- if (allow_partial) {
+ if (allow_incomplete) {
i_tags_setn(&im->tags, "i_incomplete", 1);
i_tags_setn(&im->tags, "i_lines_read", y);
return im;
static
i_img *
-read_pbm_bin(mbuf *mb, i_img *im, int width, int height, int allow_partial) {
+read_pbm_bin(mbuf *mb, i_img *im, int width, int height, int allow_incomplete) {
i_palidx *line, *linep;
int read_size;
unsigned char *read_buf, *readp;
if (gread(mb, read_buf, read_size) != read_size) {
myfree(line);
myfree(read_buf);
- if (allow_partial) {
+ if (allow_incomplete) {
i_tags_setn(&im->tags, "i_incomplete", 1);
i_tags_setn(&im->tags, "i_lines_read", y);
return im;
*/
static
i_img *
-read_pbm_ascii(mbuf *mb, i_img *im, int width, int height, int allow_partial) {
+read_pbm_ascii(mbuf *mb, i_img *im, int width, int height, int allow_incomplete) {
i_palidx *line, *linep;
int x, y;
skip_spaces(mb);
if (!(cp = gnext(mb)) || (*cp != '0' && *cp != '1')) {
myfree(line);
- if (allow_partial) {
+ if (allow_incomplete) {
i_tags_setn(&im->tags, "i_incomplete", 1);
i_tags_setn(&im->tags, "i_lines_read", y);
return im;
static
i_img *
read_pgm_ppm_ascii(mbuf *mb, i_img *im, int width, int height, int channels,
- int maxval, int allow_partial) {
+ int maxval, int allow_incomplete) {
i_color *line, *linep;
int x, y, ch;
int rounder = maxval / 2;
if (!gnum(mb, &sample)) {
myfree(line);
- if (allow_partial) {
+ if (allow_incomplete) {
i_tags_setn(&im->tags, "i_incomplete", 1);
i_tags_setn(&im->tags, "i_lines_read", 1);
return im;
static
i_img *
read_pgm_ppm_ascii_16(mbuf *mb, i_img *im, int width, int height,
- int channels, int maxval, int allow_partial) {
+ int channels, int maxval, int allow_incomplete) {
i_fcolor *line, *linep;
int x, y, ch;
double maxvalf = maxval;
if (!gnum(mb, &sample)) {
myfree(line);
- if (allow_partial) {
+ if (allow_incomplete) {
+ i_tags_setn(&im->tags, "i_incomplete", 1);
+ i_tags_setn(&im->tags, "i_lines_read", y);
+ return im;
}
else {
if (gpeek(mb))
}
/*
-=item i_readpnm_wiol(ig, allow_partial)
+=item i_readpnm_wiol(ig, allow_incomplete)
Retrieve an image and stores in the iolayer object. Returns NULL on fatal error.
ig - io_glue object
- allow_partial - allows a partial file to be read successfully
+ allow_incomplete - allows a partial file to be read successfully
=cut
*/
i_img *
-i_readpnm_wiol(io_glue *ig, int allow_partial) {
+i_readpnm_wiol(io_glue *ig, int allow_incomplete) {
i_img* im;
int type;
int width, height, maxval, channels, pcount;
mbuf buf;
i_clear_error();
- mm_log((1,"i_readpnm(ig %p, allow_partial %d)\n", ig, allow_partial));
+ mm_log((1,"i_readpnm(ig %p, allow_incomplete %d)\n", ig, allow_incomplete));
io_glue_commit_types(ig);
init_buf(&buf, ig);
switch (type) {
case 1: /* Ascii types */
- im = read_pbm_ascii(&buf, im, width, height, allow_partial);
+ im = read_pbm_ascii(&buf, im, width, height, allow_incomplete);
break;
case 2:
case 3:
if (maxval > 255)
- im = read_pgm_ppm_ascii_16(&buf, im, width, height, channels, maxval, allow_partial);
+ im = read_pgm_ppm_ascii_16(&buf, im, width, height, channels, maxval, allow_incomplete);
else
- im = read_pgm_ppm_ascii(&buf, im, width, height, channels, maxval, allow_partial);
+ im = read_pgm_ppm_ascii(&buf, im, width, height, channels, maxval, allow_incomplete);
break;
case 4: /* binary pbm */
- im = read_pbm_bin(&buf, im, width, height, allow_partial);
+ im = read_pbm_bin(&buf, im, width, height, allow_incomplete);
break;
case 5: /* binary pgm */
case 6: /* binary ppm */
if (maxval > 255)
- im = read_pgm_ppm_bin16(&buf, im, width, height, channels, maxval, allow_partial);
+ im = read_pgm_ppm_bin16(&buf, im, width, height, channels, maxval, allow_incomplete);
else
- im = read_pgm_ppm_bin8(&buf, im, width, height, channels, maxval, allow_partial);
+ im = read_pgm_ppm_bin8(&buf, im, width, height, channels, maxval, allow_incomplete);
break;
default:
/* do nothing */
}
-static i_img *read_one_tiff(TIFF *tif, int allow_partial) {
+static i_img *read_one_tiff(TIFF *tif, int allow_incomplete) {
i_img *im;
uint32 width, height;
uint16 channels;
++row;
}
if (row < height) {
- if (allow_partial) {
+ if (allow_incomplete) {
i_tags_setn(&im->tags, "i_lines_read", row);
}
else {
uint32 newrows, i_row;
if (!TIFFReadRGBAStrip(tif, row, raster)) {
- if (allow_partial) {
+ if (allow_incomplete) {
i_tags_setn(&im->tags, "i_lines_read", row);
error++;
break;
=cut
*/
i_img*
-i_readtiff_wiol(io_glue *ig, int allow_partial, int page) {
+i_readtiff_wiol(io_glue *ig, int allow_incomplete, int page) {
TIFF* tif;
TIFFErrorHandler old_handler;
TIFFErrorHandler old_warn_handler;
/* Also add code to check for mmapped code */
io_glue_commit_types(ig);
- mm_log((1, "i_readtiff_wiol(ig %p, allow_partial %d, page %d)\n", ig, allow_partial, page));
+ mm_log((1, "i_readtiff_wiol(ig %p, allow_incomplete %d, page %d)\n", ig, allow_incomplete, page));
tif = TIFFClientOpen("(Iolayer)",
"rm",
}
}
- im = read_one_tiff(tif, allow_partial);
+ im = read_one_tiff(tif, allow_incomplete);
if (TIFFLastDirectory(tif)) mm_log((1, "Last directory of tiff file\n"));
TIFFSetErrorHandler(old_handler);