예제 #1
0
/* <destx> <desty> <width> <height> <op> compositerect - */
static int
zcompositerect(i_ctx_t *i_ctx_p)
{
    os_ptr op = osp;
    double dest_rect[4];
    alpha_composite_state_t cstate;
    int code = xywh_param(op - 1, dest_rect);

    if (code < 0)
        return code;
    check_int_leu(*op, compositerect_last);
    cstate.params.op = (gs_composite_op_t) op->value.intval;
    code = begin_composite(i_ctx_p, &cstate);
    if (code < 0)
        return code;
    {
        gs_rect rect;

        rect.q.x = (rect.p.x = dest_rect[0]) + dest_rect[2];
        rect.q.y = (rect.p.y = dest_rect[1]) + dest_rect[3];
        code = gs_rectfill(igs, &rect, 1);
    }
    end_composite(i_ctx_p, &cstate);
    if (code >= 0)
        pop(5);
    return code;
}
예제 #2
0
/* Fill a rectangle. */
static int
fill_rect1(gs_state * pgs, floatp x, floatp y, floatp w, floatp h)
{
    gs_rect r;

    r.q.x = (r.p.x = x) + w;
    r.q.y = (r.p.y = y) + h;
    return gs_rectfill(pgs, &r, 1);
}
예제 #3
0
파일: zdps1.c 프로젝트: ststeiger/ghostsvg
/* <numarray|numstring> rectfill - */
static int
zrectfill(i_ctx_t *i_ctx_p)
{
    os_ptr op = osp;
    local_rects_t lr;
    int npop = rect_get(&lr, op, imemory);
    int code;

    if (npop < 0)
	return npop;
    code = gs_rectfill(igs, lr.pr, lr.count);
    rect_release(&lr, imemory);
    if (code < 0)
	return code;
    pop(npop);
    return 0;
}
예제 #4
0
static int
test8(gs_state * pgs, gs_memory_t * mem)
{
    /*
     * Define a 16 x 16 pattern using a 4-entry palette
     * (white, red, green, black).
     */
    static const byte pdata[] =
    {
        0x7f, 0xff, 0x00, 0x03,
        0x7f, 0xff, 0x00, 0x0c,
        0x50, 0x00, 0x00, 0x30,
        0x50, 0x00, 0x00, 0xc0,
        0x50, 0x00, 0x03, 0x00,
        0x50, 0x00, 0x0c, 0x00,
        0x50, 0x00, 0x30, 0x00,
        0x50, 0x00, 0xc0, 0x00,
        0xf0, 0x00, 0xc0, 0x00,
        0xf0, 0x00, 0x30, 0x00,
        0xf0, 0x00, 0x0c, 0x00,
        0xf0, 0x00, 0x03, 0x00,
        0xf0, 0x00, 0x00, 0xc0,
        0xf0, 0x00, 0x00, 0x30,
        0xea, 0x55, 0xaa, 0x5c,
        0xea, 0x55, 0xaa, 0x57,
    };
    gs_depth_bitmap ptile;
    gs_const_string table;
    gs_color_space *pcs;
    gs_client_color ccolor;
    gs_color_space *rgb_cs;

    rgb_cs = gs_cspace_new_DeviceRGB(mem);

    table.data =
        (const byte *)"\377\377\377\377\000\000\000\377\000\000\000\000";
    table.size = 12;
    gs_cspace_build_Indexed(&pcs, rgb_cs, 4, &table, mem);
    ptile.data = pdata;
    ptile.raster = 4;
    ptile.size.x = ptile.size.y = 16;
    ptile.id = gs_no_bitmap_id;
    ptile.pix_depth = 2;
    ptile.num_comps = 1;
    gs_makepixmappattern(&ccolor, &ptile, false /*mask */ , NULL /*pmat */ ,
                         gs_no_id, pcs, 0 /*white_index */ , pgs, mem);
    {
        gs_rect r;

        r.p.x = 100;
        r.p.y = 100;
        r.q.x = 200;
        r.q.y = 200;
        gs_setrgbcolor(pgs, 1.0, 1.0, 0.0);
        gs_rectfill(pgs, &r, 1);
        gs_setpattern(pgs, &ccolor);
        gs_settexturetransparent(pgs, true);
        gs_rectfill(pgs, &r, 1);
        r.p.x += 150;
        r.q.x += 150;
        gs_setrgbcolor(pgs, 1.0, 1.0, 0.0);
        gs_rectfill(pgs, &r, 1);
        gs_setpattern(pgs, &ccolor);
        gs_settexturetransparent(pgs, false);
        gs_rectfill(pgs, &r, 1);
    }
    gs_free_object(mem, rgb_cs, "test8 rgb_cs");
    return 0;
}