00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef FB_H
00038 #define FB_H seen
00039
00040 #include "fbio.h"
00041
00042
00043
00044
00045
00046
00047
00048
00049 #if defined(HAVE_SYS_TYPES_H)
00050 # include <sys/types.h>
00051 #endif
00052 #if defined(HAVE_SYS_TIME_H)
00053 # include <sys/time.h>
00054 #endif
00055 #if defined(HAVE_UNISTD_H)
00056 # include <unistd.h>
00057 #else
00058 # if defined(HAVE_SYS_UNISTD_H)
00059 # include <sys/unistd.h>
00060 # endif
00061 #endif
00062
00063
00064
00065 #define fb_gettype(_ifp) (_ifp->if_type)
00066 #define fb_getwidth(_ifp) (_ifp->if_width)
00067 #define fb_getheight(_ifp) (_ifp->if_height)
00068 #define fb_poll(_ifp) (*_ifp->if_poll)(_ifp)
00069 #define fb_help(_ifp) (*_ifp->if_help)(_ifp)
00070 #define fb_free(_ifp) (*_ifp->if_free)(_ifp)
00071 #define fb_clear(_ifp,_pp) (*_ifp->if_clear)(_ifp,_pp)
00072 #define fb_read(_ifp,_x,_y,_pp,_ct) (*_ifp->if_read)(_ifp,_x,_y,_pp,_ct)
00073 #define fb_write(_ifp,_x,_y,_pp,_ct) (*_ifp->if_write)(_ifp,_x,_y,_pp,_ct)
00074 #define fb_rmap(_ifp,_cmap) (*_ifp->if_rmap)(_ifp,_cmap)
00075 #define fb_wmap(_ifp,_cmap) (*_ifp->if_wmap)(_ifp,_cmap)
00076 #define fb_view(_ifp,_xc,_yc,_xz,_yz) (*_ifp->if_view)(_ifp,_xc,_yc,_xz,_yz)
00077 #define fb_getview(_ifp,_xcp,_ycp,_xzp,_yzp) \
00078 (*_ifp->if_getview)(_ifp,_xcp,_ycp,_xzp,_yzp)
00079 #define fb_setcursor(_ifp,_bits,_xb,_yb,_xo,_yo) \
00080 (*_ifp->if_setcursor)(_ifp,_bits,_xb,_yb,_xo,_yo)
00081 #define fb_cursor(_ifp,_mode,_x,_y) (*_ifp->if_cursor)(_ifp,_mode,_x,_y)
00082 #define fb_getcursor(_ifp,_modep,_xp,_yp) \
00083 (*_ifp->if_getcursor)(_ifp,_modep,_xp,_yp)
00084 #define fb_readrect(_ifp,_xmin,_ymin,_width,_height,_pp) \
00085 (*_ifp->if_readrect)(_ifp,_xmin,_ymin,_width,_height,_pp)
00086 #define fb_writerect(_ifp,_xmin,_ymin,_width,_height,_pp) \
00087 (*_ifp->if_writerect)(_ifp,_xmin,_ymin,_width,_height,_pp)
00088 #define fb_bwreadrect(_ifp,_xmin,_ymin,_width,_height,_pp) \
00089 (*_ifp->if_bwreadrect)(_ifp,_xmin,_ymin,_width,_height,_pp)
00090 #define fb_bwwriterect(_ifp,_xmin,_ymin,_width,_height,_pp) \
00091 (*_ifp->if_bwwriterect)(_ifp,_xmin,_ymin,_width,_height,_pp)
00092
00093
00094 #ifdef USE_PROTOTYPES
00095 FB_EXPORT extern void fb_configureWindow(FBIO *, int, int);
00096 FB_EXPORT extern FBIO *fb_open(char *file, int width, int height);
00097 FB_EXPORT extern int fb_close(FBIO *ifp);
00098 FB_EXPORT extern int fb_genhelp(void);
00099 FB_EXPORT extern int fb_ioinit(FBIO *ifp);
00100 FB_EXPORT extern int fb_seek(FBIO *ifp, int x, int y);
00101 FB_EXPORT extern int fb_tell(FBIO *ifp, int *xp, int *yp);
00102 FB_EXPORT extern int fb_rpixel(FBIO *ifp, unsigned char *pp);
00103 FB_EXPORT extern int fb_wpixel(FBIO *ifp, unsigned char *pp);
00104 FB_EXPORT extern int fb_flush(FBIO *ifp);
00105 FB_EXPORT extern void fb_log(char *fmt, ...);
00106 FB_EXPORT extern int fb_null(FBIO *ifp);
00107 FB_EXPORT extern int fb_null_setcursor(FBIO *ifp, const unsigned char *bits, int xbits, int ybits, int xorig, int yorig);
00108
00109
00110 FB_EXPORT extern int fb_common_file_size(unsigned long int *widthp, unsigned long int *heightp, const char *filename, int pixel_size);
00111 FB_EXPORT extern int fb_common_image_size(unsigned long int *widthp, unsigned long int *heightp, unsigned long int npixels);
00112 FB_EXPORT extern int fb_common_name_size(unsigned long int *widthp, unsigned long int *heightp, const char *name);
00113
00114
00115 FB_EXPORT extern int fb_is_linear_cmap(const ColorMap *cmap);
00116 FB_EXPORT extern void fb_make_linear_cmap(ColorMap *cmap);
00117
00118
00119 FB_EXPORT extern int fb_reset(FBIO *ifp);
00120 FB_EXPORT extern int fb_viewport(FBIO *ifp, int left, int top, int right, int bottom);
00121 FB_EXPORT extern int fb_window(FBIO *ifp, int xcenter, int ycenter);
00122 FB_EXPORT extern int fb_zoom(FBIO *ifp, int xzoom, int yzoom);
00123 FB_EXPORT extern int fb_scursor(FBIO *ifp, int mode, int x, int y);
00124
00125
00126
00127
00128
00129 FB_EXPORT extern int _fb_pgin();
00130 FB_EXPORT extern int _fb_pgout();
00131 FB_EXPORT extern int _fb_pgflush();
00132 FB_EXPORT extern int _fb_disk_enable;
00133 FB_EXPORT extern int fb_sim_readrect(FBIO *ifp, int xmin, int ymin, int width, int height, unsigned char *pp);
00134 FB_EXPORT extern int fb_sim_writerect(FBIO *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp);
00135 FB_EXPORT extern int fb_sim_bwreadrect(FBIO *ifp, int xmin, int ymin, int width, int height, unsigned char *pp);
00136 FB_EXPORT extern int fb_sim_bwwriterect(FBIO *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp);
00137 FB_EXPORT extern int fb_sim_view(FBIO *ifp, int xcenter, int ycenter, int xzoom, int yzoom);
00138 FB_EXPORT extern int fb_sim_getview(FBIO *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom);
00139 FB_EXPORT extern int fb_sim_cursor(FBIO *ifp, int mode, int x, int y);
00140 FB_EXPORT extern int fb_sim_getcursor(FBIO *ifp, int *mode, int *x, int *y);
00141 #else
00142 FB_EXPORT extern FBIO *fb_open();
00143 FB_EXPORT extern int fb_close();
00144 FB_EXPORT extern int fb_genhelp();
00145 FB_EXPORT extern int fb_ioinit();
00146 FB_EXPORT extern int fb_seek();
00147 FB_EXPORT extern int fb_tell();
00148 FB_EXPORT extern int fb_rpixel();
00149 FB_EXPORT extern int fb_wpixel();
00150 FB_EXPORT extern int fb_flush();
00151 FB_EXPORT extern void fb_log();
00152 FB_EXPORT extern int fb_null();
00153 FB_EXPORT extern int fb_null_setcursor();
00154
00155 FB_EXPORT extern int fb_common_file_size();
00156 FB_EXPORT extern int fb_common_image_size();
00157 FB_EXPORT extern int fb_common_name_size();
00158
00159
00160 FB_EXPORT extern int fb_is_linear_cmap();
00161 FB_EXPORT extern void fb_make_linear_cmap();
00162
00163
00164 FB_EXPORT extern int fb_reset();
00165 FB_EXPORT extern int fb_viewport();
00166 FB_EXPORT extern int fb_window();
00167 FB_EXPORT extern int fb_zoom();
00168 FB_EXPORT extern int fb_scursor();
00169
00170
00171
00172
00173
00174 FB_EXPORT extern int _fb_pgin();
00175 FB_EXPORT extern int _fb_pgout();
00176 FB_EXPORT extern int _fb_pgflush();
00177 FB_EXPORT extern int _fb_disk_enable;
00178 FB_EXPORT extern int fb_sim_readrect();
00179 FB_EXPORT extern int fb_sim_writerect();
00180 FB_EXPORT extern int fb_sim_bwreadrect();
00181 FB_EXPORT extern int fb_sim_bwwriterect();
00182 FB_EXPORT extern int fb_sim_view();
00183 FB_EXPORT extern int fb_sim_getview();
00184 FB_EXPORT extern int fb_sim_cursor();
00185 FB_EXPORT extern int fb_sim_getcursor();
00186 #endif
00187
00188 #ifdef IF_X
00189 FB_EXPORT extern int _X24_open_existing();
00190 FB_EXPORT extern int X24_close_existing();
00191 #endif
00192
00193 #ifdef IF_OGL
00194 FB_EXPORT extern int _ogl_open_existing();
00195 FB_EXPORT extern int ogl_close_existing();
00196 #endif
00197
00198 #ifdef IF_WGL
00199 FB_EXPORT extern int _wgl_open_existing();
00200 FB_EXPORT extern int wgl_close_existing();
00201 #endif
00202
00203
00204
00205
00206 #define COPYRGB(to,from) { (to)[RED]=(from)[RED];\
00207 (to)[GRN]=(from)[GRN];\
00208 (to)[BLU]=(from)[BLU]; }
00209
00210
00211
00212
00213
00214
00215 #define FB_WPIXEL(ifp,pp) {if((ifp)->if_pno==-1)_fb_pgin((ifp),(ifp)->if_pixcur/(ifp)->if_ppixels);\
00216 (*((ifp)->if_pcurp+0))=(pp)[0];(*((ifp)->if_pcurp+1))=(pp)[1];(*((ifp)->if_pcurp+2))=(pp)[2];\
00217 (ifp)->if_pcurp+=3;(ifp)->if_pixcur++;(ifp)->if_pdirty=1;\
00218 if((ifp)->if_pcurp>=(ifp)->if_pendp){_fb_pgout((ifp));(ifp)->if_pno= -1;}}
00219
00220
00221 #define FB_DEBUG_BIO 1
00222 #define FB_DEBUG_CMAP 2
00223 #define FB_DEBUG_RW 4
00224 #define FB_DEBUG_BRW 8
00225
00226 #define FB_CKMAG(_ptr, _magic, _str) \
00227 if( !(_ptr) ) { \
00228 fb_log("ERROR: null %s ptr, file %s, line %d\n", \
00229 _str, __FILE__, __LINE__ ); \
00230 abort(); \
00231 } else if( *((long *)(_ptr)) != (_magic) ) { \
00232 fb_log("ERROR: bad %s ptr x%x, s/b x%x, was x%x, file %s, line %d\n", \
00233 _str, _ptr, _magic, \
00234 *((long *)(_ptr)), __FILE__, __LINE__ ); \
00235 abort(); \
00236 }
00237
00238
00239
00240 FB_EXPORT extern void fb_tcl_setup();
00241 #ifdef BRLCAD_DEBUG
00242 FB_EXPORT extern int Fb_d_Init();
00243 #else
00244 FB_EXPORT extern int Fb_Init();
00245 #endif
00246 FB_EXPORT extern int fb_refresh(FBIO *ifp, int x, int y, int w, int h);
00247
00248
00249 FB_EXPORT extern char fb_version[];
00250
00251 #endif
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262