Rev 1091 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1091 | pj | 1 | /* |
2 | * Project: S.Ha.R.K. |
||
3 | * |
||
4 | * Coordinators: |
||
5 | * Giorgio Buttazzo <giorgio@sssup.it> |
||
6 | * Paolo Gai <pj@gandalf.sssup.it> |
||
7 | * |
||
8 | * Authors : |
||
9 | * Paolo Gai <pj@gandalf.sssup.it> |
||
10 | * Massimiliano Giorgi <massy@gandalf.sssup.it> |
||
11 | * Luca Abeni <luca@gandalf.sssup.it> |
||
12 | * (see the web pages for full authors list) |
||
13 | * |
||
14 | * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
||
15 | * |
||
16 | * http://www.sssup.it |
||
17 | * http://retis.sssup.it |
||
18 | * http://shark.sssup.it |
||
19 | */ |
||
20 | |||
1448 | giacomo | 21 | /* CVS : $Id: fab_grx.h,v 1.3 2004-05-23 08:59:28 giacomo Exp $ */ |
1091 | pj | 22 | |
23 | /* |
||
24 | * Copyright (C) 2000 Fabio Calabrese <fabiocalabrese77@yahoo.it> |
||
25 | * |
||
26 | * This program is free software; you can redistribute it and/or modify |
||
27 | * it under the terms of the GNU General Public License as published by |
||
28 | * the Free Software Foundation; either version 2 of the License, or |
||
29 | * (at your option) any later version. |
||
30 | * |
||
31 | * This program is distributed in the hope that it will be useful, |
||
32 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
33 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
34 | * GNU General Public License for more details. |
||
35 | * |
||
36 | * You should have received a copy of the GNU General Public License |
||
37 | * along with this program; if not, write to the Free Software |
||
38 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||
39 | * |
||
40 | */ |
||
41 | |||
42 | /**************************************************** |
||
43 | * * |
||
44 | * file: FAB_grx.h * |
||
45 | * libreria: FAB_LIB * |
||
46 | * version: 1.0 25/08/2002 * |
||
47 | * creato da: Fabio CALABRESE * |
||
48 | * * |
||
49 | **************************************************** |
||
50 | * * |
||
51 | * descrizione: libreria di funzioni grafiche: * |
||
52 | * permette di gestire con facilita' * |
||
53 | * immagini, cornici, e veri e propri * |
||
54 | * pannelli colorati. * |
||
55 | * Il contesto di grafica va avviato * |
||
56 | * con FAB_grx_open() e alla fine * |
||
57 | * chiuso correttamente con la funz. * |
||
58 | * FAB_grx_close(). L'ambiente di * |
||
59 | * grafica e'impostato a 16bit per * |
||
60 | * default, comunque e' sempre * |
||
61 | * possibile scegliere la profondita' * |
||
62 | * di colori preferita tra 15/16/24/32* |
||
63 | * definendo semplicemente solo una * |
||
64 | * delle seguenti costanti all'inizio * |
||
65 | * del proprio programma che include * |
||
66 | * questa libreria grafica: * |
||
67 | * FAB_GRX_15 * |
||
68 | * FAB_GRX_16 (default) * |
||
69 | * FAB_GRX_24 * |
||
70 | * FAB_GRX_32 * |
||
71 | * * |
||
72 | ****************************************************/ |
||
73 | |||
74 | #ifndef __FAB_LIB_fab_grx_h__ |
||
75 | #define __FAB_LIB_fab_grx_h__ |
||
76 | //-------------------BEGIN--------------------------- |
||
77 | |||
78 | // *** Librerie di S.Ha.R.K. *** |
||
1448 | giacomo | 79 | #include <kernel/kern.h> |
80 | #include <ll/sys/types.h> |
||
81 | |||
82 | #include <drivers/shark_fb26.h> |
||
83 | |||
1091 | pj | 84 | // *** Librerie Standard C *** |
85 | // *** Librerie FAB *** |
||
86 | #include"fab_grx.sys" |
||
87 | |||
88 | //#define FAB_GRX_15 |
||
89 | //#define FAB_GRX_16 |
||
90 | //#define FAB_GRX_24 |
||
91 | //#define FAB_GRX_32 |
||
92 | |||
93 | typedef __FAB_COLOR COLOR; |
||
94 | |||
95 | typedef struct { |
||
96 | WORD lx,ly; |
||
97 | COLOR * buf; |
||
98 | int trasparent; |
||
99 | COLOR trasparent_col; |
||
100 | } FAB_IMAGE; |
||
101 | |||
102 | typedef struct { |
||
103 | WORD dim; |
||
104 | COLOR * buf; |
||
105 | } FAB_BORDER; |
||
106 | |||
107 | typedef struct { |
||
108 | FAB_BORDER * border; //default = NULL |
||
109 | WORD border_dim; //default = 0 |
||
110 | COLOR border_col; |
||
111 | |||
112 | BYTE trasparent; //default = 0 |
||
113 | FAB_IMAGE * image; //default = NULL |
||
114 | COLOR color; |
||
115 | |||
116 | WORD x0,y0,x1,y1; //spigoli pannello interno |
||
117 | //cornice esclusa: vengono settati |
||
118 | //automaticamente con FAB_frame_put(). |
||
119 | } FAB_FRAME; |
||
120 | typedef struct { |
||
121 | FAB_BORDER * border; //default = NULL |
||
122 | WORD border_dim; //default = 0 |
||
123 | COLOR border_col; |
||
124 | |||
125 | BYTE trasparent; //default = 0 |
||
126 | COLOR color; |
||
127 | |||
128 | WORD cx,cy,r; //centro e raggio del pannello |
||
129 | //circolare: vengono settati |
||
130 | //automaticamente con FAB_ballframe_put(). |
||
131 | } FAB_BALLFRAME; |
||
132 | |||
133 | // ----------- |
||
134 | // Definizioni |
||
135 | //---------------------- |
||
136 | #define FAB_BPP __FAB_BPP |
||
137 | #define FAB_rgb(R24,G24,B24) __FAB_rgb((R24),(G24),(B24)) |
||
138 | |||
139 | // Colori base |
||
140 | #define FAB_white FAB_rgb(255,255,255) |
||
141 | #define FAB_black FAB_rgb( 0, 0, 0) |
||
142 | #define FAB_red FAB_rgb(255, 0, 0) |
||
143 | #define FAB_green FAB_rgb( 0,255, 0) |
||
144 | #define FAB_blue FAB_rgb( 0, 0,255) |
||
145 | #define FAB_yellow FAB_rgb(255,255, 0) |
||
146 | #define FAB_gray FAB_rgb(100,100,100) |
||
147 | |||
148 | //---------------------- |
||
149 | |||
150 | // ---------------- |
||
151 | // Funzioni & Macro |
||
152 | //-------------------------------------------------- |
||
153 | int FAB_grx_open(WORD lx, WORD ly); |
||
154 | void FAB_grx_close(); |
||
155 | |||
156 | FAB_IMAGE* FAB_image_alloc(WORD lx, WORD ly); //richiede DISABLED INTERRUPTS |
||
157 | void FAB_image_free(FAB_IMAGE* image); //richiede DISABLED INTERRUPTS |
||
158 | FAB_BORDER* FAB_border_alloc(WORD dim); //richiede DISABLED INTERRUPTS |
||
159 | void FAB_border_free(FAB_BORDER * border);//richiede DISABLED INTERRUPTS |
||
160 | FAB_FRAME* FAB_frame_alloc(); //richiede DISABLED INTERRUPTS |
||
161 | void FAB_frame_free(FAB_FRAME * frame); //richiede DISABLED INTERRUPTS |
||
162 | FAB_BALLFRAME* FAB_ballframe_alloc(); //richiede DISABLED INTERRUPTS |
||
163 | void FAB_ballframe_free(FAB_BALLFRAME * frame);//richiede DISABLED INTERRUPTS |
||
164 | |||
165 | // Permette di riempire lo spazio allocato ad un FAB_IMAGE |
||
166 | // leggendo le sequenze rgb a 24bit da un file immagine binario. |
||
167 | // Un formato perfettamente compatibile Š quello |
||
168 | // "RAW"(con header=0 e sequenza ad ordinamento RGB-RGB-RGB...): |
||
169 | int FAB_image_load(FAB_IMAGE* image, char* file_name); // solo in __kernel_register_levels__() |
||
170 | // Per default un FAB_IMAGE non ha il colore di trasparenza: |
||
171 | #define FAB_image_no_trasparent_set(IMAGE) (IMAGE)->trasparent=0 |
||
172 | #define FAB_image_trasparent_set(IMAGE,TRASPARENT_COL) (IMAGE)->trasparent=1;(IMAGE)->trasparent_col=(TRASPARENT_COL) |
||
173 | |||
174 | // Settaggio FAB_BORDER deve essere fatto manualmente! |
||
175 | // esempio: |
||
176 | // mio_border->buf[i] = FAB_rgb(0,100,0); |
||
177 | // ... |
||
178 | // mio_border->buf[N] = FAB_rgb(0,100,255); |
||
179 | // (non esiste una funzione FAB_border_set) |
||
180 | |||
181 | #define FAB_frame_border_set(FRAME,BORDER,BORDER_DIM,BORDER_COL) (FRAME)->border=(BORDER);(FRAME)->border_dim=(BORDER_DIM);(FRAME)->border_col=(BORDER_COL); |
||
182 | #define FAB_frame_color_set(FRAME,TRASPARENT_FLAG,IMAGE,COLOR) (FRAME)->trasparent=(TRASPARENT_FLAG);(FRAME)->image=(IMAGE);(FRAME)->color=(COLOR); |
||
183 | #define FAB_ballframe_border_set(FRAME,BORDER,BORDER_DIM,BORDER_COL) (FRAME)->border=(BORDER);(FRAME)->border_dim=(BORDER_DIM);(FRAME)->border_col=(BORDER_COL); |
||
184 | #define FAB_ballframe_color_set(FRAME,TRASPARENT_FLAG,COLOR) (FRAME)->trasparent=(TRASPARENT_FLAG);(FRAME)->color=(COLOR); |
||
185 | |||
186 | void FAB_ball_put(WORD cx, WORD cy, WORD r, COLOR c); |
||
187 | void FAB_image_get(FAB_IMAGE* image, WORD x, WORD y, WORD lx, WORD ly); |
||
188 | void FAB_image_put(FAB_IMAGE* image, WORD x, WORD y); |
||
189 | void FAB_image_put_within(FAB_IMAGE* image, WORD x0, WORD y0, |
||
190 | WORD xx0, WORD yy0, WORD xx1, WORD yy1); |
||
191 | void FAB_image_copy(FAB_IMAGE* orig_image, FAB_IMAGE* dest_image); |
||
192 | void FAB_image_color_change(FAB_IMAGE* image, COLOR old_col, COLOR new_col); |
||
193 | void FAB_image_fill(FAB_IMAGE* image, WORD x0, WORD y0, WORD lx, WORD ly); |
||
194 | void FAB_border_put(FAB_BORDER* border, WORD x0, WORD y0, WORD x1, WORD y1); |
||
195 | void FAB_ballborder_put(FAB_BORDER* border, WORD cx, WORD cy, WORD r_int); |
||
196 | void FAB_frame_put(FAB_FRAME* frame, WORD x0, WORD y0, WORD lx, WORD ly); |
||
197 | void FAB_ballframe_put(FAB_BALLFRAME* frame, WORD cx, WORD cy, WORD r); |
||
198 | //-------------------------------------------------- |
||
199 | |||
200 | // Altro... |
||
201 | |||
202 | //---------------------END--------------------------- |
||
203 | #endif |