📄 extgraph.h
字号:
*
* Black, Dark Gray, Gray, Light Gray, White,
* Red, Yellow, Green, Cyan, Blue, Magenta
*
* The first line corresponds to standard gray scales and the
* second to the primary and secondary colors of light. The
* built-in set is limited to these colors because they are
* likely to be the same on all hardware devices. For finer
* color control, you can use the DefineColor function to
* create new color names as well.
*/
void SetPenColor(string color);
/*
* Function: GetPenColor
* Usage: color = GetPenColor();
* -----------------------------
* This function returns the current pen color as a string.
*/
string GetPenColor(void);
/*
* Function: DefineColor
* Usage: DefineColor(name, red, green, blue);
* -------------------------------------------
* This function allows the client to define a new color name
* by supplying intensity levels for the colors red, green,
* and blue, which are the primary colors of light. The
* color values are provided as real numbers between 0 and 1,
* indicating the intensity of that color. For example,
* the predefined color Magenta has full intensity red and
* blue but no green and is therefore defined as:
*
* DefineColor("Magenta", 1, 0, 1);
*
* DefineColor allows you to create intermediate colors on
* many displays, although the results vary significantly
* depending on the hardware. For example, the following
* usually gives a reasonable approximation of brown:
*
* DefineColor("Brown", .35, .20, .05);
*/
void DefineColor(string name,
double red, double green, double blue);
/* Section 7 -- Pictures */
/*
* Function: DrawNamedPicture
* Usage: DrawNamedPicture(name);
* ------------------------------
* This function looks for a graphical resource with the
* specified name and copies it to the graphics window
* so that the lower left corner of the image appears
* at the current point. The function generates an error
* if the named picture cannot be found. Note that,
* although the interface presented here is the same for
* all systems, the format used for the resource itself
* and the mechanism used to name it may not be portable
* from one machine to another. To port an application
* between platforms, some conversion of the associated
* resources is usually required.
*/
void DrawNamedPicture(string name);
/*
* Functions: GetPictureWidth, GetPictureHeight
* Usage: w = GetPictureWidth("name");
* h = GetPictureHeight("name");
* ------------------------------------
* These functions return the width and height (in inches)
* of the named picture resource, as described in the comments
* for DrawNamedPicture.
*/
double GetPictureWidth(string name);
double GetPictureHeight(string name);
/* Section 8 -- Miscellaneous functions */
/*
* Function: SetEraseMode
* Usage: SetEraseMode(TRUE);
* SetEraseMode(FALSE);
* ---------------------------
* The SetEraseMode function sets the value of the internal
* erasing flag. Setting this flag is similar to setting the
* color to "White" in its effect but does not affect the
* current color setting. When erase mode is set to FALSE,
* normal drawing is restored, using the current color.
*
* It is an error to enable Erase mode and XOR mode at the same time.
*/
void SetEraseMode(bool mode);
/*
* Function: GetEraseMode
* Usage: mode = GetEraseMode();
* -----------------------------
* This function returns the current state of the erase mode flag.
*/
bool GetEraseMode(void);
/*
* Function: SetWindowTitle
* Usage: SetWindowTitle(title);
* -----------------------------
* This function sets the title of the graphics window, if such
* an operation is possible on the display. If it is not possible
* for a particular implementation, the call is simply ignored.
* This function may be called prior to the InitGraphics call to
* set the initial name of the window.
*/
void SetWindowTitle(string title);
/*
* Function: GetWindowTitle
* Usage: title = GetWindowTitle();
* --------------------------------
* This function returns the title of the graphics window. If the
* implementation does not support titles, this call returns the
* empty string.
*/
string GetWindowTitle(void);
/*
* Function: UpdateDisplay
* Usage: UpdateDisplay();
* -----------------------
* This function initiates an immediate update of the graphics
* window and is necessary for animation. Ordinarily, the
* graphics window is updated only when the program waits for
* user input.
*/
void UpdateDisplay(void);
/*
* Function: Pause
* Usage: Pause(seconds);
* ----------------------
* The Pause function updates the graphics window and then
* pauses for the indicated number of seconds. This function
* is useful for animation where the motion would otherwise
* be too fast.
*/
void Pause(double seconds);
/*
* Function: ExitGraphics
* Usage: ExitGraphics();
* ----------------------
* The ExitGraphics function closes the graphics window and
* exits from the application without waiting for any additional
* user interaction.
*/
void ExitGraphics(void);
/*
* Functions: SaveGraphicsState, RestoreGraphicsState
* Usage: SaveGraphicsState();
* . . . graphical operations . . .
* RestoreGraphicsState();
* ---------------------------------------------------
* The SaveGraphicsState function saves the current graphics
* state (the current pen position, the font, the point size,
* and the erase mode flag) internally, so that they can be
* restored by the next RestoreGraphicsState call. These two
* functions must be used in pairs but may be nested to any depth.
*/
void SaveGraphicsState(void);
void RestoreGraphicsState(void);
/*
* Functions: GetFullScreenWidth, GetFullScreenHeight
* Usage: width = GetFullScreenWidth();
* height = GetFullScreenHeight();
* --------------------------------------
* These functions return the height and width of the entire
* display screen, not the graphics window. Their only
* significant use is for applications that need to adjust
* the size of the graphics window based on available screen
* space. These functions may be called before InitGraphics
* has been called.
*/
double GetFullScreenWidth(void);
double GetFullScreenHeight(void);
/*
* Functions: SetWindowSize
* Usage: SetWindowSize(width, height);
* ------------------------------------
* This function sets the window size to the indicated dimensions,
* if possible. This function should be called before the graphics
* window is created by InitGraphics. Attempts to change the size
* of an existing window are ignored by most implementations. This
* function should be used sparingly because it reduces the
* portability of applications, particularly if the client
* requests more space than is available on the screen.
*/
void SetWindowSize(double width, double height);
/*
* Functions: GetXResolution, GetYResolution
* Usage: xres = GetXResolution();
* yres = GetYResolution();
* -----------------------------------------
* These functions return the number of pixels per inch along
* each of the coordinate directions and are useful for applications
* in which it is important for short distances to be represented
* uniformly in terms of dot spacing. Even though the x and y
* resolutions are the same for most displays, clients should
* not rely on this property.
*
* Note: Lines in the graphics library are one pixel unit wide and
* have a length that is always one pixel longer than you might
* expect. For example, the function call
*
* DrawLine(2 / GetXResolution(), 0);
*
* draws a line from the current point to the point two pixels
* further right, which results in a line of three pixels.
*/
double GetXResolution(void);
double GetYResolution(void);
/*
* Function: SetXORMode
* Usage: SetXORMode(TRUE);
* SetXORMode(FALSE);
* ---------------------------
* The SetXORMode function sets the value of the internal
* XOR-drawing flag. When this flag is set, wherever you
* draw will turn to the opposite of its existing color;
* this kind of drawing has the property that if you do it
* twice in a row (without changing anything else), the display
* will end up back how it started. This type of drawing is
* useful for animations and "rubber-band" selection.
* When XOR mode is set to FALSE, normal drawing resumes
* (the result of a draw operation depends only on that draw
* operation, and not what was already on the screen).
*
* It is an error to enable XOR mode and Erase mode at the same time.
*
* Caveat: This operation may not be portable to other
* implementations of the graphics library.
*/
void SetXORMode(bool mode);
/*
* Function: GetXORMode
* Usage: mode = GetXORMode();
* -----------------------------
* This function returns the current state of the XOR mode flag.
*/
bool GetXORMode(void);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -