Clickable Image Map
-- Rectangle
Brandon 1) 640x480x256 --> add to graphlib in assy
a) void vga_mode(void);
b) void plot_cpixel (int x, int y, int color);
Joel 2) read mouse coordinates in assy (int 33)
Brent a) draw coordinates on screen, top left
b) void draw_coord(int x, int y)
c) Font -- 0-9, comma, parentheses, dash -- in assy
Brandon 3) draw rectangle in assy; write code to "grow/shrink" rectangle upon demand
a) void draw_rect (int startx, int starty, int endx, int endy, int color);
Brent 4) file handling in C
a) read GIF89a; GIF87a if possible
1) void read_gif(file *filename);
b) write text data
2) void write_table (file *filename);
Joel 6) User Interface in C
a) Keypress Interface
char scan_keyboard(
2) 's' -- Save Table -- basename.map
3) 'c' -- Close Picture/Table
4) 'F1' -- help (text mode)
5) 'ESC' -- cancel last click; program resets pixel
b) user selects region by clicking mouse at start and end points.
1) user clicks right mouse button to verify region
/* prototypes */
int main(int argc, char *argv[]);
char *get_filename(void);
int read_gif(char *filename);
struct clicks scan_mouse(void);
void draw_coord(int xval, int yval, int position, int color); /* position 1==left, 2==mid, 3==right */
void draw_rect(int startx, int starty, int endx, int endy, int color);
char scan_keyboard(void);
int close_gif(char *filename);
int save_table(char *filename);
void help(void);
int clear_last_click(struct clicks *clktable);
/* declarations */
struct clicks {
int startx;
int starty;
int endx;
int endy;
int current_click;
struct clicks *next;
} *head;
/* high-level procedure */
main() {
top:
print "1 to open, 2 to quit"
if 2 then return 0;
get_filename()
read_gif()
{
/* display_gif() -- not a function */
}
loop:
scan_mouse()
{
if right_click, save table info
if left_click, save click info (coord)
if movement, move mouse
draw_coord()
draw_rect()
}
/* scan_keyboard() -- not a function */
if keypress, process
if 'c' {
close_gif()
/* close_table() -- not a function */
}
if 's' { save_table() }
if 'F1' { help() }
if 'ESC' { clear_last_click(); draw_coord(); draw_rect(); }
}
repeat until scan_keyboard == 'c'
jump back to top