Some Useful C++ Functions
(For use with Pro-SiMPLE only)



[Important Note: You cannot invoke SiMPLE's color setting
tasks (Linecolor, Solidcolor, etc.) just to set the "current color"
referred to by any of these C++ functions. SiMPLE does not establish
the "current color" until that requested color actually gets displayed.]


          

arc

void far arc (int x, int y, int stangle, int endangle, int radius); Remarks: arc draws a circular arc in the current drawing color. (x,y) - Center point of arc stangle - Start angle in degrees endangle - End angle in degrees radius - Radius of arc The arc travels from stangle to endangle. If stangle = 0 and endangle = 360, the call to arc draws a complete circle. 90 degrees | | 180 ------+------ 0 degrees, degrees | 360 degrees | 270 degrees The linestyle parameter does not affect arcs. Only the thickness parameter is used. ____________________________________________________________________________________________

bar3d

void far bar3d(int left, int top, int right, int bottom, int depth, int topflag); Remarks: bar3d draws a three-dimensional rectangular bar, then fills it using the current fill pattern and fill color. The three-dimensional outline of the bar is drawn in the current line style and color. depth - Bar's depth in pixels topflag - Governs whether a three-dimensional top is put on the bar (left, top) - Rectangle's upper left corner (right, bottom) - Rectangle's lower right corner If topflag is non-zero, a top is put on the bar. If topflag is 0, no top is put on the bar. This makes it possible to stack several bars on top of one another. To calculate a typical depth for bar3d, take 25% of the width of the bar, like this: bar3d (left, top, right, bottom, (right-left)/4, 1); ____________________________________________________________________________________________

drawpoly

void far drawpoly (int numpoints, int far *polypoints); Remarks: drawpoly draws a polygon using the current line style and color. numpoints - Specifies number of points *polypoints - Points to a sequence of ("numpoints" x 2) integers. Each pair of integers gives the x and y coordinates of a point on the polygon. To draw a closed figure with N vertices, you must pass N+1 coordinates to drawpoly, where the Nth coordinate == the 0th coordinate. ____________________________________________________________________________________________

fillpoly

void far fillpoly (int numpoints, int far *polypoints); Remarks: fillpoly draws the outline of a polygon using the current line style and color, then fills the polygon using the current fill pattern and fill color. numpoints - Specifies number of points *polypoints - Points to a sequence of ("numpoints" x 2) integers. Each pair of integers gives the x and y coordinates of a point on the polygon. To draw a closed figure with N vertices, you must pass N+1 coordinates to filldrawpoly, where the Nth coordinate == the 0th coordinate. ____________________________________________________________________________________________

floodfill

void far floodfill (int x, int y, int border); Remarks: floodfill flood-fills a bounded region. The area bounded by the color "border" is flooded with the current fill pattern and fill color. (x,y) is the "seed point". If the seed is inside an enclosed area, the interior will be filled. If the seed is outside the enclosed area, the exterior will be filled. ____________________________________________________________________________________________

getcolor

int far getcolor (void); Remarks: getcolor returns the current drawing color. The drawing color is the value that pixels are set to when the program draws lines, etc. ____________________________________________________________________________________________

outtext

void far outtext (char far *textstring); Remarks: outtext displays a text string, using the current direction and size. (outtext is for use in graphics mode only; it will not work in text mode.) ____________________________________________________________________________________________

outtextxy

void far outtextxy (int x, int y, char far *textstring); Remarks: outtextxy displays a text string at the specified (x,y) location. (outtextxy is for use in graphics mode only; it will not work in text mode.) ____________________________________________________________________________________________

pieslice

void far pieslice (int x, int y, int stangle, int endangle, int radius); Remarks: pieslice draws a pie slice in the current drawing color, then fills it using the current fill pattern and fill color. (x,y) - Center point of pie slice stangle - Start angle in degrees endangle - End angle in degrees radius - Radius of pie slice The slice travels from stangle to endangle. 90 degrees | | 180 ------+------ 0 degrees, degrees | 360 degrees | 270 degrees The linestyle parameter does not affect pie slices. Only the thickness parameter is used. ____________________________________________________________________________________________

setcolor

void far setcolor (int color); Remarks: setcolor sets the current drawing color to "color". The drawing color is the value that pixels are set to when the program draws lines, etc. ____________________________________________________________________________________________

setfillpattern

void far setfillpattern (char far *pattern, int color); Remarks: setfillpattern sets the current fill pattern to a user-defined 8x8 pattern. pattern: Points to a sequence of 8 bytes; each byte corresponds to 8 pixels in the user-defined pattern. (Whenever a bit in a pattern's byte is set to 1, the corresponding pixel is plotted.) For example, the following user-defined fill pattern represents a checkerboard: char checkerboard[8] = { 0xAA, /* 10101010 */ 0x55, /* 01010101 */ 0xAA, /* 10101010 */ 0x55, /* 01010101 */ 0xAA, /* 10101010 */ 0x55, /* 01010101 */ 0xAA, /* 10101010 */ 0x55 /* 01010101 */ }; ____________________________________________________________________________________________

setfillstyle

void far setfillstyle (int pattern, int color); Remarks: setfillstyle sets the current fill pattern and fill color. Fill patterns for setfillstyle: 0: (Background color) 1: Solid fill 2: --- 3: /// 4: ///, thick lines 5: \\\, thick lines 6: \\\ 7: Light hatch 8: Heavy crosshatch 9: Interleaving lines 10: Sparce dots 11: Closely spaced dots ____________________________________________________________________________________________

setpalette

void far setpalette (int colornum, int color); Remarks: setpalette changes the "colornum" entry (0-15) in the palette to "color". The palette initially contains the following "color" values: "colornum" | "color" -----------+-------- 0 | 0 1 | 1 2 | 2 3 | 3 4 | 4 5 | 5 6 | 20 7 | 7 8 | 56 9 | 57 10 | 58 11 | 59 12 | 60 13 | 61 14 | 62 15 | 63 Changes made to the palette are seen immediately onscreen. Each time a palette color is changed, all occurrences of that color onscreen change to the new color value. ____________________________________________________________________________________________

setrgbpalette

void far setrgbpalette (int colornum, int red, int green, int blue); Remarks: setrgbpalette sets a color palette value. colornum: The palette entry to be loaded (0-15). red: The amount of Red (0-63). green: The amount of Green (0-63). blue: The amount of Blue (0-63). ____________________________________________________________________________________________

settextstyle

void far settextstyle (int font, int direction, int charsize); Remarks: settextstyle sets the text font, the direction in which text is displayed, and the size of the characters. A call to settextstyle affects all text output by outtext and outtextxy. font: 0 (Only one 8x8 bit-mapped font is built into the graphics system.) direction: 0, horizontal text (left to right) 1, vertical text (bottom to top) charsize: The size that each character is to be magnified (1-10). ____________________________________________________________________________________________

setwritemode

void far setwritemode(int mode); Remarks: Sets the writing mode for line drawing in graphics mode. mode: 0, Uses the assembly language MOV instruction, overwriting with the line whatever is on the screen. 1, Uses the XOR command to combine the line with the screen. (Two successive XOR commands will erase the line and restore the screen to its original appearance.) setwritemode currently works only with line, linerel, lineto, rectangle, and drawpoly.



  [ Webmaster | FAQ's | Home Page | Contact Us ]