Nano-X API Reference Manual | |||
---|---|---|---|
<<< Previous Page | Home | Up | Next Page >>> |
|
|
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.
|
Creates a new graphics context structure and fills it in with the values from the specified already existing graphics context.
void GrGetGCInfo ( |
Fills in the specified GR_GC_INFO structure with information regarding the specified graphics context.
void GrDestroyGC ( |
Destroys the graphics context structure with the specified ID.
void GrLine ( |
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 on |
gc : | the ID of the graphics context to use when drawing the line |
x1 : | the X coordinate of the start of the line relative to the drawable |
y1 : | the Y coordinate of the start of the line relative to the drawable |
x2 : | the X coordinate of the end of the line relative to the drawable |
y2 : | the Y coordinate of the end of the line relative to the drawable |
void GrPoint ( |
Draws a point using the specified graphics context at the specified position on the specified drawable.
void GrPoints ( |
Draws a set of points using the specified graphics context at the positions specified by the point table on the specified drawable.
void GrRect ( |
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 on |
gc : | the ID of the graphics context to use when drawing the rectangle |
x : | the X coordinate of the rectangle relative to the drawable |
y : | the Y coordinate of the rectangle relative to the drawable |
width : | the width of the rectangle |
height : | the height of the rectangle |
void GrFillRect ( |
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 on |
gc : | the ID of the graphics context to use when drawing the rectangle |
x : | the X coordinate of the rectangle relative to the drawable |
y : | the Y coordinate of the rectangle relative to the drawable |
width : | the width of the rectangle |
height : | the height of the rectangle |
void GrPoly ( |
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.
void GrFillPoly ( |
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.
void GrEllipse ( |
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 on |
gc : | the ID of the graphics context to use when drawing the ellipse |
x : | the X coordinate to draw the ellipse at relative to the drawable |
y : | the Y coordinate to draw the ellipse at relative to the drawable |
rx : | the radius of the ellipse on the X axis |
ry : | the radius of the ellipse on the Y axis |
void GrFillEllipse ( |
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 on |
gc : | the ID of the graphics context to use when drawing the ellipse |
x : | the X coordinate to draw the ellipse at relative to the drawable |
y : | the Y coordinate to draw the ellipse at relative to the drawable |
rx : | the radius of the ellipse on the X axis |
ry : | the radius of the ellipse on the Y axis |
void GrArc ( |
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 on |
gc : | the graphics context to use when drawing the arc |
x : | the X coordinate to draw the arc at relative to the drawable |
y : | the Y coordinate to draw the arc at relative to the drawable |
rx : | the radius of the arc on the X axis |
ry : | the radius of the arc on the Y axis |
ax : | the X coordinate of the start of the arc relative to the drawable |
ay : | the Y coordinate of the start of the arc relative to the drawable |
bx : | the X coordinate of the end of the arc relative to the drawable |
by : | the Y coordinate of the end of the arc relative to the drawable |
type : | the fill style to use when drawing the arc |
void GrArcAngle ( |
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. The angle is specified in 64ths of a degree.
id : | the ID of the drawable to draw the arc on |
gc : | the graphics context to use when drawing the arc |
x : | the X coordinate to draw the arc at relative to the drawable |
y : | the Y coordinate to draw the arc at relative to the drawable |
rx : | the radius of the arc on the X axis |
ry : | the radius of the arc on the Y axis |
angle1 : | the angle of the start of the arc |
angle2 : | the angle of the end of the arc |
type : | the fill style to use when drawing the arc |
void GrSetGCForeground ( |
Changes the foreground colour of the specified graphics context to the specified colour.
void GrSetGCBackground ( |
Changes the background colour of the specified graphics context to the specified colour.
void GrSetGCUseBackground ( |
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.
void GrSetGCMode ( |
Changes the drawing mode (GR_MODE_SET, GR_MODE_XOR, GR_MODE_OR, GR_MODE_AND, etc.) of the specified graphics context to the specified mode.
void GrSetGCFont ( |
Sets the font to be used for text drawing in the specified graphics context to the specified font ID.
void GrGetGCTextSize ( |
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 context |
str : | pointer to a text string |
count : | the length of the string |
flags : | text rendering flags (GR_TF*) |
retwidth : | pointer to the variable the width will be returned in |
retheight : | pointer to the variable the height will be returned in |
retbase : | pointer to the variable the baseline height will be returned in |
void GrSetGCClipOrigin ( |
Sets the origin of the user clip region in the specified graphics context to the specified X and Y coordinates.
void GrSetGCGraphicsExposure ( |
Controls whether GR_EVENT_TYPE_EXPOSURE events are sent as a result of GrCopyArea calls which use the specified graphics context.
void GrReadArea ( |
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 from |
x : | the X coordinate to read the area from relative to the drawable |
y : | the Y coordinate to read the area from relative to the drawable |
width : | the width of the area to read |
height : | the height of the area to read |
pixels : | pointer to an area of memory to place the pixel data in |
void GrArea ( |
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 onto |
gc : | the ID of the graphics context to use when drawing the area |
x : | the X coordinate to draw the area at relative to the drawable |
y : | the Y coordinate to draw the area at relative to the drawable |
width : | the width of the area |
height : | the height of the area |
pixels : | pointer to an array containing the pixel data |
pixtype : | the format of the pixel data |
void GrCopyArea ( |
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 to |
gc : | the ID of the graphics context to use when copying the area |
x : | the X coordinate to copy the area to within the destination drawable |
y : | the Y coordinate to copy the area to within the destination drawable |
width : | the width of the area to copy |
height : | the height of the area to copy |
srcid : | the ID of the drawable to copy the area from |
srcx : | the X coordinate to copy the area from within the source drawable |
srcy : | the Y coordinate to copy the area from within the source drawable |
op : | the ROP codes to pass to the blitter when performing the copy |
void GrCopyAreaAlpha ( |
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. The alpha channel can be specified as 0 if you do not want to perform alpha blending.
id : | the ID of the drawable to copy the area to |
gc : | the ID of the graphics context to use when copying the area |
alpha : | the ID of the alpha channel to use when blending the area |
x : | the X coordinate to copy the area to within the destination drawable |
y : | the Y coordinate to copy the area to within the destination drawable |
width : | the width of the area to copy |
height : | the height of the area to copy |
srcid : | the ID of the drawable to copy the area from |
srcx : | the X coordinate to copy the area from within the source drawable |
srcy : | the Y coordinate to copy the area from within the source drawable |
op : | the ROP codes to pass to the blitter when performing the copy |
void GrBitmap ( |
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 onto |
gc : | the ID of the graphics context to use when drawing the bitmap |
x : | the X coordinate to draw the bitmap at relative to the drawable |
y : | the Y coordinate to draw the bitmap at relative to the drawable |
width : | the width of the bitmap |
height : | the height of the bitmap |
bitmaptable : | pointer to the bitmap data |
void GrFreeImage ( |
Destroys the specified image buffer and reclaims the memory used by it.
void GrGetImageInfo ( |
Fills in the specified image information structure with the details of the specified image buffer.
void GrDrawImageFromFile ( |
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. Note that there is no way for you to tell if this call fails. If you need error detection, do seperate GrLoadImageFromFile() and GrDrawImageToFit() calls. If an alpha channel is specified, it will be filled in with the transparency or an alpha information contained in the image. If the image file does not contain any transparency or alpha information, the alpha channel will be filled with maximum opacity values (ie. it is assumed to be not translucent at all). Note that filling in an alpha channel when drawing to a window is unlikely to have the desired effect as the part of the alpha channel that is drawn to depends on the absolute location of the window on the screen. If in doubt draw to a pixmap instead of directly to the screen.
id : | the ID of the drawable to draw the image onto |
gc : | the ID of the graphics context to use when drawing the image |
x : | the X coordinate to draw the image at relative to the drawable |
y : | the Y coordinate to draw the image at relative to the drawable |
width : | the maximum image width |
height : | the maximum image height |
path : | string containing the filename of the image to load |
flags : | flags specific to the particular image loader |
alpha : | the id of the alpha channel to fill in or 0 if no alpha channel |
|
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. If the load fails, an image ID of 0 is returned.
void GrDrawImageToFit ( |
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. If an alpha channel is specified, it will be filled in with the transparency or an alpha information contained in the image. If the image file does not contain any transparency or alpha information, the alpha channel will be filled with maximum opacity values (ie. it is assumed to be not translucent at all). Note that filling in an alpha channel when drawing to a window is unlikely to have the desired effect as the part of the alpha channel that is drawn to depends on the absolute location of the window on the screen. If in doubt draw to a pixmap instead of directly to the screen.
id : | the ID of the drawable to draw the image onto |
gc : | the ID of the graphics context to use when drawing the image |
x : | the X coordinate to draw the image at relative to the drawable |
y : | the Y coordinate to draw the image at relative to the drawable |
width : | the maximum image width |
height : | the maximum image height |
imageid : | the ID of the image buffer containing the image to display |
alpha : | the id of the alpha channel to fill in or 0 if no alpha channel |
|
Loads the image in the specified buffer 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. 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. If the load fails, an image ID of 0 is returned.
void GrDrawImageFromBuffer ( |
Loads the image in the specified buffer 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 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. Note that there is no way for you to tell if this call fails. If you need error detection, do seperate GrLoadImageFromBuffer() and GrDrawImageToFit() calls. If an alpha channel is specified, it will be filled in with the transparency or an alpha information contained in the image. If the image file does not contain any transparency or alpha information, the alpha channel will be filled with maximum opacity values (ie. it is assumed to be not translucent at all). Note that filling in an alpha channel when drawing to a window is unlikely to have the desired effect as the part of the alpha channel that is drawn to depends on the absolute location of the window on the screen. If in doubt draw to a pixmap instead of directly to the screen.
id : | the ID of the drawable to draw the image onto |
gc : | the ID of the graphics context to use when drawing the image |
x : | the X coordinate to draw the image at relative to the drawable |
y : | the Y coordinate to draw the image at relative to the drawable |
width : | the maximum image width |
height : | the maximum image height |
buffer : | pointer to a buffer containing the image data to load |
size : | size in bytes of the image |
flags : | flags specific to the particular image loader |
alpha : | the id of the alpha channel to fill in or 0 if no alpha channel |
void GrDrawImageBits ( |
Draws the image contained in the specified image structure onto the specified drawable at the specified coordinates using the specified graphics context.
void GrText ( |
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 onto |
gc : | the ID of the graphics context to use when drawing the text string |
x : | the X coordinate to draw the string at relative to the drawable |
y : | the Y coordinate to draw the string at relative to the drawable |
str : | the text string to draw |
count : | the number of characters (not bytes) in the string |
flags : | flags specifying text encoding, alignment, etc. |