コード例 #1
0
ファイル: tsdemo.c プロジェクト: BadrElh/microwindows
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);
}
コード例 #2
0
ファイル: CrGC.c プロジェクト: ghaerr/microwindows
int
XSetStipple(Display * display, GC gc, Pixmap stipple)
{
	GR_WINDOW_INFO wi;
	GR_BITMAP *bitmap;

	GrGetWindowInfo(stipple, &wi);

	bitmap = GrNewBitmapFromPixmap(stipple, 0, 0, wi.width, wi.height);
	GrSetGCStipple(gc->gid, bitmap, wi.width, wi.height);
	free(bitmap);

	return 1;
}
コード例 #3
0
ファイル: srvnet.c プロジェクト: koujinogaku/helloos
static void
GrSetGCStippleWrapper(void *r)
{
	nxSetGCStippleReq *req = r;
	GR_BITMAP *buffer;
	
	buffer = ALLOCA(GR_BITMAP_SIZE(req->width, req->height) *
		sizeof(GR_BITMAP));

	memcpy((void *) buffer, GetReqData(req),
	       GR_BITMAP_SIZE(req->width, req->height) * sizeof(GR_BITMAP));

	GrSetGCStipple(req->gcid, (GR_BITMAP *)buffer, req->width, req->height);
	FREEA(buffer);
}