⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 original_mini-x.txt

📁 Nano-x的设计架及相关文档----这是网上下载的中文翻译版本, E文的可以在其网站上下载.
💻 TXT
📖 第 1 页 / 共 3 页
字号:
GrDestroyGC(gc)	GR_GC_ID	gc;		/* graphics context to destroy */Destroy an existing graphics context.voidGrMapWindow(wid)	GR_WINDOW_ID	wid;		/* window to be mapped */Map the window to make it (and possibly its children) visible on the screen.This paints the border and background of the window, and creates anexposure event to tell the client to draw into it.voidGrUnmapWindow(wid)	GR_WINDOW_ID	wid;		/* window to be unmapped */Unmap the window to make it and its children invisible on the screen.voidGrRaiseWindow(wid)	GR_WINDOW_ID	wid;		/* window to be raised */Raise the window to the highest level among its siblings.  This means thatthis window will be visible in preference to those siblings.  Siblings arewindows which have the same parent as this window.voidGrLowerWindow(wid)	GR_WINDOW_ID	wid;		/* window to be lowered */Lower the window to the lowest level among its siblings.  This means thatthis window will be covered by any siblings which overlap it.voidGrMoveWindow(wid, x, y)	GR_WINDOW_ID	wid;		/* window to be lowered */	GR_COORD	x;		/* new relative x position */	GR_COORD	y;		/* new relative y position */Move the window to the specified position relative to its parent.voidGrResizeWindow(wid, width, height)	GR_WINDOW_ID	wid;		/* window to be lowered */	GR_SIZE		width;		/* new width of window */	GR_SIZE		height;		/* new height of window */Resize the window to be the specified size.  Resizing of a window cangenerate exposure events.voidGrClearWindow(wid, exposeflag)	GR_WINDOW_ID	wid;		/* window id */	GR_BOOL		exposeflag;	/* nonzero to cause an exposure */Clear the specified window by setting it to its background color.If the exposeflag is nonzero, then this also creates an exposureevent for the window.voidGrSetFocus(wid)	GR_WINDOW_ID	wid;		/* window id */Set the focus to a particular window.  This makes keyboard events onlyvisible to that window or children of it, depending on the pointer location.Setting the focus window to the root window makes the input focus trackthe pointer (which is the default).voidGrSetBorderColor(wid, color)	GR_WINDOW_ID	wid;		/* window id */	GR_COLOR	color;		/* color for border */Set the border of a window to the specified color.voidGrSetCursor(wid, width, height, hotx, hoty, foreground, background,	fgbitmap, bgbitmap)	GR_WINDOW_ID	wid;		/* window id to set cursor for */	GR_SIZE		width;		/* width of cursor */	GR_SIZE		height;		/* height of cursor */	GR_COORD	hotx;		/* relative x position of hot spot */	GR_COORD	hoty;		/* relative y position of hot spot */	GR_COLOR	foreground;	/* foreground color of cursor */	GR_COLOR	background;	/* background color of cursor */	GR_BITMAP	*fgbitmap;	/* foreground bitmap */	GR_BITMAP	*bgbitmap;	/* background bitmap */Specify a new cursor for a window.  This cursor will only be used withinthat window, and by default for its new children.  The cursor is definedby giving its width and height, its foreground and background colors, itsforeground and background bitmaps, and its "hot spot" position.  If a pixelis specified for both the foreground and background bitmaps, then theforeground has precedence.  The hot spot is an offset from the upper leftcorner of the bitmap, and is the location in the cursor which is important.voidGrMoveCursor(x, y)	GR_COORD	x;		/* new x position of cursor */	GR_COORD	y;		/* new y position of cursor */Move the cursor to the specified absolute screen coordinates.The coordinates are that of the defined hot spot of the cursor.The cursor's appearance is changed to that defined for the windowin which the cursor is moved to.voidGrFlush()Flush the graphics buffer so that all previous requests will be executed.This is only needed if you do not check events quickly and want to see theresults on the screen soon, since checking for events does an automatic flush.voidGrSetGCForeground(gc, foreground)	GR_GC_ID	gc;		/* graphics context id */	GR_COLOR	foreground;	/* foreground color */Set the foreground color in a graphics context.  The default is white.voidGrSetGCBackground(gc, background)	GR_GC_ID	gc;		/* graphics context id */	GR_COLOR	background;	/* background color */Set the background color in a graphics context.  The default is black.voidGrSetGCUseBackground(gc, flag)	GR_GC_ID	gc;		/* graphics context id */	GR_BOOL		flag;		/* TRUE if background is drawn */Set whether or not the background color is drawn in bitmaps and text.This affects GrBitmap, GrArea8, and GrText.  The default is GR_TRUE.voidGrSetGCMode(gc, mode)	GR_GC_ID	gc;		/* graphics context id */	GR_MODE		mode;		/* drawing mode */Set the drawing mode in a graphics context.  The drawing mode is one ofGR_MODE_SET, GR_MODE_XOR, GR_MODE_AND, or GR_MODE_OR.  The default isGR_MODE_SET.voidGrSetGCFont(gc, font)	GR_GC_ID	gc;		/* graphics context id */	GR_FONT		font;		/* text font */Set the font used for text drawing in a graphics context.The font is a number identifying one of several fonts.Font number 0 is always available, and is the default font.voidGrLine(id, gc, x1, y1, x2, y2)	GR_DRAW_ID	id;	GR_GC_ID	gc;	GR_COORD	x1;	GR_COORD	y1;	GR_COORD	x2;	GR_COORD	y2;Draw a line in the specified drawable using the specified graphics context.voidGrRect(id, gc, x, y, width, height)	GR_DRAW_ID	id;	GR_GC_ID	gc;	GR_COORD	x;	GR_COORD	y;	GR_SIZE		width;	GR_SIZE		height;Draw the boundary of a rectangle in the specified drawable using thespecified graphics context.voidGrFillRect(id, gc, x, y, width, height)	GR_DRAW_ID	id;	GR_GC_ID	gc;	GR_COORD	x;	GR_COORD	y;	GR_SIZE		width;	GR_SIZE		height;Fill a rectangle in the specified drawable using the specified graphicscontext.  The boundary of this rectangle is identical to that drawn bythe GrRect function.voidGrEllipse(id, gc, x, y, rx, ry)	GR_DRAW_ID	id;	GR_GC_ID	gc;	GR_COORD	x;	GR_COORD	y;	GR_SIZE		rx;	GR_SIZE		ry;Draw the boundary of an ellipse in the specified drawable withthe specified graphics context.voidGrFillEllipse(id, gc, x, y, rx, ry)	GR_DRAW_ID	id;	GR_GC_ID	gc;	GR_COORD	x;	GR_COORD	y;	GR_SIZE		rx;	GR_SIZE		ry;Fill an ellipse in the specified drawable using the specifiedgraphics context.voidGrBitmap(id, gc, x, y, width, height, bitmaptable)	GR_DRAW_ID	id;	GR_GC_ID	gc;	GR_COORD	x;	GR_COORD	y;	GR_SIZE		width;	GR_SIZE		height;	GR_BITMAP	*bitmaptable;Draw a rectangular area in the specified drawable using the specifiedgraphics context, as determined by the specified bit map.  This differsfrom rectangle drawing in that the rectangle is drawn using the foregroundcolor and possibly the background color as determined by the bit map.Bits which are 1 are the foreground, and bits which are 0 are the background.Each row of bits is aligned to the next bitmap word boundary (so there canbe padding at the end of each row).  The background bit values are onlywritten if the usebackground flag is set in the GC.voidGrArea8(id, gc, x, y, width, height, colortable)	GR_DRAW_ID	id;	GR_GC_ID	gc;	GR_COORD	x;	GR_COORD	y;	GR_SIZE		width;	GR_SIZE		height;	GR_COLOR8	*colortable;Draw a rectangular area in the specified drawable using the specifiedgraphics context.  This differs from rectangle drawing in that thecolor values for each pixel in the rectangle are specified.  The colorvalues are estricted to 8 bit values.  The color table is indexed row byrow from left to right.  Table values whose color matches the backgroundcolor are only written if the usebackground flag is set in the GC.voidGrReadArea8(id, x, y, width, height, colortable)	GR_DRAW_ID	id;	GR_COORD	x;	GR_COORD	y;	GR_SIZE		width;	GR_SIZE		height;	GR_COLOR8	*colortable;Read the color values from the specified rectangular area of the specifieddrawable into a supplied buffer.  If the drawable is a window which isobscured by other windows, then the returned values will include the valuesfrom the covering windows.  Regions outside of the screen boundaries, orfrom unmapped windows will return black.voidGrPoint(id, gc, x, y)	GR_DRAW_ID	id;	GR_GC_ID	gc;	GR_COORD	x;	GR_COORD	y;Draw a point in the specified drawable using the specified graphics context.voidGrPoly(id, gc, count, pointtable)	GR_DRAW_ID	id;	GR_GC_ID	gc;	GR_COUNT	count;	GR_POINT	*pointtable;Draw a polygon in the specified drawable using the specified graphicscontext.  The polygon is only complete if the first point is repeated atthe end.  Note: currently if the polygon crosses itself, and the drawingmode is set to XOR, then the individual line segments will affect eachother.  The endpoints of the lines are correct, however.voidGrFillPoly(id, gc, count, pointtable)	GR_DRAW_ID	id;	GR_GC_ID	gc;	GR_COUNT	count;	GR_POINT	*pointtable;Draw a filled polygon in the specified drawable using the specifiedgraphics context.  The last point may be a duplicate of the first point,but this is not required.  Note: currently only convex polygons arefilled properly.voidGrText(id, gc, x, y, str, count)	GR_DRAW_ID	id;	GR_GC_ID	gc;	GR_COORD	x;	GR_COORD	y;	GR_CHAR		*str;	GR_COUNT	count;Draw a text string at the specified location in the specified drawableusing the specified graphics context.  The background of the charactersare only drawn if the usebackground flag in the GC is set.EXAMPLE PROGRAMThe following simple program opens the graphics, creates a window, printssome text in it, waits for the mouse to be clicked in the window, then exits.#include <stdio.h>#include <graphics.h>#define	MARGIN	50			/* margin around window */main(){	GR_WINDOW_ID	wid;		/* window id */	GR_GC_ID	gc;		/* graphics context id */	GR_EVENT	event;		/* current event */	GR_SCREEN_INFO	si;		/* screen information */	if (GrOpen() < 0) {		fprintf(stderr, "Cannot open graphics\n");		exit(1);	}	GrGetScreenInfo(&si);	wid = GrNewWindow(GR_ROOT_WINDOW_ID, MARGIN, MARGIN,		si.cols - MARGIN * 2, si.rows - MARGIN * 2,		1, si.black, si.white);	GrSelectEvents(wid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_EXPOSURE);	GrMapWindow(wid);	gc = GrNewGC();	while (1) {		GrGetNextEvent(&event);		switch (event.type) {			case GR_EVENT_TYPE_BUTTON_DOWN:				if (event.button.wid != wid)					break;				GrClose();				exit(0);			case GR_EVENT_TYPE_EXPOSURE:				if (event.exposure.wid == wid)					GrText(wid, gc, 50, 50, "EXIT", 4);				break;		}	}}For a more complete demonstration program, see the file "demo.c" in the/usr/src/graphics/clients directory.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -