コード例 #1
0
ファイル: xps_tile.c プロジェクト: Sjith/PDFProject
static void
xps_paint_tiling_brush(xps_context *ctx, fz_matrix ctm, fz_rect viewbox, int tile_mode, struct closure *c)
{
	fz_matrix ttm;

	xps_paint_tiling_brush_clipped(ctx, ctm, viewbox, c);

	if (tile_mode == TILE_FLIP_X || tile_mode == TILE_FLIP_X_Y)
	{
		ttm = fz_concat(fz_translate(viewbox.x1 * 2, 0), ctm);
		ttm = fz_concat(fz_scale(-1, 1), ttm);
		xps_paint_tiling_brush_clipped(ctx, ttm, viewbox, c);
	}

	if (tile_mode == TILE_FLIP_Y || tile_mode == TILE_FLIP_X_Y)
	{
		ttm = fz_concat(fz_translate(0, viewbox.y1 * 2), ctm);
		ttm = fz_concat(fz_scale(1, -1), ttm);
		xps_paint_tiling_brush_clipped(ctx, ttm, viewbox, c);
	}

	if (tile_mode == TILE_FLIP_X_Y)
	{
		ttm = fz_concat(fz_translate(viewbox.x1 * 2, viewbox.y1 * 2), ctm);
		ttm = fz_concat(fz_scale(-1, -1), ttm);
		xps_paint_tiling_brush_clipped(ctx, ttm, viewbox, c);
	}
}
コード例 #2
0
ファイル: xps-tile.c プロジェクト: PuzzleFlow/mupdf
static void
xps_paint_tiling_brush(fz_context *ctx, xps_document *doc, const fz_matrix *ctm, const fz_rect *viewbox, int tile_mode, struct closure *c)
{
	fz_matrix ttm;

	xps_paint_tiling_brush_clipped(ctx, doc, ctm, viewbox, c);

	if (tile_mode == TILE_FLIP_X || tile_mode == TILE_FLIP_X_Y)
	{
		ttm = *ctm;
		fz_pre_scale(fz_pre_translate(&ttm, viewbox->x1 * 2, 0), -1, 1);
		xps_paint_tiling_brush_clipped(ctx, doc, &ttm, viewbox, c);
	}

	if (tile_mode == TILE_FLIP_Y || tile_mode == TILE_FLIP_X_Y)
	{
		ttm = *ctm;
		fz_pre_scale(fz_pre_translate(&ttm, 0, viewbox->y1 * 2), 1, -1);
		xps_paint_tiling_brush_clipped(ctx, doc, &ttm, viewbox, c);
	}

	if (tile_mode == TILE_FLIP_X_Y)
	{
		ttm = *ctm;
		fz_pre_scale(fz_pre_translate(&ttm, viewbox->x1 * 2, viewbox->y1 * 2), -1, -1);
		xps_paint_tiling_brush_clipped(ctx, doc, &ttm, viewbox, c);
	}
}
コード例 #3
0
ファイル: xpstile.c プロジェクト: computersforpeace/ghostpdl
static int
xps_paint_tiling_brush(const gs_client_color *pcc, gs_state *pgs)
{
    const gs_client_pattern *ppat = gs_getpattern(pcc);
    struct tile_closure_s *c = ppat->client_data;
    xps_context_t *ctx = c->ctx;
    gs_state *saved_pgs;
    int code;

    saved_pgs = ctx->pgs;
    ctx->pgs = pgs;

    gs_gsave(ctx->pgs);
    code = xps_paint_tiling_brush_clipped(c);
    if (code)
        goto cleanup;
    gs_grestore(ctx->pgs);

    if (c->tile_mode == TILE_FLIP_X || c->tile_mode == TILE_FLIP_X_Y)
    {
        gs_gsave(ctx->pgs);
        gs_translate(ctx->pgs, c->viewbox.q.x * 2, 0.0);
        gs_scale(ctx->pgs, -1.0, 1.0);
        code = xps_paint_tiling_brush_clipped(c);
        if (code)
            goto cleanup;
        gs_grestore(ctx->pgs);
    }

    if (c->tile_mode == TILE_FLIP_Y || c->tile_mode == TILE_FLIP_X_Y)
    {
        gs_gsave(ctx->pgs);
        gs_translate(ctx->pgs, 0.0, c->viewbox.q.y * 2);
        gs_scale(ctx->pgs, 1.0, -1.0);
        code = xps_paint_tiling_brush_clipped(c);
        if (code)
            goto cleanup;
        gs_grestore(ctx->pgs);
    }

    if (c->tile_mode == TILE_FLIP_X_Y)
    {
        gs_gsave(ctx->pgs);
        gs_translate(ctx->pgs, c->viewbox.q.x * 2, c->viewbox.q.y * 2);
        gs_scale(ctx->pgs, -1.0, -1.0);
        code = xps_paint_tiling_brush_clipped(c);
        if (code)
            goto cleanup;
        gs_grestore(ctx->pgs);
    }

    ctx->pgs = saved_pgs;

    return 0;

cleanup:
    gs_grestore(ctx->pgs);
    ctx->pgs = saved_pgs;
    return gs_rethrow(code, "cannot draw tile");
}