nano x graphics


graphicsNano-X API Reference Manual<<< Previous PageHomeUpNext Page >>>graphicsNamegraphics — Synopsis GR_GC_ID GrNewGC (void); GR_GC_ID GrCopyGC (GR_GC_ID gc); void GrGetGCInfo (GR_GC_ID gc, GR_GC_INFO *gcip); void GrDestroyGC (GR_GC_ID gc); void GrLine (GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x1, GR_COORD y1, GR_COORD x2, GR_COORD y2); void GrPoint (GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y); void GrPoints (GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count, GR_POINT *pointtable); void GrRect (GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width, GR_SIZE height); void GrFillRect (GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width, GR_SIZE height); void GrPoly (GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count, GR_POINT *pointtable); void GrFillPoly (GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count, GR_POINT *pointtable); void GrEllipse (GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE rx, GR_SIZE ry); void GrFillEllipse (GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE rx, GR_SIZE ry); void GrArc (GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE rx, GR_SIZE ry, GR_COORD ax, GR_COORD ay, GR_COORD bx, GR_COORD by, int type); void GrArcAngle (GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE rx, GR_SIZE ry, GR_COORD angle1, GR_COORD angle2, int type); void GrSetGCForeground (GR_GC_ID gc, GR_COLOR foreground); void GrSetGCBackground (GR_GC_ID gc, GR_COLOR background); void GrSetGCUseBackground (GR_GC_ID gc, GR_BOOL flag); void GrSetGCMode (GR_GC_ID gc, int mode); void GrSetGCFont (GR_GC_ID gc, GR_FONT_ID font); void GrGetGCTextSize (GR_GC_ID gc, void *str, int count, int flags, GR_SIZE *retwidth, GR_SIZE *retheight, GR_SIZE *retbase); void GrReadArea (GR_DRAW_ID id, GR_COORD x, GR_COORD y, GR_SIZE width, GR_SIZE height, GR_PIXELVAL *pixels); void GrArea (GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width, GR_SIZE height, void *pixels, int pixtype); void GrCopyArea (GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width, GR_SIZE height, GR_DRAW_ID srcid, GR_COORD srcx, GR_COORD srcy, int op); void GrBitmap (GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width, GR_SIZE height, GR_BITMAP *imagebits); void GrFreeImage (GR_IMAGE_ID id); void GrGetImageInfo (GR_IMAGE_ID id, GR_IMAGE_INFO *iip); void GrDrawImageFromFile (GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width, GR_SIZE height, char *path, int flags); GR_IMAGE_ID GrLoadImageFromFile (char *path, int flags); void GrDrawImageToFit (GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width, GR_SIZE height, GR_IMAGE_ID imageid); void GrDrawImageBits (GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_IMAGE_HDR *pimage); void GrText (GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, void *str, GR_COUNT count, int flags);DescriptionDetailsGrNewGC ()GR_GC_ID GrNewGC (void);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.Returns : the ID of the newly created graphics context or 0 on errorGrCopyGC ()GR_GC_ID GrCopyGC (GR_GC_ID gc);Creates a new graphics context structure and fills it in with the values from the specified already existing graphics context.gc : the already existing graphics context to copy the parameters fromReturns : the ID of the newly created graphics context or 0 on errorGrGetGCInfo ()void GrGetGCInfo (GR_GC_ID gc, GR_GC_INFO *gcip);Fills in the specified GR_GC_INFO structure with information regarding the specified graphics context.gc : a graphics contextgcip : pointer to a GR_GC_INFO structureGrDestroyGC ()void GrDestroyGC (GR_GC_ID gc);Destroys the graphics context structure with the specified ID.gc : the ID of the graphics context structure to destroyGrLine ()void GrLine (GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x1, GR_COORD y1, GR_COORD x2, GR_COORD y2);Draws a line using the specified graphics context on the specified drawable from (x1, y1) to (x2, y2), with coordinates given relative to the drawable.id : the ID of the drawable to draw the line ongc : the ID of the graphics context to use when drawing the linex1 : the X coordinate of the start of the line relative to the drawabley1 : the Y coordinate of the start of the line relative to the drawablex2 : the X coordinate of the end of the line relative to the drawabley2 : the Y coordinate of the end of the line relative to the drawableGrPoint ()void GrPoint (GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y);Draws a point using the specified graphics context at the specified position on the specified drawable.id : the ID of the drawable to draw a point ongc : the ID of the graphics context to use when drawing the pointx : the X coordinate to draw the point at relative to the drawabley : the Y coordinate to draw the point at relative to the drawableGrPoints ()void GrPoints (GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count, GR_POINT *pointtable);Draws a set of points using the specified graphics context at the positions specified by the point table on the specified drawable.id : the ID of the drawable to draw a point ongc : the ID of the graphics context to use when drawing the pointcount : the number of points in the point tablepointtable : pointer to a GR_POINT array which lists the points to drawGrRect ()void GrRect (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 of the specified dimensions and position on the specified drawable using the specified graphics context.id : the ID of the drawable to draw the rectangle ongc : the ID of the graphics context to use when drawing the rectanglex : the X coordinate of the rectangle relative to the drawabley : the Y coordinate of the rectangle relative to the drawablewidth : the width of the rectangleheight : the height of the rectangleGrFillRect ()void GrFillRect (GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width, GR_SIZE height);Draw a filled rectangle of the specified dimensions and position on the specified drawable using the specified graphics context.id : the ID of the drawable to draw the rectangle ongc : the ID of the graphics context to use when drawing the rectanglex : the X coordinate of the rectangle relative to the drawabley : the Y coordinate of the rectangle relative to the drawablewidth : the width of the rectangleheight : the height of the rectangleGrPoly ()void GrPoly (GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count, GR_POINT *pointtable);Draws an unfilled polygon on the specified drawable using the specified graphics context. The polygon is specified by an array of point structures. The polygon is not automatically closed- if a closed polygon is desired, the last point must be the same as the first.id : the ID of the drawable to draw the polygon ontogc : the ID of the graphics context to use when drawing the polygoncount : the number of points in the point arraypointtable : pointer to an array of points describing the polygonGrFillPoly ()void GrFillPoly (GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count, GR_POINT *pointtable);Draws a filled polygon on the specified drawable using the specified graphics context. The polygon is specified by an array of point structures. The polygon is automatically closed- the last point need not be the same as the first in order for the polygon to be closed.id : the ID of the drawable to draw the polygon ontogc : the ID of the graphics context to use when drawing the polygoncount : the number of points in the point arraypointtable : pointer to an array of points describing the polygonGrEllipse ()void GrEllipse (GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE rx, GR_SIZE ry);Draws the boundary of ellipse at the specified position using the specified dimensions and graphics context on the specified drawable.id : the ID of the drawable to draw the ellipse ongc : the ID of the graphics context to use when drawing the ellipsex : the X coordinate to draw the ellipse at relative to the drawabley : the Y coordinate to draw the ellipse at relative to the drawablerx : the radius of the ellipse on the X axisry : the radius of the ellipse on the Y axisGrFillEllipse ()void GrFillEllipse (GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE rx, GR_SIZE ry);Draws a filled ellipse at the specified position using the specified dimensions and graphics context on the specified drawable.id : the ID of the drawable to draw the filled ellipse ongc : the ID of the graphics context to use when drawing the ellipsex : the X coordinate to draw the ellipse at relative to the drawabley : the Y coordinate to draw the ellipse at relative to the drawablerx : the radius of the ellipse on the X axisry : the radius of the ellipse on the Y axisGrArc ()void GrArc (GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE rx, GR_SIZE ry, GR_COORD ax, GR_COORD ay, GR_COORD bx, GR_COORD by, int type);Draws an arc with the specified dimensions at the specified position on the specified drawable using the specified graphics context. The type specifies the fill type. Possible values include GR_ARC and GR_PIE.id : the ID of the drawable to draw the arc ongc : the graphics context to use when drawing the arcx : the X coordinate to draw the arc at relative to the drawabley : the Y coordinate to draw the arc at relative to the drawablerx : the radius of the arc on the X axisry : the radius of the arc on the Y axisax : the X coordinate of the start of the arc relative to the drawableay : the Y coordinate of the start of the arc relative to the drawablebx : the X coordinate of the end of the arc relative to the drawableby : the Y coordinate of the end of the arc relative to the drawabletype : the fill style to use when drawing the arcGrArcAngle ()void GrArcAngle (GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE rx, GR_SIZE ry, GR_COORD angle1, GR_COORD angle2, int type);Draws an arc with the specified dimensions at the specified position on the specified drawable using the specified graphics context. The type specifies the fill type. Possible values include GR_ARC and GR_PIE. This function requires floating point support, and is slightly slower than the GrArc() function which does not require floating point.id : the ID of the drawable to draw the arc ongc : the graphics context to use when drawing the arcx : the X coordinate to draw the arc at relative to the drawabley : the Y coordinate to draw the arc at relative to the drawablerx : the radius of the arc on the X axisry : the radius of the arc on the Y axisangle1 : the angle of the start of the arcangle2 : the angle of the end of the arctype : the fill style to use when drawing the arcGrSetGCForeground ()void GrSetGCForeground (GR_GC_ID gc, GR_COLOR foreground);Changes the foreground colour of the specified graphics context to the specified colour.gc : the ID of the graphics context to set the foreground colour offoreground : the colour to use as the new foreground colourGrSetGCBackground ()void GrSetGCBackground (GR_GC_ID gc, GR_COLOR background);Changes the background colour of the specified graphics context to the specified colour.gc : the ID of the graphics context to set the background colour ofbackground : the colour to use as the new background colourGrSetGCUseBackground ()void GrSetGCUseBackground (GR_GC_ID gc, GR_BOOL flag);Sets the flag which chooses whether or not the background colour is used when drawing bitmaps and text using the specified graphics context to the specified value.gc : the ID of the graphics context to change the "use background" flag offlag : flag specifying whether to use the background colour or notGrSetGCMode ()void GrSetGCMode (GR_GC_ID gc, int mode);Changes the drawing mode (SET, XOR, OR, AND, etc.) of the specified graphics context to the specified mode.gc : the ID of the graphics context to set the drawing mode ofmode : the new drawing modeGrSetGCFont ()void GrSetGCFont (GR_GC_ID gc, GR_FONT_ID font);Sets the font to be used for text drawing in the specified graphics context to the specified font ID.gc : the ID of the graphics context to set the font offont : the ID of the fontGrGetGCTextSize ()void GrGetGCTextSize (GR_GC_ID gc, void *str, int count, int flags, GR_SIZE *retwidth, GR_SIZE *retheight, GR_SIZE *retbase);Calculates the dimensions of the specified text string using the current font and flags in the specified graphics context. The count argument can be -1 if the string is null terminated.gc : the graphics contextstr : pointer to a text stringcount : the length of the stringflags : text rendering flags (GR_TF*)retwidth : pointer to the variable the width will be returned inretheight : pointer to the variable the height will be returned inretbase : pointer to the variable the baseline height will be returned inGrReadArea ()void GrReadArea (GR_DRAW_ID id, GR_COORD x, GR_COORD y, GR_SIZE width, GR_SIZE height, GR_PIXELVAL *pixels);Reads the pixel data of the specified size from the specified position on the specified drawable into the specified pixel array. If the drawable is a window, the data returned will be the pixel values from the relevant position on the screen regardless of whether the window is obscured by other windows. If the window is unmapped, or partially or fully outside a window boundary, black pixel values will be returned.id : the ID of the drawable to read an area fromx : the X coordinate to read the area from relative to the drawabley : the Y coordinate to read the area from relative to the drawablewidth : the width of the area to readheight : the height of the area to readpixels : pointer to an area of memory to place the pixel data inGrArea ()void GrArea (GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width, GR_SIZE height, void *pixels, int pixtype);Draws the specified pixel array of the specified size and format onto the specified drawable using the specified graphics context at the specified position. Note that colour conversion is currently only performed when using the GR_PF_RGB format, which is an unsigned long containing RGBX data.id : the ID of the drawable to draw the area ontogc : the ID of the graphics context to use when drawing the areax : the X coordinate to draw the area at relative to the drawabley : the Y coordinate to draw the area at relative to the drawablewidth : the width of the areaheight : the height of the areapixels : pointer to an array containing the pixel datapixtype : the format of the pixel dataGrCopyArea ()void GrCopyArea (GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width, GR_SIZE height, GR_DRAW_ID srcid, GR_COORD srcx, GR_COORD srcy, int op);Copies the specified area of the specified size between the specified drawables at the specified positions using the specified graphics context and ROP codes. 0 is a sensible default ROP code in most cases.id : the ID of the drawable to copy the area togc : the ID of the graphics context to use when copying the areax : the X coordinate to copy the area to within the destination drawabley : the Y coordinate to copy the area to within the destination drawablewidth : the width of the area to copyheight : the height of the area to copysrcid : the ID of the drawable to copy the area fromsrcx : the X coordinate to copy the area from within the source drawablesrcy : the Y coordinate to copy the area from within the source drawableop : the ROP codes to pass to the blitter when performing the copyGrBitmap ()void GrBitmap (GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width, GR_SIZE height, GR_BITMAP *imagebits);Draws the monochrome bitmap data provided in the bitmaptable argument at the specified position on the specified drawable using the specified graphics context. Note that the bitmap data should be an array of aligned 16 bit words. The usebackground flag in the graphics context specifies whether to draw the background colour wherever a bit value is zero.id : the ID of the drawable to draw the bitmap ontogc : the ID of the graphics context to use when drawing the bitmapx : the X coordinate to draw the bitmap at relative to the drawabley : the Y coordinate to draw the bitmap at relative to the drawablewidth : the width of the bitmapheight : the height of the bitmapimagebits : GrFreeImage ()void GrFreeImage (GR_IMAGE_ID id);Destroys the specified image buffer and reclaims the memory used by it.id : ID of the image buffer to freeGrGetImageInfo ()void GrGetImageInfo (GR_IMAGE_ID id, GR_IMAGE_INFO *iip);Fills in the specified image information structure with the details of the specified image buffer.id : ID of an image bufferiip : pointer to a GR_IMAGE_INFO structureGrDrawImageFromFile ()void GrDrawImageFromFile (GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width, GR_SIZE height, char *path, int flags);Loads the specified image file and draws it at the specified position on the specified drawable using the specified graphics context. The width and height values specify the size of the image to draw- if the actual image is a different size, it will be scaled to fit. The image type is automatically detected using the magic numbers in the image header (ie. the filename extension is irrelevant). The currently supported image types include GIF, JPEG, Windows BMP, PNG, XPM, and both ascii and binary variants of PBM, PGM, and PPM. However the image types supported by a particular server depend on which image types were enabled in the server configuration at build time.id : the ID of the drawable to draw the image ontogc : the ID of the graphics context to use when drawing the imagex : the X coordinate to draw the image at relative to the drawabley : the Y coordinate to draw the image at relative to the drawablewidth : the maximum image widthheight : the maximum image heightpath : string containing the filename of the image to loadflags : flags specific to the particular image loaderGrLoadImageFromFile ()GR_IMAGE_ID GrLoadImageFromFile (char *path, int flags);Loads the specified image file into a newly created server image buffer and returns the ID of the buffer. The image type is automatically detected using the magic numbers in the image header (ie. the filename extension is irrelevant). The currently supported image types include GIF, JPEG, Windows BMP, PNG, XPM, and both ascii and binary variants of PBM, PGM, and PPM. However the image types supported by a particular server depend on which image types were enabled in the server configuration at build time.path : string containing the filename of the image to loadflags : flags specific to the particular image loaderReturns : ID of the image buffer the image was loaded intoGrDrawImageToFit ()void GrDrawImageToFit (GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width, GR_SIZE height, GR_IMAGE_ID imageid);Draws the image from the specified image buffer at the specified position on the specified drawable using the specified graphics context. The width and height values specify the size of the image to draw- if the actual image is a different size, it will be scaled to fit.id : the ID of the drawable to draw the image ontogc : the ID of the graphics context to use when drawing the imagex : the X coordinate to draw the image at relative to the drawabley : the Y coordinate to draw the image at relative to the drawablewidth : the maximum image widthheight : the maximum image heightimageid : the ID of the image buffer containing the image to displayGrDrawImageBits ()void GrDrawImageBits (GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_IMAGE_HDR *pimage);Draws the image contained in the specified image structure onto the specified drawable at the specified coordinates using the specified graphics context.id : the ID of the drawable to draw the image ontogc : the ID of the graphics context to use when drawing the imagex : the X coordinate to draw the image at relative to the drawabley : the Y coordinate to draw the image at relative to the drawablepimage : pointer to the image structureGrText ()void GrText (GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, void *str, GR_COUNT count, int flags);Draws the specified text string at the specified position on the specified drawable using the specified graphics context and flags. The default flags specify ASCII encoding and baseline alignment.id : the ID of the drawable to draw the text string ontogc : the ID of the graphics context to use when drawing the text stringx : the X coordinate to draw the string at relative to the drawabley : the Y coordinate to draw the string at relative to the drawablestr : the text string to drawcount : the number of characters (not bytes) in the stringflags : flags specifying text encoding, alignment, etc.<<< Previous PageHomeUpNext Page >>>windowevents

Wyszukiwarka

Podobne podstrony:
graphic02
graphics
graphic11
graphite pet
graphic26
nano x window
Rheology of Nano Scale Aluminum Suspensions
Graphics
representing graphical user interfaces64834
nano x pointer
graphic23
raport nano Polska
Graphic Design For Everyone 01
graphic13
nano x regions
graphic33

więcej podobnych podstron