1998-10-20 01:39:29 +04:00
|
|
|
//
|
2002-06-12 00:58:12 +04:00
|
|
|
// "$Id: fl_draw.H,v 1.9.2.6.2.6 2002/06/11 20:58:12 easysw Exp $"
|
1998-10-20 01:39:29 +04:00
|
|
|
//
|
|
|
|
// Portable drawing function header file for the Fast Light Tool Kit (FLTK).
|
|
|
|
//
|
2002-01-01 18:11:33 +03:00
|
|
|
// Copyright 1998-2002 by Bill Spitzak and others.
|
1998-10-20 01:39:29 +04:00
|
|
|
//
|
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Library General Public
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Library General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Library General Public
|
|
|
|
// License along with this library; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
|
// USA.
|
|
|
|
//
|
2000-06-06 01:21:24 +04:00
|
|
|
// Please report all bugs and problems to "fltk-bugs@fltk.org".
|
1998-10-20 01:39:29 +04:00
|
|
|
//
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
#ifndef fl_draw_H
|
|
|
|
#define fl_draw_H
|
|
|
|
|
|
|
|
#include "Enumerations.H" // for the color names
|
|
|
|
|
2001-08-06 03:58:54 +04:00
|
|
|
// Image class...
|
|
|
|
class Fl_Image;
|
|
|
|
|
|
|
|
// Label flags...
|
|
|
|
FL_EXPORT extern char fl_draw_shortcut;
|
|
|
|
|
1998-10-06 22:21:25 +04:00
|
|
|
// Colors:
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT void fl_color(Fl_Color); // select indexed color
|
1998-10-06 22:21:25 +04:00
|
|
|
inline void fl_color(int c) {fl_color((Fl_Color)c);} // for back compatability
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT void fl_color(uchar, uchar, uchar); // select actual color
|
|
|
|
extern FL_EXPORT Fl_Color fl_color_;
|
|
|
|
inline Fl_Color fl_color() {return fl_color_;}
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
// clip:
|
2002-06-12 00:58:12 +04:00
|
|
|
FL_EXPORT void fl_push_clip(int x, int y, int w, int h);
|
|
|
|
#define fl_clip fl_push_clip
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT void fl_push_no_clip();
|
|
|
|
FL_EXPORT void fl_pop_clip();
|
|
|
|
FL_EXPORT int fl_not_clipped(int x, int y, int w, int h);
|
|
|
|
FL_EXPORT int fl_clip_box(int, int, int, int, int& x, int& y, int& w, int& h);
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
// points:
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT void fl_point(int x, int y);
|
1998-10-06 22:21:25 +04:00
|
|
|
|
2000-05-14 00:03:20 +04:00
|
|
|
// line type:
|
|
|
|
FL_EXPORT void fl_line_style(int style, int width=0, char* dashes=0);
|
|
|
|
enum {
|
|
|
|
FL_SOLID = 0,
|
|
|
|
FL_DASH = 1,
|
|
|
|
FL_DOT = 2,
|
|
|
|
FL_DASHDOT = 3,
|
|
|
|
FL_DASHDOTDOT = 4,
|
|
|
|
|
|
|
|
FL_CAP_FLAT = 0x100,
|
|
|
|
FL_CAP_ROUND = 0x200,
|
|
|
|
FL_CAP_SQUARE = 0x300,
|
|
|
|
|
|
|
|
FL_JOIN_MITER = 0x1000,
|
|
|
|
FL_JOIN_ROUND = 0x2000,
|
|
|
|
FL_JOIN_BEVEL = 0x3000
|
|
|
|
};
|
|
|
|
|
1998-10-06 22:21:25 +04:00
|
|
|
// rectangles tweaked to exactly fill the pixel rectangle:
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT void fl_rect(int x, int y, int w, int h);
|
2001-08-04 16:21:34 +04:00
|
|
|
inline void fl_rect(int x, int y, int w, int h, Fl_Color c) {fl_color(c); fl_rect(x,y,w,h);}
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT void fl_rectf(int x, int y, int w, int h);
|
2001-08-04 16:21:34 +04:00
|
|
|
inline void fl_rectf(int x, int y, int w, int h, Fl_Color c) {fl_color(c); fl_rectf(x,y,w,h);}
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
// line segments:
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT void fl_line(int,int, int,int);
|
|
|
|
FL_EXPORT void fl_line(int,int, int,int, int,int);
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
// closed line segments:
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT void fl_loop(int,int, int,int, int,int);
|
|
|
|
FL_EXPORT void fl_loop(int,int, int,int, int,int, int,int);
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
// filled polygons
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT void fl_polygon(int,int, int,int, int,int);
|
|
|
|
FL_EXPORT void fl_polygon(int,int, int,int, int,int, int,int);
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
// draw rectilinear lines, horizontal segment first:
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT void fl_xyline(int x, int y, int x1);
|
|
|
|
FL_EXPORT void fl_xyline(int x, int y, int x1, int y2);
|
|
|
|
FL_EXPORT void fl_xyline(int x, int y, int x1, int y2, int x3);
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
// draw rectilinear lines, vertical segment first:
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT void fl_yxline(int x, int y, int y1);
|
|
|
|
FL_EXPORT void fl_yxline(int x, int y, int y1, int x2);
|
|
|
|
FL_EXPORT void fl_yxline(int x, int y, int y1, int x2, int y3);
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
// circular lines and pie slices (code in fl_arci.C):
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT void fl_arc(int x, int y, int w, int h, double a1, double a2);
|
|
|
|
FL_EXPORT void fl_pie(int x, int y, int w, int h, double a1, double a2);
|
|
|
|
FL_EXPORT void fl_chord(int x, int y, int w, int h, double a1, double a2); // nyi
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
// scalable drawing code (code in fl_vertex.C and fl_arc.C):
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT void fl_push_matrix();
|
|
|
|
FL_EXPORT void fl_pop_matrix();
|
|
|
|
FL_EXPORT void fl_scale(double x, double y);
|
|
|
|
FL_EXPORT void fl_scale(double x);
|
|
|
|
FL_EXPORT void fl_translate(double x, double y);
|
|
|
|
FL_EXPORT void fl_rotate(double d);
|
|
|
|
FL_EXPORT void fl_mult_matrix(double a, double b, double c, double d, double x,double y);
|
|
|
|
FL_EXPORT void fl_begin_points();
|
|
|
|
FL_EXPORT void fl_begin_line();
|
|
|
|
FL_EXPORT void fl_begin_loop();
|
|
|
|
FL_EXPORT void fl_begin_polygon();
|
|
|
|
FL_EXPORT void fl_vertex(double x, double y);
|
|
|
|
FL_EXPORT void fl_curve(double, double, double, double, double, double, double, double);
|
|
|
|
FL_EXPORT void fl_arc(double x, double y, double r, double start, double a);
|
|
|
|
FL_EXPORT void fl_circle(double x, double y, double r);
|
|
|
|
FL_EXPORT void fl_end_points();
|
|
|
|
FL_EXPORT void fl_end_line();
|
|
|
|
FL_EXPORT void fl_end_loop();
|
|
|
|
FL_EXPORT void fl_end_polygon();
|
|
|
|
FL_EXPORT void fl_begin_complex_polygon();
|
|
|
|
FL_EXPORT void fl_gap();
|
|
|
|
FL_EXPORT void fl_end_complex_polygon();
|
1998-10-06 22:21:25 +04:00
|
|
|
// get and use transformed positions:
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT double fl_transform_x(double x, double y);
|
|
|
|
FL_EXPORT double fl_transform_y(double x, double y);
|
|
|
|
FL_EXPORT double fl_transform_dx(double x, double y);
|
|
|
|
FL_EXPORT double fl_transform_dy(double x, double y);
|
|
|
|
FL_EXPORT void fl_transformed_vertex(double x, double y);
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
// current font:
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT void fl_font(int face, int size);
|
|
|
|
extern FL_EXPORT int fl_font_;
|
|
|
|
inline int fl_font() {return fl_font_;}
|
|
|
|
extern FL_EXPORT int fl_size_;
|
|
|
|
inline int fl_size() {return fl_size_;}
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
// information you can get about the current font:
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT int fl_height(); // using "size" should work ok
|
2001-08-04 16:21:34 +04:00
|
|
|
inline int fl_height(int, int size) {return size;}
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT int fl_descent();
|
|
|
|
FL_EXPORT double fl_width(const char*);
|
|
|
|
FL_EXPORT double fl_width(const char*, int n);
|
|
|
|
FL_EXPORT double fl_width(uchar);
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
// draw using current font:
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT void fl_draw(const char*, int x, int y);
|
|
|
|
FL_EXPORT void fl_draw(const char*, int n, int x, int y);
|
2001-11-03 08:11:34 +03:00
|
|
|
FL_EXPORT void fl_measure(const char*, int& x, int& y, int draw_symbols = 1);
|
|
|
|
FL_EXPORT void fl_draw(const char*, int,int,int,int, Fl_Align, Fl_Image* img=0,
|
|
|
|
int draw_symbols = 1);
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT void fl_draw(const char*, int,int,int,int, Fl_Align,
|
2001-08-06 03:58:54 +04:00
|
|
|
void (*callthis)(const char *, int n, int x, int y),
|
2001-11-03 08:11:34 +03:00
|
|
|
Fl_Image* img=0, int draw_symbols = 1);
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
// boxtypes:
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT void fl_frame(const char* s, int x, int y, int w, int h);
|
|
|
|
FL_EXPORT void fl_frame2(const char* s, int x, int y, int w, int h);
|
|
|
|
FL_EXPORT void fl_draw_box(Fl_Boxtype, int x, int y, int w, int h, Fl_Color);
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
// images:
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT void fl_draw_image(const uchar*, int,int,int,int, int delta=3, int ldelta=0);
|
|
|
|
FL_EXPORT void fl_draw_image_mono(const uchar*, int,int,int,int, int delta=1, int ld=0);
|
1999-05-11 13:39:31 +04:00
|
|
|
typedef void (*Fl_Draw_Image_Cb)(void*,int,int,int,uchar*);
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT void fl_draw_image(Fl_Draw_Image_Cb, void*, int,int,int,int, int delta=3);
|
|
|
|
FL_EXPORT void fl_draw_image_mono(Fl_Draw_Image_Cb, void*, int,int,int,int, int delta=1);
|
|
|
|
FL_EXPORT void fl_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b);
|
1998-10-06 22:21:25 +04:00
|
|
|
|
2002-05-30 19:09:03 +04:00
|
|
|
FL_EXPORT uchar *fl_read_image(uchar *p, int x,int y, int w, int h, int alpha=0);
|
|
|
|
|
1998-10-06 22:21:25 +04:00
|
|
|
// pixmaps:
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT int fl_draw_pixmap(/*const*/ char* const* data, int x,int y,Fl_Color=FL_GRAY);
|
|
|
|
FL_EXPORT int fl_measure_pixmap(/*const*/ char* const* data, int &w, int &h);
|
2001-04-13 23:07:40 +04:00
|
|
|
FL_EXPORT int fl_draw_pixmap(const char* const* data, int x,int y,Fl_Color=FL_GRAY);
|
|
|
|
FL_EXPORT int fl_measure_pixmap(const char* const* data, int &w, int &h);
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
// other:
|
1999-02-17 01:00:04 +03:00
|
|
|
extern FL_EXPORT void fl_scroll(int X, int Y, int W, int H, int dx, int dy,
|
|
|
|
void (*draw_area)(void*, int,int,int,int), void* data);
|
|
|
|
FL_EXPORT const char* fl_shortcut_label(int);
|
|
|
|
FL_EXPORT void fl_overlay_rect(int,int,int,int);
|
|
|
|
FL_EXPORT void fl_overlay_clear();
|
|
|
|
FL_EXPORT void fl_cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE);
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
// XForms symbols:
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT int fl_draw_symbol(const char* label,int x,int y,int w,int h, Fl_Color);
|
|
|
|
FL_EXPORT int fl_add_symbol(const char* name, void (*drawit)(Fl_Color), int scalable);
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
#endif
|
1998-10-20 01:39:29 +04:00
|
|
|
|
|
|
|
//
|
2002-06-12 00:58:12 +04:00
|
|
|
// End of "$Id: fl_draw.H,v 1.9.2.6.2.6 2002/06/11 20:58:12 easysw Exp $".
|
1998-10-20 01:39:29 +04:00
|
|
|
//
|