1 /* rec_history.h -- average position, size, and orientation of recent strokes
2 
3    Copyright 2001 Carl Worth
4 
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 2, or (at your option)
8    any later version.
9 
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14 */
15 
16 #ifndef REC_HISTORY_H
17 #define REC_HISTORY_H
18 
19 /* need pt_t */
20 #include "stroke.h"
21 
22 #define RH_POS_SAMPLES 3
23 #define RH_SIZE_SAMPLES RH_POS_SAMPLES
24 #define RH_ORIENTATION_SAMPLES 3
25 struct rec_history
26 {
27     int x;
28     int y;
29     int width;
30     int height;
31     double orientation;
32 
33     int x_history[RH_POS_SAMPLES];
34     int y_history[RH_POS_SAMPLES];
35     int width_history[RH_SIZE_SAMPLES];
36     int height_history[RH_SIZE_SAMPLES];
37     double orientation_history[RH_ORIENTATION_SAMPLES];
38 };
39 typedef struct rec_history rec_history_t;
40 
41 int rec_history_init(rec_history_t *history, int x, int y,
42 		     int width, int height,
43 		     double orientation);
44 void rec_history_deinit(rec_history_t *history);
45 
46 void rec_history_rotate_for_orientation(rec_history_t *history, int *x, int *y);
47 
48 void rec_history_update_position(rec_history_t *history, int x, int y);
49 void rec_history_update_size(rec_history_t *history, int width, int height);
50 void rec_history_nudge_orientation(rec_history_t *history, double correction);
51 
52 #endif
53 
54