Example #1
0
/* Calculate the cursor from the given pixmap */
GR_CURSOR_ID
_nxCreateCursor(GR_WINDOW_ID cursor, GR_RECT * cbb,
		 GR_WINDOW_ID mask, GR_RECT * mbb,
		 int hotx, int hoty, GR_COLOR fg, GR_COLOR bg)
{
	int w, h;
	GR_BITMAP *bcursor, *bmask;
	GR_CURSOR_ID cursorid;

	/* force cursor size to max Microwindows size*/
	w = min(cbb->width, MWMAX_CURSOR_SIZE);
	h = min(cbb->height, MWMAX_CURSOR_SIZE);
	bcursor = GrNewBitmapFromPixmap(cursor, cbb->x, cbb->y, w, h);
	if (!bcursor)
		return 0;

	w = min(mbb->width, MWMAX_CURSOR_SIZE);
	h = min(mbb->height, MWMAX_CURSOR_SIZE);
	bmask = GrNewBitmapFromPixmap(mask, mbb->x, mbb->y, w, h);
	if (!bmask) {
		Xfree(bcursor);
		return 0;
	}

	if (cbb->width > w || cbb->height > h)
		printf("nxCreateCursor: truncating original cursor (%d x %d)\n",
		       cbb->width, cbb->height);

	/*
	 * Foreground/background reversed from nano-X !!!
	 */
	cursorid = GrNewCursor(w, h, hotx, hoty, bg, fg, bcursor, bmask);

	free(bcursor);
	free(bmask);

	return cursorid;
}
Example #2
0
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;
}