Move the sources to trunk
[opencv] / otherlibs / _fltk / include / FL / fl_draw.H
1 //
2 // "$Id: fl_draw.H,v 1.2 2002/12/01 15:38:37 neurosurg Exp $"
3 //
4 // Portable drawing function header file for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2002 by Bill Spitzak and others.
7 //
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Library General Public
10 // License as published by the Free Software Foundation; either
11 // version 2 of the License, or (at your option) any later version.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 // Library General Public License for more details.
17 //
18 // You should have received a copy of the GNU Library General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21 // USA.
22 //
23 // Please report all bugs and problems to "fltk-bugs@fltk.org".
24 //
25
26 #ifndef fl_draw_H
27 #define fl_draw_H
28
29 #include "Enumerations.H"  // for the color names
30
31 // Image class...
32 class Fl_Image;
33
34 // Label flags...
35 FL_EXPORT extern char fl_draw_shortcut;
36
37 // Colors:
38 FL_EXPORT void  fl_color(Fl_Color); // select indexed color
39 inline void fl_color(int c) {fl_color((Fl_Color)c);} // for back compatability
40 FL_EXPORT void  fl_color(uchar, uchar, uchar); // select actual color
41 extern FL_EXPORT Fl_Color fl_color_;
42 inline Fl_Color fl_color() {return fl_color_;}
43
44 // clip:
45 FL_EXPORT void fl_push_clip(int x, int y, int w, int h);
46 #define fl_clip fl_push_clip
47 FL_EXPORT void fl_push_no_clip();
48 FL_EXPORT void fl_pop_clip();
49 FL_EXPORT int fl_not_clipped(int x, int y, int w, int h);
50 FL_EXPORT int fl_clip_box(int, int, int, int, int& x, int& y, int& w, int& h);
51
52 // points:
53 FL_EXPORT void fl_point(int x, int y);
54
55 // line type:
56 FL_EXPORT void fl_line_style(int style, int width=0, char* dashes=0);
57 enum {
58   FL_SOLID      = 0,
59   FL_DASH       = 1,
60   FL_DOT        = 2,
61   FL_DASHDOT    = 3,
62   FL_DASHDOTDOT = 4,
63
64   FL_CAP_FLAT   = 0x100,
65   FL_CAP_ROUND  = 0x200,
66   FL_CAP_SQUARE = 0x300,
67
68   FL_JOIN_MITER = 0x1000,
69   FL_JOIN_ROUND = 0x2000,
70   FL_JOIN_BEVEL = 0x3000
71 };
72
73 // rectangles tweaked to exactly fill the pixel rectangle:
74 FL_EXPORT void fl_rect(int x, int y, int w, int h);
75 inline void fl_rect(int x, int y, int w, int h, Fl_Color c) {fl_color(c); fl_rect(x,y,w,h);}
76 FL_EXPORT void fl_rectf(int x, int y, int w, int h);
77 inline void fl_rectf(int x, int y, int w, int h, Fl_Color c) {fl_color(c); fl_rectf(x,y,w,h);}
78
79 // line segments:
80 FL_EXPORT void fl_line(int,int, int,int);
81 FL_EXPORT void fl_line(int,int, int,int, int,int);
82
83 // closed line segments:
84 FL_EXPORT void fl_loop(int,int, int,int, int,int);
85 FL_EXPORT void fl_loop(int,int, int,int, int,int, int,int);
86
87 // filled polygons
88 FL_EXPORT void fl_polygon(int,int, int,int, int,int);
89 FL_EXPORT void fl_polygon(int,int, int,int, int,int, int,int);
90
91 // draw rectilinear lines, horizontal segment first:
92 FL_EXPORT void fl_xyline(int x, int y, int x1);
93 FL_EXPORT void fl_xyline(int x, int y, int x1, int y2);
94 FL_EXPORT void fl_xyline(int x, int y, int x1, int y2, int x3);
95
96 // draw rectilinear lines, vertical segment first:
97 FL_EXPORT void fl_yxline(int x, int y, int y1);
98 FL_EXPORT void fl_yxline(int x, int y, int y1, int x2);
99 FL_EXPORT void fl_yxline(int x, int y, int y1, int x2, int y3);
100
101 // circular lines and pie slices (code in fl_arci.C):
102 FL_EXPORT void fl_arc(int x, int y, int w, int h, double a1, double a2);
103 FL_EXPORT void fl_pie(int x, int y, int w, int h, double a1, double a2);
104 FL_EXPORT void fl_chord(int x, int y, int w, int h, double a1, double a2); // nyi
105
106 // scalable drawing code (code in fl_vertex.C and fl_arc.C):
107 FL_EXPORT void fl_push_matrix();
108 FL_EXPORT void fl_pop_matrix();
109 FL_EXPORT void fl_scale(double x, double y);
110 FL_EXPORT void fl_scale(double x);
111 FL_EXPORT void fl_translate(double x, double y);
112 FL_EXPORT void fl_rotate(double d);
113 FL_EXPORT void fl_mult_matrix(double a, double b, double c, double d, double x,double y);
114 FL_EXPORT void fl_begin_points();
115 FL_EXPORT void fl_begin_line();
116 FL_EXPORT void fl_begin_loop();
117 FL_EXPORT void fl_begin_polygon();
118 FL_EXPORT void fl_vertex(double x, double y);
119 FL_EXPORT void fl_curve(double, double, double, double, double, double, double, double);
120 FL_EXPORT void fl_arc(double x, double y, double r, double start, double a);
121 FL_EXPORT void fl_circle(double x, double y, double r);
122 FL_EXPORT void fl_end_points();
123 FL_EXPORT void fl_end_line();
124 FL_EXPORT void fl_end_loop();
125 FL_EXPORT void fl_end_polygon();
126 FL_EXPORT void fl_begin_complex_polygon();
127 FL_EXPORT void fl_gap();
128 FL_EXPORT void fl_end_complex_polygon();
129 // get and use transformed positions:
130 FL_EXPORT double fl_transform_x(double x, double y);
131 FL_EXPORT double fl_transform_y(double x, double y);
132 FL_EXPORT double fl_transform_dx(double x, double y);
133 FL_EXPORT double fl_transform_dy(double x, double y);
134 FL_EXPORT void fl_transformed_vertex(double x, double y);
135
136 // current font:
137 FL_EXPORT void fl_font(int face, int size);
138 extern FL_EXPORT int fl_font_;
139 inline int fl_font() {return fl_font_;}
140 extern FL_EXPORT int fl_size_;
141 inline int fl_size() {return fl_size_;}
142
143 // information you can get about the current font:
144 FL_EXPORT int   fl_height();    // using "size" should work ok
145 inline int fl_height(int, int size) {return size;}
146 FL_EXPORT int   fl_descent();
147 FL_EXPORT double fl_width(const char*);
148 FL_EXPORT double fl_width(const char*, int n);
149 FL_EXPORT double fl_width(uchar);
150
151 // draw using current font:
152 FL_EXPORT void fl_draw(const char*, int x, int y);
153 FL_EXPORT void fl_draw(const char*, int n, int x, int y);
154 FL_EXPORT void fl_measure(const char*, int& x, int& y, int draw_symbols = 1);
155 FL_EXPORT void fl_draw(const char*, int,int,int,int, Fl_Align, Fl_Image* img=0,
156                        int draw_symbols = 1);
157 FL_EXPORT void fl_draw(const char*, int,int,int,int, Fl_Align,
158                        void (*callthis)(const char *, int n, int x, int y),
159                        Fl_Image* img=0, int draw_symbols = 1);
160
161 // boxtypes:
162 FL_EXPORT void fl_frame(const char* s, int x, int y, int w, int h);
163 FL_EXPORT void fl_frame2(const char* s, int x, int y, int w, int h);
164 FL_EXPORT void fl_draw_box(Fl_Boxtype, int x, int y, int w, int h, Fl_Color);
165
166 // images:
167 FL_EXPORT void fl_draw_image(const uchar*, int,int,int,int, int delta=3, int ldelta=0);
168 FL_EXPORT void fl_draw_image_mono(const uchar*, int,int,int,int, int delta=1, int ld=0);
169 typedef void (*Fl_Draw_Image_Cb)(void*,int,int,int,uchar*);
170 FL_EXPORT void fl_draw_image(Fl_Draw_Image_Cb, void*, int,int,int,int, int delta=3);
171 FL_EXPORT void fl_draw_image_mono(Fl_Draw_Image_Cb, void*, int,int,int,int, int delta=1);
172 FL_EXPORT void fl_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b);
173
174 FL_EXPORT uchar *fl_read_image(uchar *p, int x,int y, int w, int h, int alpha=0);
175
176 // pixmaps:
177 FL_EXPORT int fl_draw_pixmap(/*const*/ char* const* data, int x,int y,Fl_Color=FL_GRAY);
178 FL_EXPORT int fl_measure_pixmap(/*const*/ char* const* data, int &w, int &h);
179 FL_EXPORT int fl_draw_pixmap(const char* const* data, int x,int y,Fl_Color=FL_GRAY);
180 FL_EXPORT int fl_measure_pixmap(const char* const* data, int &w, int &h);
181
182 // other:
183 FL_EXPORT void fl_scroll(int X, int Y, int W, int H, int dx, int dy,
184                          void (*draw_area)(void*, int,int,int,int), void* data);
185 FL_EXPORT const char* fl_shortcut_label(int);
186 FL_EXPORT void fl_overlay_rect(int,int,int,int);
187 FL_EXPORT void fl_overlay_clear();
188 FL_EXPORT void fl_cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE);
189
190 // XForms symbols:
191 FL_EXPORT int fl_draw_symbol(const char* label,int x,int y,int w,int h, Fl_Color);
192 FL_EXPORT int fl_add_symbol(const char* name, void (*drawit)(Fl_Color), int scalable);
193
194 #endif
195
196 //
197 // End of "$Id: fl_draw.H,v 1.2 2002/12/01 15:38:37 neurosurg Exp $".
198 //