summaryrefslogtreecommitdiff
path: root/source/fitz/output-pnm.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2017-03-12 11:19:09 -0500
committerTor Andersson <tor.andersson@artifex.com>2017-03-22 12:07:26 +0100
commitcfb66cd25bbf31857b471735e5ff0f7c2aea4d3c (patch)
tree8d8d06c9e2c880611a3c8cc025d8c35fe38d59ba /source/fitz/output-pnm.c
parent3832d0c7ab87aa1f2b3a3dbebe43a37e4055d121 (diff)
downloadmupdf-cfb66cd25bbf31857b471735e5ff0f7c2aea4d3c.tar.xz
Rename fz_putc/puts/printf to fz_write_*.
Rename fz_write to fz_write_data. Rename fz_write_buffer_* and fz_buffer_printf to fz_append_*. Be consistent in naming: fz_write_* calls write to fz_output. fz_append_* calls append to fz_buffer. Update documentation.
Diffstat (limited to 'source/fitz/output-pnm.c')
-rw-r--r--source/fitz/output-pnm.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/source/fitz/output-pnm.c b/source/fitz/output-pnm.c
index 299c9e47..dbc521b7 100644
--- a/source/fitz/output-pnm.c
+++ b/source/fitz/output-pnm.c
@@ -17,11 +17,11 @@ pnm_write_header(fz_context *ctx, fz_band_writer *writer)
fz_throw(ctx, FZ_ERROR_GENERIC, "pixmap must be grayscale or rgb to write as pnm");
if (n == 1)
- fz_printf(ctx, out, "P5\n");
+ fz_write_printf(ctx, out, "P5\n");
if (n == 3)
- fz_printf(ctx, out, "P6\n");
- fz_printf(ctx, out, "%d %d\n", w, h);
- fz_printf(ctx, out, "255\n");
+ fz_write_printf(ctx, out, "P6\n");
+ fz_write_printf(ctx, out, "%d %d\n", w, h);
+ fz_write_printf(ctx, out, "255\n");
}
static void
@@ -61,7 +61,7 @@ pnm_write_band(fz_context *ctx, fz_band_writer *writer, int stride, int band_sta
{
case 1:
/* No collation required */
- fz_write(ctx, out, p, num_written);
+ fz_write_data(ctx, out, p, num_written);
p += num_written;
break;
case 2:
@@ -77,11 +77,11 @@ pnm_write_band(fz_context *ctx, fz_band_writer *writer, int stride, int band_sta
*o++ = *p;
p += 2;
}
- fz_write(ctx, out, buffer, num_written);
+ fz_write_data(ctx, out, buffer, num_written);
break;
}
case 3:
- fz_write(ctx, out, p, num_written*3);
+ fz_write_data(ctx, out, p, num_written*3);
p += num_written*3;
break;
case 4:
@@ -99,7 +99,7 @@ pnm_write_band(fz_context *ctx, fz_band_writer *writer, int stride, int band_sta
*o++ = p[2];
p += n;
}
- fz_write(ctx, out, buffer, num_written * 3);
+ fz_write_data(ctx, out, buffer, num_written * 3);
break;
}
}
@@ -164,22 +164,22 @@ pam_write_header(fz_context *ctx, fz_band_writer *writer)
int n = writer->n;
int alpha = writer->alpha;
- fz_printf(ctx, out, "P7\n");
- fz_printf(ctx, out, "WIDTH %d\n", w);
- fz_printf(ctx, out, "HEIGHT %d\n", h);
- fz_printf(ctx, out, "DEPTH %d\n", n);
- fz_printf(ctx, out, "MAXVAL 255\n");
+ fz_write_printf(ctx, out, "P7\n");
+ fz_write_printf(ctx, out, "WIDTH %d\n", w);
+ fz_write_printf(ctx, out, "HEIGHT %d\n", h);
+ fz_write_printf(ctx, out, "DEPTH %d\n", n);
+ fz_write_printf(ctx, out, "MAXVAL 255\n");
n -= alpha;
- if (n == 0 && alpha) fz_printf(ctx, out, "TUPLTYPE GRAYSCALE\n");
- else if (n == 1 && !alpha) fz_printf(ctx, out, "TUPLTYPE GRAYSCALE\n");
- else if (n == 1 && alpha) fz_printf(ctx, out, "TUPLTYPE GRAYSCALE_ALPHA\n");
- else if (n == 3 && !alpha) fz_printf(ctx, out, "TUPLTYPE RGB\n");
- else if (n == 3 && alpha) fz_printf(ctx, out, "TUPLTYPE RGB_ALPHA\n");
- else if (n == 4 && !alpha) fz_printf(ctx, out, "TUPLTYPE CMYK\n");
- else if (n == 5) fz_printf(ctx, out, "TUPLTYPE CMYK_ALPHA\n");
- fz_printf(ctx, out, "ENDHDR\n");
+ if (n == 0 && alpha) fz_write_printf(ctx, out, "TUPLTYPE GRAYSCALE\n");
+ else if (n == 1 && !alpha) fz_write_printf(ctx, out, "TUPLTYPE GRAYSCALE\n");
+ else if (n == 1 && alpha) fz_write_printf(ctx, out, "TUPLTYPE GRAYSCALE_ALPHA\n");
+ else if (n == 3 && !alpha) fz_write_printf(ctx, out, "TUPLTYPE RGB\n");
+ else if (n == 3 && alpha) fz_write_printf(ctx, out, "TUPLTYPE RGB_ALPHA\n");
+ else if (n == 4 && !alpha) fz_write_printf(ctx, out, "TUPLTYPE CMYK\n");
+ else if (n == 5) fz_write_printf(ctx, out, "TUPLTYPE CMYK_ALPHA\n");
+ fz_write_printf(ctx, out, "ENDHDR\n");
}
static void
@@ -201,7 +201,7 @@ pam_write_band(fz_context *ctx, fz_band_writer *writer, int stride, int band_sta
for (y = 0; y < end; y++)
{
- fz_write(ctx, out, sp, w * n);
+ fz_write_data(ctx, out, sp, w * n);
sp += stride;
}
}