Exemple #1
0
/**
 * jbig2_add_page_result: composite a decoding result onto a page
 *
 * this is called to add the results of segment decode (when it
 * is an image) to a page image buffer
 **/
int
jbig2_page_add_result(Jbig2Ctx *ctx, Jbig2Page *page, Jbig2Image *image,
		      int x, int y, Jbig2ComposeOp op)
{
    /* ensure image exists first */
    if (page->image == NULL)
    {
        jbig2_error(ctx, JBIG2_SEVERITY_WARNING, -1,
            "page info possibly missing, no image defined");
        return 0;
    }

    /* grow the page to accomodate a new stripe if necessary */
    if (page->striped) {
	int new_height = y + image->height + page->end_row;
	if (page->image->height < new_height) {
	    jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, -1,
		"growing page buffer to %d rows "
		"to accomodate new stripe", new_height);
	    jbig2_image_resize(ctx, page->image,
		page->image->width, new_height);
	}
    }

    jbig2_image_compose(ctx, page->image, image,
                        x, y + page->end_row, op);

    return 0;
}
Exemple #2
0
/**
 * jbig2_add_page_result: composite a decoding result onto a page
 *
 * this is called to add the results of segment decode (when it
 * is an image) to a page image buffer
 **/
int
jbig2_page_add_result(Jbig2Ctx *ctx, Jbig2Page *page, Jbig2Image *image,
		      int x, int y, Jbig2ComposeOp op)
{
    /* grow the page to accomodate a new stripe if necessary */
    if (page->striped) {
	int new_height = y + image->height + page->end_row;
	if (page->image->height < new_height) {
	    jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, -1,
		"growing page buffer to %d rows "
		"to accomodate new stripe", new_height);
	    jbig2_image_resize(ctx, page->image,
		page->image->width, new_height);
	}
    }

    jbig2_image_compose(ctx, page->image, image,
                        x, y + page->end_row, JBIG2_COMPOSE_OR);

    return 0;
}