📄 client.c
字号:
req = AllocReq(NewPixmap); req->width = width; req->height = height; if(GrTypedReadBlock(&wid, sizeof(wid), GrNumNewPixmap) == -1) return 0; return wid;}/** * GrNewInputWindow: * @parent: the ID of the window to use as the parent of the new window * @x: the X coordinate of the new window relative to the parent window * @y: the Y coordinate of the new window relative to the parent window * @width: the width of the new window * @height: the height of the new window * @Returns: the ID of the newly created window * * Create a new input-only window with the specified dimensions which is a * child of the specified parent window. */GR_WINDOW_IDGrNewInputWindow(GR_WINDOW_ID parent, GR_COORD x, GR_COORD y, GR_SIZE width, GR_SIZE height){ nxNewInputWindowReq *req; GR_WINDOW_ID wid; req = AllocReq(NewInputWindow); req->parentid = parent; req->x = x; req->y = y; req->width = width; req->height = height; if(GrTypedReadBlock(&wid, sizeof(wid), GrNumNewInputWindow) == -1) return 0; return wid;}/** * GrDestroyWindow: * @wid: the ID of the window to destroy * * Recursively unmaps and frees the data structures associated with the * specified window and all of its children. */void GrDestroyWindow(GR_WINDOW_ID wid){ nxDestroyWindowReq *req; req = AllocReq(DestroyWindow); req->windowid = wid;}/** * GrGetWindowInfo: * @wid: the ID of the window to retrieve information about * @infoptr: pointer to a GR_WINDOW_INFO structure to return the information in * * Fills in a GR_WINDOW_INFO structure with information regarding the window * with the specified window ID. */void GrGetWindowInfo(GR_WINDOW_ID wid, GR_WINDOW_INFO *infoptr){ nxGetWindowInfoReq *req; req = AllocReq(GetWindowInfo); req->windowid = wid; GrTypedReadBlock(infoptr, sizeof(GR_WINDOW_INFO), GrNumGetWindowInfo);}/** * GrNewGC: * @Returns: the ID of the newly created graphics context or 0 on error * * Creates a new graphics context structure and returns the ID used to refer * to it. The structure is initialised with a set of default parameters. */GR_GC_ID GrNewGC(void){ GR_GC_ID gc; AllocReq(NewGC); if(GrTypedReadBlock(&gc, sizeof(gc),GrNumNewGC) == -1) return 0; return gc;}/** * GrCopyGC: * @gc: the already existing graphics context to copy the parameters from * @Returns: the ID of the newly created graphics context or 0 on error * * Creates a new graphics context structure and fills it in with the values * from the specified already existing graphics context. */GR_GC_ID GrCopyGC(GR_GC_ID gc){ nxCopyGCReq *req; GR_GC_ID newgc; req = AllocReq(CopyGC); req->gcid = gc; if(GrTypedReadBlock(&newgc, sizeof(newgc),GrNumCopyGC) == -1) return 0; return newgc;}/** * GrDestroyGC: * @gc: the ID of the graphics context structure to destroy * * Destroys the graphics context structure with the specified ID. */voidGrDestroyGC(GR_GC_ID gc){ nxDestroyGCReq *req; req = AllocReq(DestroyGC); req->gcid = gc;}/** * GrNewRegion: * @Returns: the ID of the newly created region * * Creates a new region structure and returns the ID used to refer to it. * The structure is initialised with a set of default parameters. */GR_REGION_ID GrNewRegion(void){ GR_REGION_ID region; AllocReq(NewRegion); if(GrTypedReadBlock(®ion, sizeof(region),GrNumNewRegion) == -1) return 0; return region;}/** * GrDestroyRegion: * @region: the ID of the region structure to destroy * * Destroys the region structure with the specified ID. */voidGrDestroyRegion(GR_REGION_ID region){ nxDestroyRegionReq *req; req = AllocReq(DestroyRegion); req->regionid = region;}/** * GrUnionRectWithRegion: * @region: the ID of the region to modify * @rect: a pointer to the rectangle to add to the region * * Makes a union of the specified region and the specified rectangle and * places the result back in the source region. */voidGrUnionRectWithRegion(GR_REGION_ID region, GR_RECT *rect){ nxUnionRectWithRegionReq *req; req = AllocReq(UnionRectWithRegion); if(rect) memcpy(&req->rect, rect, sizeof(*rect)); req->regionid = region;}/** * GrUnionRegion: * @dst_rgn: the ID of the destination region * @src_rgn1: the ID of the first source region * @src_rgn2: the ID of the second source region * * Makes a union of the specified source regions and places the result in the * specified destination region. */voidGrUnionRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1, GR_REGION_ID src_rgn2){ nxUnionRegionReq *req; req = AllocReq(UnionRegion); req->regionid = dst_rgn; req->srcregionid1 = src_rgn1; req->srcregionid2 = src_rgn2;}/** * GrSubtractRegion: * @dst_rgn: the ID of the destination region * @src_rgn1: the ID of the first source region * @src_rgn2: the ID of the second source region * * Subtracts the second source region from the first source region and places * the result in the specified destination region. */voidGrSubtractRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1, GR_REGION_ID src_rgn2){ nxSubtractRegionReq *req; req = AllocReq(SubtractRegion); req->regionid = dst_rgn; req->srcregionid1 = src_rgn1; req->srcregionid2 = src_rgn2;}/** * GrXorRegion: * @dst_rgn: the ID of the destination region * @src_rgn1: the ID of the first source region * @src_rgn2: the ID of the second source region * * Performs a logical exclusive OR operation on the specified source regions * and places the result in the destination region. The destination region * will contain only the parts of the source regions which do not overlap. */voidGrXorRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1, GR_REGION_ID src_rgn2){ nxXorRegionReq *req; req = AllocReq(XorRegion); req->regionid = dst_rgn; req->srcregionid1 = src_rgn1; req->srcregionid2 = src_rgn2;}/** * GrIntersectRegion: * @dst_rgn: the ID of the destination region * @src_rgn1: the ID of the first source region * @src_rgn2: the ID of the second source region * * Calculates the intersection of the two specified source regions and places * the result in the specified destination region. The destination region * will contain only the parts of the source regions which overlap each other. */voidGrIntersectRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1, GR_REGION_ID src_rgn2){ nxIntersectRegionReq *req; req = AllocReq(IntersectRegion); req->regionid = dst_rgn; req->srcregionid1 = src_rgn1; req->srcregionid2 = src_rgn2;}/** * GrSetGCRegion: * @gc: the ID of the graphics context to set the clip mask of * @region: the ID of the region to use as the clip mask * * Sets the clip mask of the specified graphics context to the specified * region. Subsequent drawing operations using this graphics context will not * draw outside the specified region. The region ID can be set to 0 to remove * the clipping region from the specified graphics context. */voidGrSetGCRegion(GR_GC_ID gc, GR_REGION_ID region){ nxSetGCRegionReq *req; req = AllocReq(SetGCRegion); req->gcid = gc; req->regionid = region;}/** * GrSetGCClipOrigin: * @gc: the ID of the graphics context with user clip region * @xoff: new X offset of user clip region * @xoff: new Y offset of user clip region * * Sets the X,Y origin of the user clip region in the specified * graphics context. */void GrSetGCClipOrigin(GR_GC_ID gc, int x, int y){ nxSetGCClipOriginReq *req; req = AllocReq(SetGCClipOrigin); req->gcid = gc; req->xoff = x; req->yoff = y;}/** * GrPointInRegion: * @region: the ID of the region to examine * @x: the X coordinate of the point to test for * @y: the Y coordinate of the point to test for * @Returns: True if the point is within the region, or False otherwise * * Tests whether the specified point is within the specified region, and * then returns either True or False depending on the result. */GR_BOOLGrPointInRegion(GR_REGION_ID region, GR_COORD x, GR_COORD y){ nxPointInRegionReq *req; GR_BOOL ret_value; req = AllocReq(PointInRegion); req->regionid = region; req->x = x; req->y = y; if(GrTypedReadBlock(&ret_value, sizeof(ret_value), GrNumPointInRegion) == -1) return GR_FALSE; return ret_value;}/** * GrRectInRegion: * @region: the ID of the region to examine * @x: the X coordinates of the rectangle to test * @y: the Y coordinates of the rectangle to test * @w: the width of the rectangle to test * @h: the height of the rectangle to test * @Returns: GR_RECT_PARTIN, GR_RECT_ALLIN, or GR_RECT_OUT * * Tests whether the specified rectangle is contained within the specified * region. Returns GR_RECT_OUT if it is not inside it at all, GR_RECT_ALLIN * if it is completely contained within the region, or GR_RECT_PARTIN if * it is partially contained within the region. */intGrRectInRegion(GR_REGION_ID region, GR_COORD x, GR_COORD y, GR_COORD w, GR_COORD h){ nxRectInRegionReq *req; unsigned short ret_value; req = AllocReq(RectInRegion); req->regionid = region; req->x = x; req->y = y; req->w = w; req->h = h; if(GrTypedReadBlock(&ret_value, sizeof(ret_value), GrNumRectInRegion) == -1) return 0; return (int)ret_value;}/** * GrEmptyRegion: * @region: the ID of the region to examine * @Returns: GR_TRUE if the region is empty, or GR_FALSE if it is not * * Determines whether the specified region is empty, and returns GR_TRUE * if it is, or GR_FALSE otherwise. */GR_BOOLGrEmptyRegion(GR_REGION_ID region){ nxEmptyRegionReq *req; GR_BOOL ret_value; req = AllocReq(EmptyRegion); req->regionid = region; if(GrTypedReadBlock(&ret_value, sizeof(ret_value), GrNumEmptyRegion) == -1) return GR_FALSE; return ret_value;}/** * GrEqualRegion: * @rgn1: the ID of the first region to examine * @rgn2: the ID of the second region to examine * @Returns: GR_TRUE if the regions are equal, or GR_FALSE otherwise * * Determines whether the specified regions are identical, and returns GR_TRUE * if it is, or GR_FALSE otherwise. */GR_BOOLGrEqualRegion(GR_REGION_ID rgn1, GR_REGION_ID rgn2){ nxEqualRegionReq *req; GR_BOOL ret_value; req = AllocReq(EqualRegion); req->region1 = rgn1; req->region2 = rgn2; if(GrTypedReadBlock(&ret_value, sizeof(ret_value), GrNumEqualRegion) == -1) return GR_FALSE; return ret_value;}/** * GrOffsetRegion: * @region: the ID of the region to offset * @dx: the distance to offset the region by in the X axis * @dy: the distance to offset the region by in the Y axis * * Offsets the specified region by the specified distance. */voidGrOffsetRegion(GR_REGION_ID region, GR_SIZE dx, GR_SIZE dy){ nxOffsetRegionReq *req; req = AllocReq(OffsetRegion); req->region = region; req->dx = dx; req->dy = dy;}/** * GrGetRegionBox: * @region: the ID of the region to get the bounding box of * @rect: pointer to a rectangle structure * @Returns: the region type * * Fills in the specified rectangle structure with a bounding box that would * completely enclose the specified region, and also returns the type of the * specified region. */intGrGetRegionBox(GR_REGION_ID region, GR_RECT *rect){ nxGetRegionBoxReq *req; unsigned short ret_value; if (!rect) return GR_FALSE; req = AllocReq(GetRegionBox); req->regionid = region; if(GrTypedReadBlock(rect, sizeof(*rect), GrNumGetRegionBox) == -1) return GR_FALSE; if(GrTypedReadBlock(&ret_value, sizeof(ret_value), GrNumGetRegionBox) == -1) return GR_FALSE; return ret_value;}/** * GrNewPolygonRegion: * @mode: the polygon mode to use (GR_POLY_EVENODD or GR_POLY_WINDING) * @count: the number of points in the polygon * @points: pointer to an array of point structures describing the polygon * @Returns: the ID of the newly allocated region structure, or 0 on error * * Creates a new region structure, fills it with the region described by the * specified polygon, and returns the ID used to refer to it. */GR_REGION_ID GrNewPolygonRegion(int mode, GR_COUNT count, GR_POINT *points){ nxNewPolygonRegionReq *req; long size; GR_REGION_ID region; if(count == 0) return GrNewRegion(); if(points == NULL) return 0; size = (long)count * sizeof(GR_POINT); req = AllocReqExtra(NewPolygonRegion, size); req->mode = mode; /* FIXME: unportable method, depends on sizeof(int) in GR_POINT*/ memcpy(GetReqData(req), points, size); if(GrTypedReadBlock(®ion, sizeof(region), GrNumNewPolygonRegion) == -1) return 0; return region;}/** * GrMapWindow: * @wid: the ID of the window to map * * Recursively maps (makes visible) the specified window and all of the * child windows which have a sufficient map count. The border and background * of the window are painted, and an exposure event is generated for the * window and every child which becomes visible. */void GrMapWindow(GR_WINDOW_ID wid){ nxMapWindowReq *req;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -