home *** CD-ROM | disk | FTP | other *** search
/ Vectronix 2 / VECTRONIX2.iso / FILES_07 / LATTIC_3.ZIP / HEADERS / LINEA.H < prev    next >
C/C++ Source or Header  |  1990-03-05  |  16KB  |  370 lines

  1. /*
  2.  * linea.h - vdi primitives interface file
  3.  *
  4.  * Started 31/8/89 Alex G. Kiernan
  5.  *
  6.  * Copyright (c) 1989 HiSoft
  7.  */
  8.  
  9. #ifndef _LINEA_H
  10. #define _LINEA_H
  11.  
  12. /* Lattice 3 flavour */
  13. typedef struct linea_info
  14. {
  15.     long li_d0;                /* linea data structure pointer */
  16.     struct la_data *li_a0;    /* linea data structure pointer */
  17.     struct la_font **li_a1;    /* system font vector */
  18.     long (*li_a2)();        /* linea function vector */
  19. } LINEA_INFO;
  20.  
  21. extern struct linea_info la_info;
  22.  
  23. /* Mark Williams flavour */
  24. struct linea_init
  25. {
  26.     long li_d0;                /* linea data structure pointer */
  27.     struct la_data *li_a0;    /* linea data structure pointer */
  28.     struct la_font **li_a1;    /* system font vector */
  29.     long (*li_a2)();        /* linea function vector */
  30. };
  31.  
  32. extern struct linea_init la_init;
  33.  
  34. typedef struct la_data
  35. {
  36.     short ld_vplanes;    /* number of video planes */
  37.     short ld_vwrap;        /* number of bytes/video line */
  38.     short *ld_contrl;    /* pointer to CONTRL array */
  39.     short *ld_intin;    /* pointer to INTIN array */
  40.     short *ld_ptsin;    /* pointer to PTSIN array */
  41.     short *ld_intout;    /* pointer to INTOUT array */
  42.     short *ld_ptsout;    /* pointer to PTSOUT array */
  43.     short ld_colbit[4];    /* colour bit-plane[i] value */
  44.     short ld_lstlin;    /* plot last pixel flag */
  45.     short ld_lnmask;    /* line-style mask */
  46.     short ld_wmode;        /* writing mode 0:replace, 1:transparent,
  47.                            2:exclusive OR, 3:inverse transparent */
  48.     short ld_x1;        /* X1 coordinate */
  49.     short ld_y1;        /* Y1 coordinate */
  50.     short ld_x2;        /* X2 coordinate */
  51.     short ld_y2;        /* Y2 coordinate */
  52.     short *ld_patptr;    /* fill pattern pointer */
  53.     short ld_patmsk;    /* fill pattern mask */
  54.     short ld_mfill;        /* multi-plane fill flag */
  55.     short ld_clip;        /* clipping flag */
  56.     short ld_xmincl;    /* minimum X clipping value */
  57.     short ld_ymincl;    /* minimum Y clipping value */
  58.     short ld_xmaxcl;    /* maximum X clipping value */
  59.     short ld_ymaxcl;    /* maximum Y clipping value */
  60.     short ld_xdda;        /* accumulator for textblt dda */
  61.     short ld_ddainc;    /* fixed point scale factor */
  62.     short ld_scaldir;    /* scale direction flag */
  63.     short ld_mono;        /* current font is monospaced */
  64.     short ld_srcx;        /* X coord of character in font */
  65.     short ld_srcy;        /* Y coord of character in font */
  66.     short ld_dstx;        /* X coord of character on screen */
  67.     short ld_dsty;        /* Y coord of character on screen */
  68.     short ld_delx;        /* width of character */
  69.     short ld_dely;        /* height of character */
  70.     void *ld_fbase;        /* pointer to start of font form */
  71.     short ld_fwidth;    /* width of font form */
  72.     short ld_style;        /* textblt special effects flags */
  73.     short ld_litemsk;    /* lightening mask */
  74.     short ld_skewmsk;    /* skewing mask */
  75.     short ld_weight;    /* thickening factor */
  76.     short ld_roff;        /* skew offset above baseline */
  77.     short ld_loff;        /* skew offset below baseline */
  78.     short ld_scale;        /* scaling flag */
  79.     short ld_chup;        /* character rotation vector */
  80.     short ld_textfg;    /* text foreground colour */
  81.     void *ld_scrtchp;    /* text special effects buffer */
  82.     short ld_scrpt2;    /* offset to scaling buffer from above */
  83.     short ld_textbg;    /* text background colour */
  84.     short ld_copytran;    /* copy raster form type flag */
  85.     int (*ld_seedabort)(void);    /* seedfill end detect function */
  86. } LA_DATA;
  87.  
  88. typedef struct la_ext
  89. {
  90.     long ld_resvd1;
  91.     struct la_font *ld_cur_font;    /* pointer to current font header */
  92.     short ld_resvd2[23];
  93.     short ld_m_pos_hx;                /* mouse x hot spot */
  94.     short ld_m_pos_hy;                /* mouse y hot spot */
  95.     short ld_m_planes;                /* writing mode for mouse */
  96.     short ld_m_cdb_bg;                /* mouse background colour */
  97.     short ld_m_cdb_fg;                /* mouse foreground colour */
  98.     short ld_mask_form[32];            /* mouse mask and form */
  99.     short ld_inq_tab[45];            /* vq_extnd information */
  100.     short ld_dev_tab[45];            /* v_opnwk information */
  101.     short ld_gcurx;                    /* current mouse x position */
  102.     short ld_gcury;                    /* current mouse x position */
  103.     short ld_m_hid_ct;                /* mouse hide count */
  104.     short ld_mouse_bt;                /* mouse button status */
  105.     short ld_req_col[3][16];        /* internal vq_color lookup */
  106.     short ld_siz_tab[15];            /* current text, line and marker sizes */
  107.     short ld_resvd3;
  108.     short ld_resvd4;
  109.     short *ld_cur_work;                /* current vwork attributes */
  110.     struct la_font *ld_def_font;    /* default font header */
  111.     struct la_font *ld_font_ring[4];/* vdi font ring */
  112.     short ld_font_count;            /* number of fonts in font ring */
  113.     short ld_resvd5[45];
  114.     unsigned char ld_cur_ms_stat;    /* mouse status */
  115.     char ld_resvd6;
  116.     short ld_v_hid_cnt;                /* cursor hide count */
  117.     short ld_cur_x;                    /* mouse x position */
  118.     short ld_cur_y;                    /* mouse y position */
  119.     char ld_cur_flag;                /* mouse draw status */
  120.     char ld_mouse_flag;                /* mouse processing enabled */
  121.     long ld_resvd7;
  122.     short ld_v_sav_xy[2];            /* saved cursor xy position */
  123.     short ld_save_len;                /* height of saved form */
  124.     short *ld_save_addr;            /* screen address of saved form */
  125.     short ld_save_stat;                /* save status */
  126.     long ld_save_area[4][16];        /* form save area */
  127.     void (*ld_user_tim)();            /* user timer vector */
  128.     void (*ld_next_tim)();            /* next timer vector */
  129.     void (*ld_user_but)();            /* user button vector */
  130.     void (*ld_user_cur)();            /* user cursor vector */
  131.     void (*ld_user_mot)();            /* user motion vector */
  132.     short ld_cel_ht;                /* cell height */
  133.     short ld_cel_mx;                /* max x cells */
  134.     short ld_cel_my;                /* max y cells */
  135.     short ld_cel_wr;                /* displacement to next vertical cell */
  136.     short ld_col_bg;                /* background colour index */
  137.     short ld_col_fg;                /* foreground colour index */
  138.     void *ld_cur_ad;                /* cursor address */
  139.     short ld_cur_off;                /* offset to first cell */
  140.     short ld_cur_xy[2];                /* cursor xy position */
  141.     char ld_cur_cnt;                /* cursor flash period */
  142.     char ld_cur_tim;                /* cursor flash countdown */
  143.     void *ld_fnt_ad;                /* address of font data */
  144.     short ld_fnt_nd;                /* last ade in font */
  145.     short ld_fnt_st;                /* first ade in font */
  146.     short ld_fnt_wr;                /* font form width */
  147.     short ld_x_max;                    /* horizontal pixel resolution */
  148.     void *ld_off_ad;                /* pointer to font offset table */
  149.     short ld_status;                /* cursor status */
  150.     short ld_y_max;                    /* vertical pixel resolution */
  151.     short ld_bytes_lin;                /* width of destination form */
  152. } LA_EXT;
  153.  
  154. /* Lattice 3 compatability macros */
  155. #define VPLANES    la_info.li_a0->ld_vplanes
  156. #define VWRAP    la_info.li_a0->ld_vwrap
  157. #define CONTRL    la_info.li_a0->ld_contrl
  158. #define INTIN    la_info.li_a0->ld_intin
  159. #define PTSIN    la_info.li_a0->ld_ptsin
  160. #define INTOUT    la_info.li_a0->ld_intout
  161. #define PTSOUT    la_info.li_a0->ld_ptsout
  162. #define COLBIT0    la_info.li_a0->ld_colbit[0]
  163. #define COLBIT1    la_info.li_a0->ld_colbit[1]
  164. #define COLBIT2    la_info.li_a0->ld_colbit[2]
  165. #define COLBIT3    la_info.li_a0->ld_colbit[3]
  166. #define LSTLIN    la_info.li_a0->ld_lstlin
  167. #define LNMASK    la_info.li_a0->ld_lnmask
  168. #define WMODE    la_info.li_a0->ld_wmode
  169. #define X1        la_info.li_a0->ld_x1
  170. #define Y1        la_info.li_a0->ld_y1
  171. #define X2        la_info.li_a0->ld_x2
  172. #define Y2        la_info.li_a0->ld_y2
  173. #define PATPTR    la_info.li_a0->ld_patptr
  174. #define PATMSK    la_info.li_a0->ld_patmsk
  175. #define MFILL    la_info.li_a0->ld_mfill
  176. #define CLIP    la_info.li_a0->ld_clip
  177. #define XMINCL    la_info.li_a0->ld_xmincl
  178. #define YMINCL    la_info.li_a0->ld_ymincl
  179. #define XMAXCL    la_info.li_a0->ld_xmaxcl
  180. #define YMAXCL    la_info.li_a0->ld_ymaxcl
  181. #define XDDA    la_info.li_a0->ld_xdda
  182. #define DDAINC    la_info.li_a0->ld_ddainc
  183. #define SCALDIR    la_info.li_a0->ld_scaldir
  184. #define MONO    la_info.li_a0->ld_mono
  185. #define SRCX    la_info.li_a0->ld_srcx
  186. #define SRCY    la_info.li_a0->ld_srcy
  187. #define DSTX    la_info.li_a0->ld_dstx
  188. #define DSTY    la_info.li_a0->ld_dsty
  189. #define DELX    la_info.li_a0->ld_delx
  190. #define DELY    la_info.li_a0->ld_dely
  191. #define FBASE    la_info.li_a0->ld_fbase
  192. #define FWIDTH    la_info.li_a0->ld_fwidth
  193. #define STYLE    la_info.li_a0->ld_style
  194. #define LITEMSK    la_info.li_a0->ld_litemsk
  195. #define SKEWMSK    la_info.li_a0->ld_skewmsk
  196. #define WEIGHT    la_info.li_a0->ld_weight
  197. #define ROFF    la_info.li_a0->ld_roff
  198. #define LOFF    la_info.li_a0->ld_loff
  199. #define SCALE    la_info.li_a0->ld_scale
  200. #define CHUP    la_info.li_a0->ld_chup
  201. #define TEXTFG    la_info.li_a0->ld_textfg
  202. #define SCRTCHP    la_info.li_a0->ld_scrtchp
  203. #define SCRPT2    la_info.li_a0->ld_scrpt2
  204. #define TEXTBG    la_info.li_a0->ld_textbg
  205. #define COPYTRAN    la_info.li_a0->ld_copytran
  206. #define SEEDABORT    la_info.li_a0->ld_seedabort
  207.  
  208. #define V_CUR_FONT    ((LA_EXT *)la_info.li_a0-1)->ld_cur_font
  209. #define V_M_POS_HX    ((LA_EXT *)la_info.li_a0-1)->ld_m_pos_hx
  210. #define V_M_POS_HY    ((LA_EXT *)la_info.li_a0-1)->ld_m_pos_hy
  211. #define V_M_PLANES    ((LA_EXT *)la_info.li_a0-1)->ld_m_planes
  212. #define V_M_CDB_BG    ((LA_EXT *)la_info.li_a0-1)->ld_m_cdb_bg
  213. #define V_M_CDB_FG    ((LA_EXT *)la_info.li_a0-1)->ld_m_cdb_fg
  214. #define V_MASK_FORM    ((LA_EXT *)la_info.li_a0-1)->ld_mask_form
  215. #define V_INQ_TAB    ((LA_EXT *)la_info.li_a0-1)->ld_inq_tab
  216. #define V_DEV_TAB    ((LA_EXT *)la_info.li_a0-1)->ld_dev_tab
  217. #define V_GCURX    ((LA_EXT *)la_info.li_a0-1)->ld_gcurx
  218. #define V_GCURY    ((LA_EXT *)la_info.li_a0-1)->ld_gcury
  219. #define V_M_HID_CT    ((LA_EXT *)la_info.li_a0-1)->ld_m_hid_ct
  220. #define V_MOUSE_BT    ((LA_EXT *)la_info.li_a0-1)->ld_mouse_bt
  221. #define V_REQ_COL    ((LA_EXT *)la_info.li_a0-1)->ld_req_col
  222. #define V_SIZ_TAB    ((LA_EXT *)la_info.li_a0-1)->ld_siz_tab
  223. #define V_CUR_WORK    ((LA_EXT *)la_info.li_a0-1)->ld_cur_work
  224. #define V_DEF_FONT    ((LA_EXT *)la_info.li_a0-1)->ld_def_font
  225. #define V_FONT_RING    ((LA_EXT *)la_info.li_a0-1)->ld_font_ring
  226. #define V_FONT_COUNT    ((LA_EXT *)la_info.li_a0-1)->ld_font_count
  227. #define V_CUR_MS_STAT    ((LA_EXT *)la_info.li_a0-1)->ld_cur_ms_stat
  228. #define V_V_HID_CNT    ((LA_EXT *)la_info.li_a0-1)->ld_v_hid_cnt
  229. #define V_CUR_X    ((LA_EXT *)la_info.li_a0-1)->ld_cur_x
  230. #define V_CUR_Y    ((LA_EXT *)la_info.li_a0-1)->ld_cur_y
  231. #define V_CUR_FLAG    ((LA_EXT *)la_info.li_a0-1)->ld_cur_flag
  232. #define V_MOUSE_FLAG    ((LA_EXT *)la_info.li_a0-1)->ld_mouse_flag
  233. #define V_V_SAV_XY    ((LA_EXT *)la_info.li_a0-1)->ld_v_sav_xy
  234. #define V_SAVE_LEN    ((LA_EXT *)la_info.li_a0-1)->ld_save_len
  235. #define V_SAVE_ADDR    ((LA_EXT *)la_info.li_a0-1)->ld_save_addr
  236. #define V_SAVE_STAT    ((LA_EXT *)la_info.li_a0-1)->ld_save_stat
  237. #define V_SAVE_AREA    ((LA_EXT *)la_info.li_a0-1)->ld_save_area
  238. #define V_USER_TIM    ((LA_EXT *)la_info.li_a0-1)->ld_user_tim
  239. #define V_NEXT_TIM    ((LA_EXT *)la_info.li_a0-1)->ld_next_tim
  240. #define V_USER_BUT    ((LA_EXT *)la_info.li_a0-1)->ld_user_but
  241. #define V_USER_CUR    ((LA_EXT *)la_info.li_a0-1)->ld_user_cur
  242. #define V_USER_MOT    ((LA_EXT *)la_info.li_a0-1)->ld_user_mot
  243. #define V_CEL_HT    ((LA_EXT *)la_info.li_a0-1)->ld_cel_ht
  244. #define V_CEL_MX    ((LA_EXT *)la_info.li_a0-1)->ld_cel_mx
  245. #define V_CEL_MY    ((LA_EXT *)la_info.li_a0-1)->ld_cel_my
  246. #define V_CEL_WR    ((LA_EXT *)la_info.li_a0-1)->ld_cel_wr
  247. #define V_COL_BG    ((LA_EXT *)la_info.li_a0-1)->ld_col_bg
  248. #define V_COL_FG    ((LA_EXT *)la_info.li_a0-1)->ld_col_fg
  249. #define V_CUR_AD    ((LA_EXT *)la_info.li_a0-1)->ld_cur_ad
  250. #define V_CUR_OFF    ((LA_EXT *)la_info.li_a0-1)->ld_cur_off
  251. #define V_CUR_CX    ((LA_EXT *)la_info.li_a0-1)->ld_cur_xy[0]
  252. #define V_CUR_CY    ((LA_EXT *)la_info.li_a0-1)->ld_cur_xy[1]
  253. #define V_CUR_CNT    ((LA_EXT *)la_info.li_a0-1)->ld_cur_cnt
  254. #define V_CUR_TIM    ((LA_EXT *)la_info.li_a0-1)->ld_cur_tim
  255. #define V_FNT_AD    ((LA_EXT *)la_info.li_a0-1)->ld_fnt_ad
  256. #define V_FNT_ND    ((LA_EXT *)la_info.li_a0-1)->ld_fnt_nd
  257. #define V_FNT_ST    ((LA_EXT *)la_info.li_a0-1)->ld_fnt_st
  258. #define V_FNT_WR    ((LA_EXT *)la_info.li_a0-1)->ld_fnt_wr
  259. #define V_X_MAX        ((LA_EXT *)la_info.li_a0-1)->ld_x_max
  260. #define V_OFF_AD    ((LA_EXT *)la_info.li_a0-1)->ld_off_ad
  261. #define V_STATUS    ((LA_EXT *)la_info.li_a0-1)->ld_status
  262. #define V_Y_MAX    ((LA_EXT *)la_info.li_a0-1)->ld_y_max
  263. #define BYTES_LIN    ((LA_EXT *)la_info.li_a0-1)->ld_bytes_lin
  264.  
  265. #define putpixel(x,y,v)    ((PTSIN[0]=(x)),(PTSIN[1]=(y)),(INTIN[0]=(v)),linea1())
  266. #define getpixel(x,y)    ((PTSIN[0]=(x)),(PTSIN[1]=(y)),linea2())
  267. #define showmouse(show)    (INTIN[0]=show,linea9())
  268. #define hidemouse()    lineaa()
  269. #define mousehidden    (V_M_HID_CT)
  270.  
  271. typedef struct la_blk
  272. {
  273.     short bl_xmin;    /* minimum x */
  274.     short bl_ymin;    /* minimum y */
  275.     short *bl_form;    /* word aligned memory form */
  276.     short bl_nxwd;    /* offset to next word in line */
  277.     short bl_nxln;    /* offset to next line in plane */
  278.     short bl_nxpl;    /* offset to next plane */
  279. } LA_BLK;
  280.  
  281. typedef struct la_blit
  282. {
  283.     short bb_b_wd;        /* width of block in pixels */
  284.     short bb_b_ht;        /* height of block in pixels */
  285.     short bb_plane_ct;    /* number of planes to blit */
  286.     short bb_fg_col;    /* foreground colour */
  287.     short bb_bg_col;    /* background colour */
  288.     char bb_op_tab[4];    /* Logic for fg x bg combination */
  289.     struct la_blk bb_s;    /* source info block */
  290.     struct la_blk bb_d;    /* destination info block */
  291.     short *bb_p_addr;    /* pattern buffer address */
  292.     short bb_p_nxln;    /* offset to next line in pattern */
  293.     short bb_p_nxpl;    /* offset to next plane in pattern */
  294.     short bb_p_mask;    /* pattern index mask */
  295.     char bb_fill[24];    /* work space */
  296. } LA_BLIT;
  297.  
  298. typedef struct la_sprite
  299. {
  300.     short ls_xhot;        /* X hot spot offset */
  301.     short ls_yhot;        /* Y hot spot offset */
  302.     short ls_form;        /* 1 for VDI, -1 for XOR */
  303.     short ls_bgcol;        /* background colour index */
  304.     short ls_fgcol;        /* foreground colour index */
  305.     short ls_image[32];    /* background/foreground interleaved image */
  306. } LA_SPRITE;
  307.  
  308. typedef struct la_font
  309. {
  310.     short font_id;                /* face identifier */
  311.     short font_size;            /* font size in points */
  312.     char font_name[32];            /* face name */
  313.     short font_low_ade;            /* lowest ASCII value in face */
  314.     short font_hi_ade;            /* highest ASCII value in face */
  315.     short font_top_dst;            /* top line distance */
  316.     short font_ascent_dst;        /* ascent line distance */
  317.     short font_half_dst;        /* half line distance */
  318.     short font_descent_dst;        /* descent line distance */
  319.     short font_bottom_dist;        /* bottom line distance */
  320.     short font_fatest;            /* width of widest char in font */
  321.     short font_fat_cell;        /* width of widest char cell in font */
  322.     short font_left_off;        /* left offset */
  323.     short font_right_off;        /* right offset */
  324.     short font_thickening;         /* no. of pixels to widen chars */
  325.     short font_underline;        /* width in pixels of underline */
  326.     short font_lightening;         /* mask used to drop pixels out */
  327.     short font_skewing;            /* mask used to determine skewing */
  328.     short font_flags;            /* font flags */
  329.     short *font_horiz_off;         /* pointer to horizontal offset table */
  330.     short *font_char_off;        /* pointer to char offset table */
  331.     void *font_data;            /* pointer to font data */
  332.     short font_width;            /* font width */
  333.     short font_height;            /* font height */
  334.     struct la_font *font_next;    /* pointer to next font */
  335. } LA_FONT;
  336.  
  337. struct la_data *linea0(void);
  338. void linea1(void);
  339. short linea2(void);
  340. void linea3(void);
  341. void linea4(void);
  342. void linea5(void);
  343. void linea6(void);
  344. void linea7(LA_BLIT *);
  345. void linea8(void);
  346. void linea9(void);
  347. void lineaa(void);
  348. void lineab(void);
  349. void lineac(void *);
  350. void linead(int,int,LA_SPRITE *,void *);
  351. void lineae(void);
  352. void lineaf(void);
  353.  
  354. #pragma inline linea1()    {register a2,d2; "a001";}
  355. #pragma inline d0=linea2()    {register a2,d2; "a002";}
  356. #pragma inline linea3()    {register a2,d2; "a003";}
  357. #pragma inline linea4()    {register a2,d2; "a004";}
  358. #pragma inline linea5()    {register a2,d2; "a005";}
  359. #pragma inline linea6()    {register a2,d2; "a006";}
  360. #pragma inline linea7(a6)    {register a2,d2; "a007";}
  361. #pragma inline linea8()    {register a2,d2; "a008";}
  362. #pragma inline linea9()    {register a2,d2; "a009";}
  363. #pragma inline lineaa()    {register a2,d2; "a00a";}
  364. #pragma inline lineab()    {register a2,d2; "a00b";}
  365. #pragma inline lineac(a2)    {register a2,d2,a6; "a00c";}
  366. #pragma inline linead(d0,d1,a0,a2)    {register d2,a6; "a00d";}
  367. #pragma inline lineae()    {register a2,d2; "a00e";}
  368. #pragma inline lineaf()    {register a2,d2; "a00f";}
  369. #endif
  370.