GR_GC_ID setup_multi_rect_region(void) { GR_GC_ID gc; GR_RECT rect; GR_REGION_ID rg; gc = GrNewGC(); GrSetGCForeground(gc, GR_COLOR_BLUE); GrSetGCBackground(gc, GR_COLOR_WHITE); rg = GrNewRegion(); rect.x = 10; rect.y = 0; rect.width = 10; rect.height = 60; GrUnionRectWithRegion(rg, &rect); rect.x = 40; rect.y = 0; rect.width = 10; rect.height = 60; GrUnionRectWithRegion(rg, &rect); rect.x = 0; rect.y = 10; rect.width = 60; rect.height = 10; GrUnionRectWithRegion(rg, &rect); rect.x = 0; rect.y = 40; rect.width = 60; rect.height = 10; GrUnionRectWithRegion(rg, &rect); GrSetGCRegion(gc, rg); GrSetGCClipOrigin(gc, 105, 15); return gc; }
GR_GC_ID setup_bitmap_region(void) { GR_GC_ID gc; GR_REGION_ID rg; gc = GrNewGC(); GrSetGCForeground(gc, GR_COLOR_FORESTGREEN); GrSetGCBackground(gc, GR_COLOR_WHITE); rg = GrNewBitmapRegion(tuxmask_bits, TUXMASK_WIDTH, TUXMASK_HEIGHT); GrSetGCRegion(gc, rg); GrSetGCClipOrigin(gc, 100, 80); return gc; }
GR_GC_ID setup_simple_poly_region(void) { GR_GC_ID gc; GR_REGION_ID rg; GR_POINT points[] = { {15, 0}, {45, 0}, {60, 15}, {60, 45}, {45, 60}, {15, 60}, {0, 45}, {0, 15} }; gc = GrNewGC(); GrSetGCForeground(gc, GR_COLOR_PURPLE); GrSetGCBackground(gc, GR_COLOR_WHITE); rg = GrNewPolygonRegion(GR_POLY_WINDING, 8, points); GrSetGCRegion(gc, rg); GrSetGCClipOrigin(gc, 25, 95); return gc; }
GR_GC_ID setup_complex_poly_region(void) { GR_GC_ID gc; GR_REGION_ID rg; GR_POINT points[] = { {0, 0}, {99, 0}, {99, 99}, {0, 99}, {0, 19}, {79, 19}, {79, 79}, {19, 79}, {19, 39}, {59, 39}, {59, 49}, {29, 49}, {29, 69}, {69, 69}, {69, 29}, {9, 29}, {9, 89}, {89, 89}, {89, 9}, {0, 9} }; gc = GrNewGC(); GrSetGCForeground(gc, GR_COLOR_ORANGE); GrSetGCBackground(gc, GR_COLOR_WHITE); rg = GrNewPolygonRegion(GR_POLY_EVENODD, 20, points); GrSetGCRegion(gc, rg); GrSetGCClipOrigin(gc, 25, 180); return gc; }
static void GrSetGCClipOriginWrapper(void *r) { nxSetGCClipOriginReq *req = r; GrSetGCClipOrigin(req->gcid, req->xoff, req->yoff); }