📄 mfb.0
字号:
6/21/83 MFB(3)NAME mfb - model frame buffer interfaceSYNOPSIS #include <~cad/include/mfb.h> in the program source. cc [ flags ] files ~cad/lib/mfb.a -lm [ libraries ]DESCRIPTION These routines provide the user with a virtual graphics interface. They perform the terminal dependent task of encoding/decoding graphics code, thereby allowing the user to write graphics programs to run on almost any graphics device. The user opens and initializes a graphics device by calling the _M_F_B_O_p_e_n routine that returns a pointer to that device's _M_F_B data structure defined at the end of this manual. By maintaining several _M_F_B data structures, an application pro- gram can drive several graphics devices simultaneously. Once opened, _M_F_B graphics routines can be called to draw geometries, draw graphics text, set device parameters, or receive keyboard input. An application program can also use any of the several utility routines that perform line clip- ping, polygon clipping, or window/viewport transformations. Control of the graphics device is released by calling the _M_F_B_C_l_o_s_e routine. All programs that use _M_F_B routines must include the file _m_f_b._h that defines the _M_F_B data structure to contain the information provided by _M_F_B_C_A_P(_5).INITIALIZATION ROUTINES MFB *MFBOpen(TerminalName, DeviceName, errorcode) char *TerminalName, *DeviceName; int *errorcode; _M_F_B_O_p_e_n initializes the graphics device and fills the _M_F_B data structure with information found in _M_F_B_C_A_P(_5). _T_e_r_m_i_n_a_l_N_a_m_e is a pointer to a null terminated string containing the name of the graphics device as defined in the _m_f_b_c_a_p database file. This argument has no default and can never be null. _D_e_v_i_c_e_N_a_m_e is a pointer to a null terminated string containing the full path name to the respective graphics device. If null, _s_t_d_i_n and _s_t_d_o_u_t are used by default. _e_r_r_o_r_c_o_d_e is a diag- nostic integer returned by _M_F_B_O_p_e_n. The possible returned values for _e_r_r_o_r_c_o_d_e are defined in the _m_f_b._h file as follows: 1MFB(3) 6/21/83 #define MFBOK 1 /* successful return */ #define MFBBADENT -10 /* Unknown terminal type */ #define MFBBADMCF -20 /* Can't open MFBCAP file */ #define MFBMCELNG -30 /* MFBCAP entry too long */ #define MFBBADMCE -40 /* Bad MFBCAP entry */ #define MFBINFMCE -50 /* infinite loop in MFBCAP entry */ #define MFBBADTTY -60 /* stdout not in /dev */ #define MFBBADDEV -180 /* Can't open or close device */ #define MFBBADOPT -190 /* Can't access or set device stat */ #define MFBBADWRT -220 /* Error during write */ Only MFBOK is not a fatal error. void SetCurrentMFB(mfb) MFB *mfb; _S_e_t_C_u_r_r_e_n_t_M_F_B allows the application program to define the current graphics device. All subsequent calls to _M_F_B routines will affect the specified device. Because each _M_F_B data structure contains a separate output buffer, it is not necessary to flush the output before resetting the current output device. _M_F_B_O_p_e_n returns with the opened graphics device defined as the current output device. int MFBInitialize() _M_F_B_I_n_i_t_i_a_l_i_z_e will flush the output buffer and (re)initialize the device for graphics input. The graphics device or standard input will be placed in CBREAK mode. See the manual _t_t_y(_4). MFBOK is returned if the device was successfully initialized; MFBBADOPT is returned if an error was encountered while attempt- ing to access or set the device status, and MFBBADTTY is returned if standard output can bot be found or accessed. int MFBClose() _M_F_B_C_l_o_s_e will flush the output buffer and release con- trol of the graphics device driver. If the graphics device is a _t_t_y, it is returned to the state that existed prior to the respective _M_F_B_O_p_e_n call. MFBOK is returned if the device was successfully closed; MFBBA- DOPT is returned if an error was encountered while attempting to access or set the device status, and MFBBADDEV is returned if the output device could not be closed.26/21/83 MFB(3) int MFBHalt() _M_F_B_H_a_l_t will flush the output buffer and release con- trol of the graphics device driver. If the graphics device is a _t_t_y, it is returned to the state that existed prior to the respective _M_F_B_O_p_e_n call. _M_F_B_H_a_l_t differs from _M_F_B_C_l_o_s_e in that the memory occupied by the respective, current _M_F_B data structure is not freed. By calling _M_F_B_I_n_i_t_i_a_l_i_z_e, the graphics device will be reinitialized. This routine is typically used by an application program for handling the SIGTSTP sig- nal (the keyboard stop signal, usually control-Z ). MFBOK is returned if the device was successfully returned to its initial state; MFBBADOPT is returned if an error was encountered while attempting to access or set the device status.SETTING DEVICE PARAMETERS Each of the following routines for setting device parameters returns a diagnostice integer that is defined in the _m_f_b._h file as follows: #define MFBOK 1 /* successful return */ #define MFBBADLST -70 /* Illegal line style */ #define MFBBADFST -80 /* Illegal fill style */ #define MFBBADCST -90 /* Illegal color style */ #define MFBBADTM1 -100 /* No destructive text mode */ #define MFBBADTM2 -110 /* No overstriking text mode */ #define MFBNOBLNK -150 /* No definable blinkers */ #define MFBTMBLNK -160 /* Too many blinkers */ #define MFBNOMASK -170 /* No definable read or write mask */ #define MFBBADALU -250 /* Cannot set ALU mode */ int MFBSetLineStyle(styleId) int styleId; _M_F_B_S_e_t_L_i_n_e_S_t_y_l_e sets the current line style to that identified by the integer _s_t_y_l_e_I_d that is greater than or equal to zero and less than the value of _m_a_x_L_i_n_e_S_- _t_y_l_e_s in the _M_F_B data structure. The value of _m_a_x_- _L_i_n_e_S_t_y_l_e_s can be obtained from the _M_F_B_I_n_f_o routine defined below. Zero is always the _s_t_y_l_e_I_d for solid lines. Except for the solid line style, _M_F_B assumes no default set of lines styles. MFBOK is returned if the line style was successfully set to that specified by _s_t_y_l_e_I_d or if _s_t_y_l_e_I_d was already the current line style; MFBBADLST is returned if _s_t_y_l_e_I_d has an illegal value. 3MFB(3) 6/21/83 int MFBSetFillPattern(styleId) int styleId; _M_F_B_S_e_t_F_i_l_l_P_a_t_t_e_r_n sets the current fill pattern to that identified by the integer _s_t_y_l_e_I_d that is greater than or equal to zero and less than the value of _m_a_x_F_i_l_l_P_a_t_- _t_e_r_n_s in the _M_F_B data structure. The value of _m_a_x_- _F_i_l_l_P_a_t_t_e_r_n_s can be obtained from the _M_F_B_I_n_f_o routine defined below. Solid fill is always defined by _s_t_y_l_e_I_d equal to zero. Other than solid fill, _M_F_B assumes no default set of fill patterns. MFBOK is returned if the fill style was successfully set to that specified by _s_t_y_l_e_I_d or if _s_t_y_l_e_I_d was already the current fill style; MFBBADFST is returned if _s_t_y_l_e_I_d has an illegal value. int MFBSetChannelMask(channelMask) int channelMask; _M_F_B_S_e_t_C_h_a_n_n_e_l_M_a_s_k defines the current write mask to be the value of _c_h_a_n_n_e_l_M_a_s_k. The channel mask allows specific memory planes to be written and erased without disturbing other memory planes. The least significant bit of _c_h_a_n_n_e_l_M_a_s_k corresponds to the masked value of the first memory plane, etc. If the corresponding bit is zero, the memory plane is write-protected. The number of memory planes can be obtained from the _M_F_B_I_n_f_o routine defined below. MFBOK is returned if the write mask was successfully set to _c_h_a_n_n_e_l_M_a_s_k or if _c_h_a_n_n_e_l_M_a_s_k was already the current write mask; MFBNOMASK is returned if the graphics device does not have a definable write mask. int MFBSetReadMask(readmask) int readmask; _M_F_B_S_e_t_R_e_a_d_M_a_s_k defines the current read mask to be the value of _r_e_a_d_m_a_s_k. The read mask allows only specific memory planes to be read. MFBOK is returned if the read mask was successfully set to _r_e_a_d_M_a_s_k or if _r_e_a_d_- _M_a_s_k was already the current read mask; MFBNOMASK is returned if the graphics device does not have a defin- able read mask.46/21/83 MFB(3) int MFBSetColor(colorId) int colorId; _M_F_B_S_e_t_C_o_l_o_r sets the current foreground color to that identified by the integer _c_o_l_o_r_I_d that is greater than or equal to zero and less than the value of _m_a_x_C_o_l_o_r_s in the _M_F_B data structure. The value of _m_a_x_C_o_l_o_r_s can be obtained from the _M_F_B_I_n_f_o routine defined below. There is no default color map in _M_F_B. MFBOK is returned if the foreground color was successfully set to that specified by _c_o_l_o_r_I_d or if _c_o_l_o_r_I_d was already the current foreground color; MFBBADCST is returned if _c_o_l_o_r_I_d has an illegal value. int MFBSetTextMode(destructiveBool) Bool destructiveBool; _M_F_B_S_e_t_T_e_x_t_M_o_d_e defines whether subsequent graphics text will overstrike or replace previous text. If _d_e_s_t_r_u_c_- _t_i_v_e_B_o_o_l is true, the text mode is set to destructive which means that graphic text will set the background color of the font grid to the color that is specified by color style zero depending on the currently defined ALU operation. Overstriking mode will only set the pixels of the character font to the current foreground color. MFBOK is returned if the graphic text writing mode was successfully set to that specified by _d_e_s_t_r_u_c_- _t_i_v_e_B_o_o_l or if _d_e_s_t_r_u_c_t_i_v_e_B_o_o_l was already the current graphic text writing mode; MFBBADTM1 is returned if the graphics device does not have a destructive graphic text mode, and MFBBADTM2 is returned if the graphics device does not have an overstriking graphic text mode. int MFBSetALUMode(alumode) int alumode; _M_F_B_S_e_t_A_L_U_M_o_d_e changes the mode by which the graphics display is changed when an area of the display is over-written. The four possible modes are JAM (replace mode), OR, EOR (exclusive OR), and NOR. The four valid arguments to _M_F_B_S_e_t_A_L_U_M_o_d_e are defined in _m_f_b._h as fol- lows: #define MFBALUJAM 0 /* set ALU mode to JAM */ #define MFBALUOR 1 /* set ALU mode to OR */ #define MFBALUNOR 2 /* set ALU mode to NOR */ #define MFBALUEOR 3 /* set ALU mode to EOR */ MFBOK is returned if the ALU mode was successfully set to that specified by _a_l_u_m_o_d_e or if _a_l_u_m_o_d_e was already the current ALU operation; MFBBADALU is returned if the graphics device does not have the ALU mode speci- fied by _a_l_u_m_o_d_e or if _a_l_u_m_o_d_e is an invalid or illegal 5MFB(3) 6/21/83 argument. int MFBSetCursorColor(colorId1, colorId2) int colorId1, colorId2; _M_F_B_S_e_t_C_u_r_s_o_r_C_o_l_o_r sets the graphics cursor to blink between the two colors identified by _c_o_l_o_r_I_d_1 and _c_o_l_o_r_I_d_2. The constraints on the values for _c_o_l_o_r_I_d_1 and _c_o_l_o_r_I_d_2 are the same as for _M_F_B_S_e_t_C_o_l_o_r defined above. The frequency of the blinking cursor is fixed and can be changed only by modifying the _m_f_b_c_a_p data- base file. MFBOK is returned if the blinking cursor colors were successfully set to the specified colors. int MFBSetRubberBanding(onFlag, X, Y) int X, Y; Bool onFlag;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -