📄 mfb.0
字号:
_M_F_B_S_e_t_R_u_b_b_e_r_B_a_n_d_i_n_g enables/disables rubber banding of the pointing device. If _o_n_F_l_a_g is false, then rubber banding is disabled. When enabled, the center of rubber banding is at _X, _Y. Rubber banding is always disabled immediately after the pointing device has been used. MFBOK is returned if the rubberbanding mode was successfully set to that specified by _o_n_F_l_a_g; MFBNORBND is returned if the graphics device does not have rub- berbanding in the pointing device. int MFBSetBlinker(colorId, red, green, blue, onFlag) int colorId; int red, green, blue; int onFlag; _M_F_B_S_e_t_B_l_i_n_k_e_r enables the color identified by _c_o_l_o_r_I_d to blink between its currently defined color and the color defined by the _r_e_d, _g_r_e_e_n, _b_l_u_e combination. The values of _r_e_d, _g_r_e_e_n, and _b_l_u_e are normalized to 1000. If _o_n_F_l_a_g is zero, the blinking is disabled. The number of colors that may be defined as blinkers at any given time must be less than the value of _m_a_x_B_l_i_n_k_e_r_s in the _M_F_B data structure. The frequency of the blink- ing colors is fixed and can be changed only by modify- ing the _m_f_b_c_a_p database file. MFBOK is returned if the color specified by _c_o_l_o_r_I_d was successfully set to the desired blinking mode; MFBNOBLNK is returned if the graphics device does not have blinking VLT layers, and MFBTMBLNK is returned if there are already too many active blinking layers.66/21/83 MFB(3)DEFINING DEVICE PARAMETERS Each of the following routines for defining device parame- ters returns a negative value if any difficulty is encoun- tered. The possible returned integers are defined in _m_f_b._h as follows: #define MFBOK 1 /* successful return */ #define MFBNODFLP -120 /* No definable line patterns */ #define MFBNODFFP -130 /* No definable fill patterns */ #define MFBNODFCO -140 /* No definable colors */ int MFBDefineColor(colorId, red, green, blue) int colorId; int red, green, blue; _M_F_B_D_e_f_i_n_e_C_o_l_o_r redefines the VLT entry for the color identified by _c_o_l_o_r_I_d to be the color represented by the _r_e_d, _g_r_e_e_n, _b_l_u_e combination where _r_e_d, _g_r_e_e_n, and _b_l_u_e are normalized to 1000. Once the color corresponding to _c_o_l_o_r_I_d is redefined, all geometries that were written onto the display of a frame buffer with _c_o_l_o_r_I_d as the current color will become the new color. MFBOK is returned if the VLT entry for _c_o_l_o_r_I_d was successfully defined; MFBNODFCO is returned if the graphics device does not have a VLT. int MFBDefineFillPattern(styleId, BitArray) int styleId; int *BitArray; _M_F_B_D_e_f_i_n_e_F_i_l_l_P_a_t_t_e_r_n redefines the fill pattern identi- fied by _s_t_y_l_e_I_d and returns with _s_t_y_l_e_I_d as the current fill style. _B_i_t_A_r_r_a_y is a pointer to an array of eight integers whose least significant eight bits represent individual rows in an eight by eight intensity array. For example, a fill pattern with an ascending diagonal line may be defined by the following eight (decimal) integers: 1 2 4 8 16 32 64 128 256 A diagonal-grid fill pattern can be defined with the following integer array: 257 130 68 40 40 68 130 257 7MFB(3) 6/21/83 MFBOK is returned if the new fill style for _s_t_y_l_e_I_d was successfully defined; MFBNODFFP is returned if the graphics device does not have definable fill patterns. int MFBDefineLineStyle(styleId, Mask) int styleId; int Mask; _M_F_B_D_e_f_i_n_e_L_i_n_e_S_t_y_l_e defines the line style identified by _s_t_y_l_e_I_d to be the pattern contained in the eight least significant bits of _M_a_s_k and returns with _s_t_y_l_e_I_d as the current line style. MFBOK is returned if the line style for _s_t_y_l_e_I_d was successfully defined; MFBNODFFP is returned if the graphics device does not have defin- able line patterns.INPUT/OUTPUT ROUTINES int MFBUpdate() _M_F_B_U_p_d_a_t_e flushes the internal output buffer to the currently defined output device and will ignore any write error that may occur. A call to this routine is ABSOLUTELY necessary to complete any graphics display sequence. _M_F_B_U_p_d_a_t_e returns the number of characters sent to the output graphics device or -1 if a write error occured. int MFBPoint(X, Y, key, button) int *X, *Y, *button; char *key; _M_F_B_P_o_i_n_t enables the graphics pointing device and then waits for user input. If a keyboard key is pressed, _M_F_B_P_o_i_n_t returns with _k_e_y containing the character that was pressed. If the pointing device is pressed, _M_F_B_P_o_i_n_t returns with the identified viewport coordi- nate _X, _Y, the contents of _k_e_y equal to zero, and the button mask of the button that was pushed. The integer array _b_u_t_t_o_n_M_a_s_k in the _M_F_B data structure contains all possible button mask values that can be returned. _M_F_B_P_o_i_n_t returns one of the following values defined in the _m_f_b._h file: #define MFBOK 1 /* successful return */ #define MFBPNTERR -230 /* Error in pointing device */ #define MFBNOPTFT -240 /* No pointing format */ #define MFBNOPNT -260 /* No pointing device */86/21/83 MFB(3) char *MFBKeyboard(X, Y, background, foreground) int background; int foreground; int X, Y; _M_F_B_K_e_y_b_o_a_r_d enables the graphics keyboard and waits for user input. A pointer to a character buffer containing the keyboard input is returned by _M_F_B_K_e_y_b_o_a_r_d when the user presses the return or linefeed key. Backspace is control-H or the delete character, and control-X or control-U will kill the line. Pressing the ESCAPE key will cause _M_F_B_K_e_y_b_o_a_r_d to return with a null string in the input character buffer. All keyboard input is displayed in the viewport with the lower left corner at the viewport coordinate _X, _Y and is constrained to fit on one line. _B_a_c_k_g_r_o_u_n_d and _f_o_r_e_g_r_o_u_n_d are the background and foreground color styles respectively in which the keyboard input will be displayed. void MFBAudio() _M_F_B_A_u_d_i_o will ring the bell or alarm on the graphics device. If the graphics device does not have a bell, then a control-G will be sent to standard output. int MFBPutchar(c) char c; int MFBPutstr(cp,nchars) int nchars; char *cp; int MFBGetchar() These three routines are used internally by _M_F_B and typically are not used within an application program. They are comparable to the _s_t_d_i_o routines having simi- lar names. _M_F_B_P_u_t_c_h_a_r places a character _c in the out- put buffer. _M_F_B_P_u_t_s_t_r inserts a string pointed to by _c_p containing _n_c_h_a_r_s characters into the output buffer. The _n_c_h_a_r_s argument is necessary to permit embedded null characters in the output stream. The characters remain in the output buffer until the next call to _M_F_B_U_p_d_a_t_e or until the contents of the output buffer exceed 4096 characters. _M_F_B_G_e_t_c_h_a_r returns a single character from the graphics input device. If the graphics device does not have a keyboard, input is obtained from the terminal from which the application program was invoked. If the graphics device is a _t_t_y, it should be remembered that 9MFB(3) 6/21/83 it is in CBREAK mode.TWO DIMENSIONAL GEOMETRY ROUTINES All coordinates that are passed to the following geometry routines are with respect to the display resolution of the graphics device. _M_F_B assumes that the lower, left corner of the display is the origin with an absolute coordinate (0, 0). All coordinate values are positive integers. void MFBMoveTo(X1, Y1) int X1, Y1; _M_F_B_M_o_v_e_T_o sets the current graphics position to _X_1, _Y_1. No line will be drawn from the old graphics position. void MFBDrawLineTo(X1, Y1) int X1, Y1; _M_F_B_D_r_a_w_L_i_n_e_T_o draws a line from the current graphics position to _X_1, _Y_1 in the current line style and color. The current graphics position then becomes _X_1, _Y_1. void MFBLine(X1, Y1, X2, Y2) int X1, Y1, X2, Y2; _M_F_B_L_i_n_e draws a line in the current line style and color from _X_1, _Y_1 to _X_2, _Y_2. void MFBBox(left, bottom, right, top) int left, bottom, right, top; _M_F_B_B_o_x displays a rectangle in the current fill pattern and color with diagonal coordinates at _l_e_f_t, _b_o_t_t_o_m and _r_i_g_h_t, _t_o_p. void MFBDrawPath(path) MFBPATH *path; _M_F_B_D_r_a_w_P_a_t_h draws a path of vectors in the current line style and color. _P_a_t_h is a pointer to a data structure defined in the _m_f_b._h file as follows: struct mfbpath { int nvertices; /* number of (x,y) coordinate pairs */ int *xy; /* pointer to array of (x,y) coordinates */ }; typedef struct mfbpath MFBPATH; The contents of the coordinate array are organized such that xy[0] is the x coordinate of the first vertex, xy[1] is the y coordinate of the first vertex, xy[2] is106/21/83 MFB(3) the x coordinate of the second vertex, etc. void MFBFlood() _M_F_B_F_l_o_o_d erases a frame buffer display to the current color as previously defined by _M_F_B_S_e_t_C_o_l_o_r. The result would be the same as drawing a solid box over the entire display. void MFBPixel(X, Y) int X, Y; _M_F_B_P_i_x_e_l sets the pixel at location _X, _Y on the display to the current color as previously defined by _M_F_B_S_e_t_C_o_l_o_r. void MFBCircle(X, Y, rad, nsides) int X, Y, rad, nsides; _M_F_B_C_i_r_c_l_e draws the perimeter of a circle in the current line style and color with center at _X, _Y and with radius _r_a_d. The argument _n_s_i_d_e_s is the number of line segments with which the circle will be drawn if the frame buffer does not have a circle primitive. The default value for _n_s_i_d_e_s is twenty. void MFBFlash(X, Y, rad, nsides) int X, Y, rad, nsides; _M_F_B_F_l_a_s_h draws a round flash with the current fill pat- tern and color with center at _X, _Y and radius _r_a_d. The argument _n_s_i_d_e_s is the number of line segments with which the flash will be drawn. The default value for _n_s_i_d_e_s is twenty. void MFBArc(X, Y, rad, angle1, angle2, nsides) int X, Y, rad; int angle1, angle2, nsides; _M_F_B_A_r_c draws an arc in the current line style and color with center at _X, _Y and with radius _r_a_d beginning at _a_n_g_l_e_1 with respect to the positive y-axis and ending at _a_n_g_l_e_2 in a counter-clockwise direction. Both
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -