/* <bool> .settexturetransparent - */ static int zsettexturetransparent(i_ctx_t *i_ctx_p) { os_ptr op = osp; check_type(*op, t_boolean); gs_settexturetransparent(igs, op->value.boolval); pop(1); return 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; }
int pxSetPaintTxMode(px_args_t *par, px_state_t *pxs) { gs_settexturetransparent(pxs->pgs, par->pv[0]->value.i == eTransparent); return 0; }