Ejemplo n.º 1
0
static void
GrSetGCFillModeWrapper(void *r)
{
	nxSetGCFillModeReq *req = r;

	GrSetGCFillMode(req->gcid, req->fillmode);
}
Ejemplo n.º 2
0
int
XSetFillStyle(Display * dpy, GC gc, int fill_style)
{
	unsigned long mode = 0;

	switch (fill_style) {
	case FillTiled:
		mode = GR_FILL_TILE;
		break;

	case FillStippled:
		mode = GR_FILL_STIPPLE;
		break;

	case FillOpaqueStippled:
		mode = GR_FILL_OPAQUE_STIPPLE;
		break;

	default:
		mode = GR_FILL_SOLID;
		break;
	}

	GrSetGCFillMode(gc->gid, mode);
	return 1;
}
Ejemplo n.º 3
0
void
draw_set(char *name, int mode)
{
	int x;
	int tw, th, tb;
	GR_POINT points[4];
	GR_GC_ID gc = GrNewGC();

	GrSetGCForeground(gc, WHITE);
	GrSetGCBackground(gc, GRAY);

	GrGetGCTextSize(gc, name, -1, GR_TFTOP, &tw, &th, &tb);

	x = g_x + (tw - 50) / 2;

	GrText(g_main, gc, g_x, 5, name, -1, GR_TFTOP);

	g_x += (tw + 10);

	GrSetGCFillMode(gc, mode);

	if (mode == GR_FILL_STIPPLE)
		GrSetGCForeground(gc, YELLOW);
	else {
		GrSetGCForeground(gc, WHITE);
		GrSetGCBackground(gc, BLUE);
	}

	if (mode == GR_FILL_TILE) {
		GrSetGCTile(gc, g_pixmap, 16, 16);
	}

	if (mode == GR_FILL_STIPPLE || mode == GR_FILL_OPAQUE_STIPPLE)
		GrSetGCStipple(gc, g_stipple2, 2, 2);

	GrFillRect(g_main, gc, x, 25, 50, 50);

	if (mode == GR_FILL_STIPPLE || mode == GR_FILL_OPAQUE_STIPPLE)
		GrSetGCStipple(gc, g_stipple1, 7, 7);

	GrFillEllipse(g_main, gc, x + 25, 105, 25, 25);

	if (mode == GR_FILL_STIPPLE || mode == GR_FILL_OPAQUE_STIPPLE)
		GrSetGCStipple(gc, g_stipple3, 3, 2);

	points[0].x = points[3].x = x;
	points[0].y = points[3].y = 165;

	points[1].x = x + 50;
	points[1].y = 165;

	points[2].x = x + 25;
	points[2].y = 215;

	GrFillPoly(g_main, gc, 4, points);

	GrDestroyGC(gc);
}