diff options
Diffstat (limited to 'apps/xpsdraw.c')
-rw-r--r-- | apps/xpsdraw.c | 77 |
1 files changed, 38 insertions, 39 deletions
diff --git a/apps/xpsdraw.c b/apps/xpsdraw.c index 2e30de9a..41d01c14 100644 --- a/apps/xpsdraw.c +++ b/apps/xpsdraw.c @@ -18,7 +18,7 @@ int savealpha = 0; int uselist = 1; fz_colorspace *colorspace; -fz_glyphcache *glyphcache; +fz_glyph_cache *glyphcache; char *filename; struct { @@ -81,13 +81,13 @@ xps_run_page(xps_context *ctx, xps_page *page, fz_device *dev, fz_matrix ctm) { ctx->dev = dev; xps_parse_fixed_page(ctx, ctm, page); - ctx->dev = nil; + ctx->dev = NULL; } static void drawpage(xps_context *ctx, int pagenum) { xps_page *page; - fz_displaylist *list; + fz_display_list *list; fz_device *dev; int start; @@ -100,44 +100,44 @@ static void drawpage(xps_context *ctx, int pagenum) if (!page) die(fz_throw("cannot load page %d in file '%s'", pagenum, filename)); - list = nil; + list = NULL; if (uselist) { - list = fz_newdisplaylist(); - dev = fz_newlistdevice(list); + list = fz_new_display_list(); + dev = fz_new_list_device(list); xps_run_page(ctx, page, dev, fz_identity); - fz_freedevice(dev); + fz_free_device(dev); } if (showxml) { - dev = fz_newtracedevice(); + dev = fz_new_trace_device(); printf("<page number=\"%d\">\n", pagenum); if (list) - fz_executedisplaylist(list, dev, fz_identity, fz_infinitebbox); + fz_execute_display_list(list, dev, fz_identity, fz_infinite_bbox); else xps_run_page(ctx, page, dev, fz_identity); printf("</page>\n"); - fz_freedevice(dev); + fz_free_device(dev); } if (showtext) { - fz_textspan *text = fz_newtextspan(); - dev = fz_newtextdevice(text); + fz_text_span *text = fz_new_text_span(); + dev = fz_new_text_device(text); if (list) - fz_executedisplaylist(list, dev, fz_identity, fz_infinitebbox); + fz_execute_display_list(list, dev, fz_identity, fz_infinite_bbox); else xps_run_page(ctx, page, dev, fz_identity); - fz_freedevice(dev); + fz_free_device(dev); printf("[Page %d]\n", pagenum); if (showtext > 1) - fz_debugtextspanxml(text); + fz_debug_text_span_xml(text); else - fz_debugtextspan(text); + fz_debug_text_span(text); printf("\n"); - fz_freetextspan(text); + fz_free_text_span(text); } if (showmd5 || showtime) @@ -158,34 +158,34 @@ static void drawpage(xps_context *ctx, int pagenum) zoom = resolution / 96; ctm = fz_translate(0, -page->height); ctm = fz_concat(ctm, fz_scale(zoom, zoom)); - bbox = fz_roundrect(fz_transformrect(ctm, rect)); + bbox = fz_round_rect(fz_transform_rect(ctm, rect)); /* TODO: banded rendering and multi-page ppm */ - pix = fz_newpixmapwithrect(colorspace, bbox); + pix = fz_new_pixmap_with_rect(colorspace, bbox); if (savealpha) - fz_clearpixmap(pix); + fz_clear_pixmap(pix); else - fz_clearpixmapwithcolor(pix, 255); + fz_clear_pixmap_with_color(pix, 255); - dev = fz_newdrawdevice(glyphcache, pix); + dev = fz_new_draw_device(glyphcache, pix); if (list) - fz_executedisplaylist(list, dev, ctm, bbox); + fz_execute_display_list(list, dev, ctm, bbox); else xps_run_page(ctx, page, dev, ctm); - fz_freedevice(dev); + fz_free_device(dev); if (output) { char buf[512]; sprintf(buf, output, pagenum); if (strstr(output, ".pgm") || strstr(output, ".ppm") || strstr(output, ".pnm")) - fz_writepnm(pix, buf); + fz_write_pnm(pix, buf); else if (strstr(output, ".pam")) - fz_writepam(pix, buf, savealpha); + fz_write_pam(pix, buf, savealpha); else if (strstr(output, ".png")) - fz_writepng(pix, buf, savealpha); + fz_write_png(pix, buf, savealpha); } if (showmd5) @@ -194,20 +194,20 @@ static void drawpage(xps_context *ctx, int pagenum) unsigned char digest[16]; int i; - fz_md5init(&md5); - fz_md5update(&md5, pix->samples, pix->w * pix->h * pix->n); - fz_md5final(&md5, digest); + fz_md5_init(&md5); + fz_md5_update(&md5, pix->samples, pix->w * pix->h * pix->n); + fz_md5_final(&md5, digest); printf(" "); for (i = 0; i < 16; i++) printf("%02x", digest[i]); } - fz_droppixmap(pix); + fz_drop_pixmap(pix); } if (list) - fz_freedisplaylist(list); + fz_free_display_list(list); if (showtime) { @@ -234,7 +234,6 @@ static void drawpage(xps_context *ctx, int pagenum) printf("\n"); } - static void drawrange(xps_context *ctx, char *range) { int page, spage, epage; @@ -310,15 +309,15 @@ int main(int argc, char **argv) if (accelerate) fz_accelerate(); - glyphcache = fz_newglyphcache(); + glyphcache = fz_new_glyph_cache(); - colorspace = fz_devicergb; + colorspace = fz_device_rgb; if (grayscale) - colorspace = fz_devicegray; + colorspace = fz_device_gray; if (output && strstr(output, ".pgm")) - colorspace = fz_devicegray; + colorspace = fz_device_gray; if (output && strstr(output, ".ppm")) - colorspace = fz_devicergb; + colorspace = fz_device_rgb; timing.count = 0; timing.total = 0; @@ -361,7 +360,7 @@ int main(int argc, char **argv) printf("slowest page %d: %dms\n", timing.maxpage, timing.max); } - fz_freeglyphcache(glyphcache); + fz_free_glyph_cache(glyphcache); return 0; } |