2010-03-18 18:15:41 +03:00
|
|
|
//
|
|
|
|
// "$Id$"
|
|
|
|
//
|
2010-05-27 21:20:18 +04:00
|
|
|
// Definition of classes Fl_Device, Fl_Graphics_Driver, Fl_Surface_Device, Fl_Display_Device
|
|
|
|
// for the Fast Light Tool Kit (FLTK).
|
2010-03-18 18:15:41 +03:00
|
|
|
//
|
2011-02-07 16:49:34 +03:00
|
|
|
// Copyright 2010-2011 by Bill Spitzak and others.
|
2010-03-18 18:15:41 +03: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.
|
|
|
|
//
|
|
|
|
// Please report all bugs and problems on the following page:
|
|
|
|
//
|
|
|
|
// http://www.fltk.org/str.php
|
|
|
|
//
|
2010-03-25 16:59:00 +03:00
|
|
|
/** \file Fl_Device.H
|
2010-12-12 19:13:55 +03:00
|
|
|
\brief declaration of classes Fl_Device, Fl_Graphics_Driver, Fl_Surface_Device,
|
|
|
|
Fl_Display_Device, Fl_Device_Plugin.
|
2010-03-25 16:59:00 +03:00
|
|
|
*/
|
2010-03-14 21:07:24 +03:00
|
|
|
|
|
|
|
#ifndef Fl_Device_H
|
|
|
|
#define Fl_Device_H
|
|
|
|
|
2011-02-05 02:32:53 +03:00
|
|
|
#include <FL/x.H>
|
2010-03-17 01:51:31 +03:00
|
|
|
#include <FL/Fl_Plugin.H>
|
2010-03-25 16:59:00 +03:00
|
|
|
#include <FL/Fl_Image.H>
|
|
|
|
#include <FL/Fl_Bitmap.H>
|
|
|
|
#include <FL/Fl_Pixmap.H>
|
|
|
|
#include <FL/Fl_RGB_Image.H>
|
2010-03-14 21:07:24 +03:00
|
|
|
|
2010-05-27 21:20:18 +04:00
|
|
|
class Fl_Graphics_Driver;
|
2011-02-07 16:49:34 +03:00
|
|
|
class Fl_Font_Descriptor;
|
2010-05-27 21:20:18 +04:00
|
|
|
/** \brief Points to the driver that currently receives all graphics requests */
|
2010-07-04 21:19:38 +04:00
|
|
|
FL_EXPORT extern Fl_Graphics_Driver *fl_graphics_driver;
|
2010-03-25 16:59:00 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
signature of image generation callback function.
|
|
|
|
\param[in] data user data passed to function
|
|
|
|
\param[in] x,y,w position and width of scan line in image
|
|
|
|
\param[out] buf buffer for generated image data. You must copy \p w
|
|
|
|
pixels from scanline \p y, starting at pixel \p x
|
|
|
|
to this buffer.
|
|
|
|
*/
|
|
|
|
typedef void (*Fl_Draw_Image_Cb)(void* data,int x,int y,int w,uchar* buf);
|
2010-03-14 21:07:24 +03:00
|
|
|
|
2011-02-05 02:32:53 +03:00
|
|
|
// typedef what the x,y fields in a point are:
|
|
|
|
#ifdef WIN32
|
|
|
|
typedef int COORD_T;
|
|
|
|
# define XPOINT XPoint
|
|
|
|
#elif defined(__APPLE__)
|
|
|
|
typedef float COORD_T;
|
|
|
|
typedef struct { float x; float y; } QPoint;
|
|
|
|
# define XPOINT QPoint
|
|
|
|
extern float fl_quartz_line_width_;
|
|
|
|
#else
|
|
|
|
typedef short COORD_T;
|
|
|
|
# define XPOINT XPoint
|
|
|
|
#endif
|
|
|
|
|
2010-03-14 21:07:24 +03:00
|
|
|
/**
|
2010-05-27 21:20:18 +04:00
|
|
|
\brief All graphical output devices and all graphics systems.
|
|
|
|
*/
|
2010-12-13 02:21:03 +03:00
|
|
|
class FL_EXPORT Fl_Device {
|
2011-02-23 17:36:18 +03:00
|
|
|
public:
|
|
|
|
/** A string that identifies each subclass of Fl_Device.
|
|
|
|
Function class_name() applied to a device of this class returns this string.
|
2010-05-27 21:20:18 +04:00
|
|
|
*/
|
2011-01-05 13:21:45 +03:00
|
|
|
static const char *class_id;
|
2010-05-27 21:20:18 +04:00
|
|
|
/**
|
2011-02-23 17:36:18 +03:00
|
|
|
Returns the name of the class of this object.
|
2011-01-05 13:21:45 +03:00
|
|
|
The class of an instance of an Fl_Device subclass can be checked with code such as:
|
2010-05-27 21:20:18 +04:00
|
|
|
\code
|
2011-01-05 13:21:45 +03:00
|
|
|
if ( instance->class_name() == Fl_Printer::class_id ) { ... }
|
2010-05-27 21:20:18 +04:00
|
|
|
\endcode
|
|
|
|
*/
|
2011-02-23 17:36:18 +03:00
|
|
|
virtual const char *class_name() {return class_id;};
|
2011-03-23 15:49:30 +03:00
|
|
|
/**
|
|
|
|
Virtual destructor.
|
|
|
|
|
|
|
|
The destructor of Fl_Device must be virtual to make the destructors of
|
|
|
|
derived classes being called correctly on destruction.
|
|
|
|
*/
|
|
|
|
virtual ~Fl_Device() {};
|
2010-05-27 21:20:18 +04:00
|
|
|
};
|
|
|
|
|
2011-02-24 21:02:11 +03:00
|
|
|
#define FL_REGION_STACK_SIZE 10
|
|
|
|
#define FL_MATRIX_STACK_SIZE 32
|
2010-05-27 21:20:18 +04:00
|
|
|
/**
|
|
|
|
\brief A virtual class subclassed for each graphics driver FLTK uses.
|
2010-03-21 11:26:40 +03:00
|
|
|
*
|
2011-02-18 16:39:48 +03:00
|
|
|
The virtual methods of this class are those that a graphics driver should implement to
|
2010-03-21 11:26:40 +03:00
|
|
|
support all of FLTK drawing functions.
|
2010-10-12 13:25:37 +04:00
|
|
|
<br> The public API for drawing operations is functionally presented in \ref drawing and as function lists
|
|
|
|
in the \ref fl_drawings and \ref fl_attributes modules.
|
2010-03-22 01:15:04 +03:00
|
|
|
*/
|
2010-12-13 02:21:03 +03:00
|
|
|
class FL_EXPORT Fl_Graphics_Driver : public Fl_Device {
|
2011-02-24 21:02:11 +03:00
|
|
|
public:
|
|
|
|
/** A 2D coordinate transformation matrix
|
|
|
|
*/
|
|
|
|
struct matrix {double a, b, c, d, x, y;};
|
|
|
|
private:
|
|
|
|
static const matrix m0;
|
2011-02-05 16:54:56 +03:00
|
|
|
Fl_Font font_; // current font
|
|
|
|
Fl_Fontsize size_; // current font size
|
2011-02-06 15:32:23 +03:00
|
|
|
Fl_Color color_; // current color
|
2011-02-05 02:32:53 +03:00
|
|
|
enum {LINE, LOOP, POLYGON, POINT_};
|
|
|
|
int sptr;
|
2011-02-24 21:02:11 +03:00
|
|
|
static const int matrix_stack_size = FL_MATRIX_STACK_SIZE;
|
|
|
|
matrix stack[FL_MATRIX_STACK_SIZE];
|
2011-02-05 02:32:53 +03:00
|
|
|
matrix m;
|
|
|
|
int n, p_size, gap_;
|
|
|
|
XPOINT *p;
|
|
|
|
int what;
|
|
|
|
int fl_clip_state_number;
|
|
|
|
int rstackptr;
|
2011-02-24 21:02:11 +03:00
|
|
|
static const int region_stack_max = FL_REGION_STACK_SIZE - 1;
|
|
|
|
Fl_Region rstack[FL_REGION_STACK_SIZE];
|
2011-02-05 02:32:53 +03:00
|
|
|
#ifdef WIN32
|
|
|
|
int numcount;
|
|
|
|
int counts[20];
|
|
|
|
#endif
|
2011-02-07 16:49:34 +03:00
|
|
|
Fl_Font_Descriptor *font_descriptor_;
|
2011-02-05 02:32:53 +03:00
|
|
|
void transformed_vertex0(COORD_T x, COORD_T y);
|
|
|
|
void fixloop();
|
|
|
|
|
2010-03-14 21:07:24 +03:00
|
|
|
protected:
|
2010-05-27 21:20:18 +04:00
|
|
|
/* ** \brief red color for background and/or mixing if device does not support masking or alpha *
|
2010-03-24 13:24:37 +03:00
|
|
|
uchar bg_r_;
|
2010-05-27 21:20:18 +04:00
|
|
|
** \brief green color for background and/or mixing if device does not support masking or alpha *
|
2010-03-24 13:24:37 +03:00
|
|
|
uchar bg_g_;
|
2010-05-27 21:20:18 +04:00
|
|
|
** \brief blue color for background and/or mixing if device does not support masking or alpha *
|
|
|
|
uchar bg_b_; */
|
2010-03-25 16:59:00 +03:00
|
|
|
friend class Fl_Pixmap;
|
|
|
|
friend class Fl_Bitmap;
|
|
|
|
friend class Fl_RGB_Image;
|
2010-03-14 21:07:24 +03:00
|
|
|
friend void fl_rect(int x, int y, int w, int h);
|
|
|
|
friend void fl_rectf(int x, int y, int w, int h);
|
|
|
|
friend void fl_line_style(int style, int width, char* dashes);
|
|
|
|
friend void fl_xyline(int x, int y, int x1);
|
|
|
|
friend void fl_xyline(int x, int y, int x1, int y2);
|
|
|
|
friend void fl_xyline(int x, int y, int x1, int y2, int x3);
|
|
|
|
friend void fl_yxline(int x, int y, int y1);
|
|
|
|
friend void fl_yxline(int x, int y, int y1, int x2);
|
|
|
|
friend void fl_yxline(int x, int y, int y1, int x2, int y3);
|
|
|
|
friend void fl_line(int x, int y, int x1, int y1);
|
|
|
|
friend void fl_line(int x, int y, int x1, int y1, int x2, int y2);
|
|
|
|
friend void fl_draw(const char *str, int n, int x, int y);
|
2011-02-18 16:39:48 +03:00
|
|
|
#ifdef __APPLE__
|
|
|
|
friend void fl_draw(const char *str, int n, float x, float y);
|
|
|
|
#endif
|
2010-03-14 21:07:24 +03:00
|
|
|
friend void fl_draw(int angle, const char *str, int n, int x, int y);
|
2010-06-21 19:49:45 +04:00
|
|
|
friend void fl_rtl_draw(const char *str, int n, int x, int y);
|
2010-03-14 21:07:24 +03:00
|
|
|
friend void fl_font(Fl_Font face, Fl_Fontsize size);
|
|
|
|
friend void fl_color(Fl_Color c);
|
|
|
|
friend void fl_color(uchar r, uchar g, uchar b);
|
|
|
|
friend void fl_point(int x, int y);
|
|
|
|
friend void fl_loop(int x0, int y0, int x1, int y1, int x2, int y2);
|
|
|
|
friend void fl_loop(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3);
|
|
|
|
friend void fl_polygon(int x0, int y0, int x1, int y1, int x2, int y2);
|
|
|
|
friend void fl_polygon(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3);
|
|
|
|
friend void fl_begin_points();
|
|
|
|
friend void fl_begin_line();
|
|
|
|
friend void fl_begin_loop();
|
|
|
|
friend void fl_begin_polygon();
|
|
|
|
friend void fl_vertex(double x, double y);
|
2010-03-24 13:24:37 +03:00
|
|
|
friend void fl_curve(double X0, double Y0, double X1, double Y1, double X2, double Y2, double X3, double Y3);
|
2010-03-14 21:07:24 +03:00
|
|
|
friend void fl_circle(double x, double y, double r);
|
2010-03-24 13:24:37 +03:00
|
|
|
friend void fl_arc(double x, double y, double r, double start, double end);
|
2010-03-14 21:07:24 +03:00
|
|
|
friend void fl_arc(int x, int y, int w, int h, double a1, double a2);
|
|
|
|
friend void fl_pie(int x, int y, int w, int h, double a1, double a2);
|
|
|
|
friend void fl_end_points();
|
|
|
|
friend void fl_end_line();
|
|
|
|
friend void fl_end_loop();
|
|
|
|
friend void fl_end_polygon();
|
2010-03-24 13:24:37 +03:00
|
|
|
friend void fl_transformed_vertex(double xf, double yf);
|
2010-03-14 21:07:24 +03:00
|
|
|
friend void fl_push_clip(int x, int y, int w, int h);
|
|
|
|
friend int fl_clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H);
|
|
|
|
friend int fl_not_clipped(int x, int y, int w, int h);
|
|
|
|
friend void fl_push_no_clip();
|
|
|
|
friend void fl_pop_clip();
|
|
|
|
friend void fl_begin_complex_polygon();
|
|
|
|
friend void fl_gap();
|
|
|
|
friend void fl_end_complex_polygon();
|
2011-02-05 02:32:53 +03:00
|
|
|
friend void fl_push_matrix();
|
|
|
|
friend void fl_pop_matrix();
|
|
|
|
friend void fl_mult_matrix(double a, double b, double c, double d, double x, double y);
|
2011-02-18 20:22:43 +03:00
|
|
|
friend void fl_scale(double x, double y);
|
|
|
|
friend void fl_scale(double x);
|
|
|
|
friend void fl_translate(double x, double y);
|
|
|
|
friend void fl_rotate(double d);
|
2011-02-05 02:32:53 +03:00
|
|
|
friend double fl_transform_x(double x, double y);
|
|
|
|
friend double fl_transform_y(double x, double y);
|
|
|
|
friend double fl_transform_dx(double x, double y);
|
|
|
|
friend double fl_transform_dy(double x, double y);
|
|
|
|
friend Fl_Region fl_clip_region();
|
|
|
|
friend void fl_clip_region(Fl_Region r);
|
|
|
|
friend void fl_restore_clip();
|
|
|
|
|
2010-03-24 13:24:37 +03:00
|
|
|
friend void fl_draw_image(const uchar* buf, int X,int Y,int W,int H, int D, int L);
|
|
|
|
friend void fl_draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D, int L);
|
|
|
|
friend void fl_draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D);
|
|
|
|
friend FL_EXPORT void fl_draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D);
|
2011-02-21 19:36:10 +03:00
|
|
|
friend FL_EXPORT void gl_start();
|
2011-02-05 02:32:53 +03:00
|
|
|
|
2011-02-05 16:54:56 +03:00
|
|
|
matrix *fl_matrix; /**< Points to the current coordinate transformation matrix */
|
2011-02-05 02:32:53 +03:00
|
|
|
|
2010-05-27 21:20:18 +04:00
|
|
|
/** \brief The constructor. */
|
2011-02-05 02:32:53 +03:00
|
|
|
Fl_Graphics_Driver();
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_rect(int x, int y, int w, int h). */
|
2010-03-14 21:07:24 +03:00
|
|
|
virtual void rect(int x, int y, int w, int h);
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_rectf(int x, int y, int w, int h). */
|
2010-03-14 21:07:24 +03:00
|
|
|
virtual void rectf(int x, int y, int w, int h);
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_line_style(int style, int width, char* dashes). */
|
2010-03-14 21:07:24 +03:00
|
|
|
virtual void line_style(int style, int width=0, char* dashes=0);
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_xyline(int x, int y, int x1). */
|
2010-03-14 21:07:24 +03:00
|
|
|
virtual void xyline(int x, int y, int x1);
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_xyline(int x, int y, int x1, int y2). */
|
2010-03-14 21:07:24 +03:00
|
|
|
virtual void xyline(int x, int y, int x1, int y2);
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_xyline(int x, int y, int x1, int y2, int x3). */
|
2010-03-14 21:07:24 +03:00
|
|
|
virtual void xyline(int x, int y, int x1, int y2, int x3);
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_yxline(int x, int y, int y1). */
|
2010-03-14 21:07:24 +03:00
|
|
|
virtual void yxline(int x, int y, int y1);
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_yxline(int x, int y, int y1, int x2). */
|
2010-03-14 21:07:24 +03:00
|
|
|
virtual void yxline(int x, int y, int y1, int x2);
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_yxline(int x, int y, int y1, int x2, int y3). */
|
2010-03-14 21:07:24 +03:00
|
|
|
virtual void yxline(int x, int y, int y1, int x2, int y3);
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_line(int x, int y, int x1, int y1). */
|
2010-03-14 21:07:24 +03:00
|
|
|
virtual void line(int x, int y, int x1, int y1);
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_line(int x, int y, int x1, int y1, int x2, int y2). */
|
2010-03-14 21:07:24 +03:00
|
|
|
virtual void line(int x, int y, int x1, int y1, int x2, int y2);
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_draw(const char *str, int n, int x, int y). */
|
2011-01-10 15:02:48 +03:00
|
|
|
virtual void draw(const char *str, int n, int x, int y) = 0;
|
2011-02-18 16:39:48 +03:00
|
|
|
#ifdef __APPLE__
|
|
|
|
virtual void draw(const char *str, int n, float x, float y) = 0;
|
|
|
|
#endif
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_draw(int angle, const char *str, int n, int x, int y). */
|
2011-01-10 15:02:48 +03:00
|
|
|
virtual void draw(int angle, const char *str, int n, int x, int y) = 0;
|
2010-06-21 19:49:45 +04:00
|
|
|
/** \brief see fl_rtl_draw(const char *str, int n, int x, int y). */
|
2011-01-10 15:02:48 +03:00
|
|
|
virtual void rtl_draw(const char *str, int n, int x, int y) = 0;
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_color(Fl_Color c). */
|
2011-02-06 15:32:23 +03:00
|
|
|
virtual void color(Fl_Color c) {color_ = c;}
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_color(uchar r, uchar g, uchar b). */
|
2011-01-10 15:02:48 +03:00
|
|
|
virtual void color(uchar r, uchar g, uchar b) = 0;
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_point(int x, int y). */
|
2010-03-14 21:07:24 +03:00
|
|
|
virtual void point(int x, int y);
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_loop(int x0, int y0, int x1, int y1, int x2, int y2). */
|
2010-03-14 21:07:24 +03:00
|
|
|
virtual void loop(int x0, int y0, int x1, int y1, int x2, int y2);
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_loop(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3). */
|
2010-03-14 21:07:24 +03:00
|
|
|
virtual void loop(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3);
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_polygon(int x0, int y0, int x1, int y1, int x2, int y2). */
|
2010-03-14 21:07:24 +03:00
|
|
|
virtual void polygon(int x0, int y0, int x1, int y1, int x2, int y2);
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_polygon(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3). */
|
2010-03-14 21:07:24 +03:00
|
|
|
virtual void polygon(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3);
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_begin_points(). */
|
2010-03-14 21:07:24 +03:00
|
|
|
virtual void begin_points();
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_begin_line(). */
|
2010-03-14 21:07:24 +03:00
|
|
|
virtual void begin_line();
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_begin_loop(). */
|
2010-03-14 21:07:24 +03:00
|
|
|
virtual void begin_loop();
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_begin_polygon(). */
|
2010-03-14 21:07:24 +03:00
|
|
|
virtual void begin_polygon();
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_vertex(double x, double y). */
|
2010-03-14 21:07:24 +03:00
|
|
|
virtual void vertex(double x, double y);
|
2010-03-24 13:24:37 +03:00
|
|
|
/** \brief see fl_curve(double X0, double Y0, double X1, double Y1, double X2, double Y2, double X3, double Y3). */
|
|
|
|
virtual void curve(double X0, double Y0, double X1, double Y1, double X2, double Y2, double X3, double Y3);
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_circle(double x, double y, double r). */
|
2010-03-14 21:07:24 +03:00
|
|
|
virtual void circle(double x, double y, double r);
|
2010-03-24 13:24:37 +03:00
|
|
|
/** \brief see fl_arc(double x, double y, double r, double start, double end). */
|
|
|
|
virtual void arc(double x, double y, double r, double start, double end);
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_arc(int x, int y, int w, int h, double a1, double a2). */
|
2010-03-14 21:07:24 +03:00
|
|
|
virtual void arc(int x, int y, int w, int h, double a1, double a2);
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_pie(int x, int y, int w, int h, double a1, double a2). */
|
2010-03-14 21:07:24 +03:00
|
|
|
virtual void pie(int x, int y, int w, int h, double a1, double a2);
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_end_points(). */
|
2010-03-14 21:07:24 +03:00
|
|
|
virtual void end_points();
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_end_line(). */
|
2010-03-14 21:07:24 +03:00
|
|
|
virtual void end_line();
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_end_loop(). */
|
2010-03-14 21:07:24 +03:00
|
|
|
virtual void end_loop();
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_end_polygon(). */
|
2010-03-14 21:07:24 +03:00
|
|
|
virtual void end_polygon();
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_begin_complex_polygon(). */
|
2010-03-14 21:07:24 +03:00
|
|
|
virtual void begin_complex_polygon();
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_gap(). */
|
2010-03-14 21:07:24 +03:00
|
|
|
virtual void gap();
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_end_complex_polygon(). */
|
2010-03-14 21:07:24 +03:00
|
|
|
virtual void end_complex_polygon();
|
2010-03-24 13:24:37 +03:00
|
|
|
/** \brief see fl_transformed_vertex(double xf, double yf). */
|
|
|
|
virtual void transformed_vertex(double xf, double yf);
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_push_clip(int x, int y, int w, int h). */
|
2010-03-14 21:07:24 +03:00
|
|
|
virtual void push_clip(int x, int y, int w, int h);
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H). */
|
2010-03-14 21:07:24 +03:00
|
|
|
virtual int clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H);
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_not_clipped(int x, int y, int w, int h). */
|
2010-03-14 21:07:24 +03:00
|
|
|
virtual int not_clipped(int x, int y, int w, int h);
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_push_no_clip(). */
|
2010-03-14 21:07:24 +03:00
|
|
|
virtual void push_no_clip();
|
2010-03-21 11:26:40 +03:00
|
|
|
/** \brief see fl_pop_clip(). */
|
2010-03-14 21:07:24 +03:00
|
|
|
virtual void pop_clip();
|
2011-02-05 02:32:53 +03:00
|
|
|
|
|
|
|
/** \brief see fl_push_matrix(). */
|
|
|
|
void push_matrix();
|
|
|
|
/** \brief see fl_pop_matrix(). */
|
|
|
|
void pop_matrix();
|
|
|
|
/** \brief see fl_mult_matrix(double a, double b, double c, double d, double x, double y). */
|
|
|
|
void mult_matrix(double a, double b, double c, double d, double x, double y);
|
2011-02-18 20:22:43 +03:00
|
|
|
/** \brief see fl_scale(double x, double y). */
|
|
|
|
inline void scale(double x, double y) { mult_matrix(x,0,0,y,0,0); }
|
|
|
|
/** \brief see fl_scale(double x). */
|
|
|
|
inline void scale(double x) { mult_matrix(x,0,0,x,0,0); }
|
|
|
|
/** \brief see fl_translate(double x, double y). */
|
|
|
|
inline void translate(double x,double y) { mult_matrix(1,0,0,1,x,y); }
|
|
|
|
/** \brief see fl_rotate(double d). */
|
|
|
|
void rotate(double d);
|
2011-02-05 02:32:53 +03:00
|
|
|
/** \brief see fl_transform_x(double x, double y). */
|
|
|
|
double transform_x(double x, double y);
|
|
|
|
/** \brief see fl_transform_y(double x, double y). */
|
|
|
|
double transform_y(double x, double y);
|
|
|
|
/** \brief see fl_transform_dx(double x, double y). */
|
|
|
|
double transform_dx(double x, double y);
|
|
|
|
/** \brief see fl_transform_dy(double x, double y). */
|
|
|
|
double transform_dy(double x, double y);
|
|
|
|
/** \brief see fl_clip_region(). */
|
|
|
|
Fl_Region clip_region();
|
|
|
|
/** \brief see fl_clip_region(Fl_Region r). */
|
|
|
|
void clip_region(Fl_Region r);
|
|
|
|
/** \brief see fl_restore_clip(). */
|
|
|
|
void restore_clip();
|
|
|
|
|
2010-03-14 21:07:24 +03:00
|
|
|
// Images
|
2010-03-24 13:24:37 +03:00
|
|
|
/** \brief see fl_draw_image(const uchar* buf, int X,int Y,int W,int H, int D, int L). */
|
2011-01-10 15:02:48 +03:00
|
|
|
virtual void draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0) = 0;
|
2010-03-24 13:24:37 +03:00
|
|
|
/** \brief see fl_draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D, int L). */
|
2011-01-10 15:02:48 +03:00
|
|
|
virtual void draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0) = 0;
|
2010-03-24 13:24:37 +03:00
|
|
|
/** \brief see fl_draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D). */
|
2011-01-10 15:02:48 +03:00
|
|
|
virtual void draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3) = 0;
|
2010-03-24 13:24:37 +03:00
|
|
|
/** \brief see fl_draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D). */
|
2011-01-10 15:02:48 +03:00
|
|
|
virtual void draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=1) = 0;
|
2010-03-14 21:07:24 +03:00
|
|
|
// Image classes
|
2010-05-27 21:20:18 +04:00
|
|
|
/** \brief Draws an Fl_RGB_Image object to the device.
|
|
|
|
*
|
|
|
|
Specifies a bounding box for the image, with the origin (upper left-hand corner) of
|
|
|
|
the image offset by the cx and cy arguments.
|
2010-03-14 21:07:24 +03:00
|
|
|
*/
|
2011-01-10 15:02:48 +03:00
|
|
|
virtual void draw(Fl_RGB_Image * rgb,int XP, int YP, int WP, int HP, int cx, int cy) = 0;
|
2010-05-27 21:20:18 +04:00
|
|
|
/** \brief Draws an Fl_Pixmap object to the device.
|
|
|
|
*
|
|
|
|
Specifies a bounding box for the image, with the origin (upper left-hand corner) of
|
|
|
|
the image offset by the cx and cy arguments.
|
2010-04-18 10:57:37 +04:00
|
|
|
*/
|
2011-01-10 15:02:48 +03:00
|
|
|
virtual void draw(Fl_Pixmap * pxm,int XP, int YP, int WP, int HP, int cx, int cy) = 0;
|
2010-05-27 21:20:18 +04:00
|
|
|
/** \brief Draws an Fl_Bitmap object to the device.
|
|
|
|
*
|
|
|
|
Specifies a bounding box for the image, with the origin (upper left-hand corner) of
|
|
|
|
the image offset by the cx and cy arguments.
|
2010-03-14 21:07:24 +03:00
|
|
|
*/
|
2011-01-10 15:02:48 +03:00
|
|
|
virtual void draw(Fl_Bitmap *bm, int XP, int YP, int WP, int HP, int cx, int cy) = 0;
|
2010-05-27 21:20:18 +04:00
|
|
|
|
|
|
|
public:
|
2011-01-05 13:21:45 +03:00
|
|
|
static const char *class_id;
|
2011-02-23 17:36:18 +03:00
|
|
|
virtual const char *class_name() {return class_id;};
|
2011-02-04 19:46:41 +03:00
|
|
|
/** \brief see fl_font(Fl_Font face, Fl_Fontsize size). */
|
2011-02-05 16:54:56 +03:00
|
|
|
virtual void font(Fl_Font face, Fl_Fontsize size) {font_ = face; size_ = size;}
|
2011-02-06 15:32:23 +03:00
|
|
|
/** \brief see fl_font(void). */
|
2011-02-05 16:54:56 +03:00
|
|
|
Fl_Font font() {return font_; }
|
|
|
|
/** \brief see fl_size(). */
|
|
|
|
Fl_Fontsize size() {return size_; }
|
2011-02-18 16:39:48 +03:00
|
|
|
/** \brief see fl_width(const char *str, int n). */
|
|
|
|
virtual double width(const char *str, int n) = 0;
|
|
|
|
/** \brief see fl_width(unsigned int n). */
|
|
|
|
virtual inline double width(unsigned int c) { char ch = (char)c; return width(&ch, 1); }
|
|
|
|
/** \brief see fl_text_extents(const char*, int n, int& dx, int& dy, int& w, int& h). */
|
|
|
|
virtual void text_extents(const char*, int n, int& dx, int& dy, int& w, int& h);
|
|
|
|
/** \brief see fl_height(). */
|
|
|
|
virtual int height() = 0;
|
|
|
|
/** \brief see fl_descent(). */
|
|
|
|
virtual int descent() = 0;
|
2011-02-06 15:32:23 +03:00
|
|
|
/** \brief see fl_color(void). */
|
|
|
|
Fl_Color color() {return color_;}
|
2011-02-07 16:49:34 +03:00
|
|
|
/** Returns a pointer to the current Fl_Font_Descriptor for the graphics driver */
|
|
|
|
inline Fl_Font_Descriptor *font_descriptor() { return font_descriptor_;}
|
|
|
|
/** Sets the current Fl_Font_Descriptor for the graphics driver */
|
|
|
|
inline void font_descriptor(Fl_Font_Descriptor *d) { font_descriptor_ = d;}
|
2010-05-27 21:20:18 +04:00
|
|
|
/** \brief The destructor */
|
|
|
|
virtual ~Fl_Graphics_Driver() {};
|
2010-03-14 21:07:24 +03:00
|
|
|
};
|
|
|
|
|
2010-04-18 10:57:37 +04:00
|
|
|
#if defined(__APPLE__) || defined(FL_DOXYGEN)
|
|
|
|
/**
|
2010-05-27 21:20:18 +04:00
|
|
|
\brief The Mac OS X-specific graphics class.
|
|
|
|
*
|
|
|
|
This class is implemented only on the Mac OS X platform.
|
2010-04-18 10:57:37 +04:00
|
|
|
*/
|
2010-12-13 02:21:03 +03:00
|
|
|
class FL_EXPORT Fl_Quartz_Graphics_Driver : public Fl_Graphics_Driver {
|
2010-03-14 21:07:24 +03:00
|
|
|
public:
|
2011-01-05 13:21:45 +03:00
|
|
|
static const char *class_id;
|
2011-02-23 17:36:18 +03:00
|
|
|
const char *class_name() {return class_id;};
|
2010-12-28 18:33:36 +03:00
|
|
|
void color(Fl_Color c);
|
|
|
|
void color(uchar r, uchar g, uchar b);
|
2010-12-28 15:02:23 +03:00
|
|
|
void draw(const char* str, int n, int x, int y);
|
2011-02-18 16:39:48 +03:00
|
|
|
#ifdef __APPLE__
|
|
|
|
void draw(const char *str, int n, float x, float y);
|
|
|
|
#endif
|
2010-12-28 15:02:23 +03:00
|
|
|
void draw(int angle, const char *str, int n, int x, int y);
|
|
|
|
void rtl_draw(const char* str, int n, int x, int y);
|
|
|
|
void font(Fl_Font face, Fl_Fontsize size);
|
2010-05-27 21:20:18 +04:00
|
|
|
void draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
|
|
|
|
void draw(Fl_Bitmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
|
|
|
|
void draw(Fl_RGB_Image *img, int XP, int YP, int WP, int HP, int cx, int cy);
|
2010-12-28 18:17:23 +03:00
|
|
|
void draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0);
|
|
|
|
void draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3);
|
|
|
|
void draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0);
|
|
|
|
void draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=1);
|
2011-02-18 16:39:48 +03:00
|
|
|
double width(const char *str, int n);
|
|
|
|
double width(unsigned int c);
|
|
|
|
void text_extents(const char*, int n, int& dx, int& dy, int& w, int& h);
|
|
|
|
int height();
|
|
|
|
int descent();
|
2010-03-14 21:07:24 +03:00
|
|
|
};
|
2010-04-18 10:57:37 +04:00
|
|
|
#endif
|
|
|
|
#if defined(WIN32) || defined(FL_DOXYGEN)
|
2010-03-14 21:07:24 +03:00
|
|
|
/**
|
2010-05-27 21:20:18 +04:00
|
|
|
\brief The MSWindows-specific graphics class.
|
|
|
|
*
|
|
|
|
This class is implemented only on the MSWindows platform.
|
2010-03-14 21:07:24 +03:00
|
|
|
*/
|
2010-12-13 02:21:03 +03:00
|
|
|
class FL_EXPORT Fl_GDI_Graphics_Driver : public Fl_Graphics_Driver {
|
2010-03-14 21:07:24 +03:00
|
|
|
public:
|
2011-01-05 13:21:45 +03:00
|
|
|
static const char *class_id;
|
2011-02-23 17:36:18 +03:00
|
|
|
const char *class_name() {return class_id;};
|
2010-12-28 18:33:36 +03:00
|
|
|
void color(Fl_Color c);
|
|
|
|
void color(uchar r, uchar g, uchar b);
|
2010-12-28 15:02:23 +03:00
|
|
|
void draw(const char* str, int n, int x, int y);
|
|
|
|
void draw(int angle, const char *str, int n, int x, int y);
|
|
|
|
void rtl_draw(const char* str, int n, int x, int y);
|
|
|
|
void font(Fl_Font face, Fl_Fontsize size);
|
2010-05-27 21:20:18 +04:00
|
|
|
void draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
|
|
|
|
void draw(Fl_Bitmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
|
|
|
|
void draw(Fl_RGB_Image *img, int XP, int YP, int WP, int HP, int cx, int cy);
|
2010-12-28 18:17:23 +03:00
|
|
|
void draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0);
|
|
|
|
void draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3);
|
|
|
|
void draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0);
|
|
|
|
void draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=1);
|
2011-02-18 16:39:48 +03:00
|
|
|
double width(const char *str, int n);
|
|
|
|
double width(unsigned int c);
|
|
|
|
void text_extents(const char*, int n, int& dx, int& dy, int& w, int& h);
|
|
|
|
int height();
|
|
|
|
int descent();
|
2010-03-14 21:07:24 +03:00
|
|
|
};
|
|
|
|
#endif
|
2010-05-27 21:20:18 +04:00
|
|
|
#if !(defined(__APPLE__) || defined(WIN32))
|
2010-03-14 21:07:24 +03:00
|
|
|
/**
|
2010-05-27 21:20:18 +04:00
|
|
|
\brief The Xlib-specific graphics class.
|
|
|
|
*
|
|
|
|
This class is implemented only on the Xlib platform.
|
2010-04-18 10:57:37 +04:00
|
|
|
*/
|
2010-05-27 21:20:18 +04:00
|
|
|
class Fl_Xlib_Graphics_Driver : public Fl_Graphics_Driver {
|
2010-03-14 21:07:24 +03:00
|
|
|
public:
|
2011-01-05 13:21:45 +03:00
|
|
|
static const char *class_id;
|
2011-02-23 17:36:18 +03:00
|
|
|
const char *class_name() {return class_id;};
|
2010-12-28 18:33:36 +03:00
|
|
|
void color(Fl_Color c);
|
|
|
|
void color(uchar r, uchar g, uchar b);
|
2010-12-28 15:02:23 +03:00
|
|
|
void draw(const char* str, int n, int x, int y);
|
|
|
|
void draw(int angle, const char *str, int n, int x, int y);
|
|
|
|
void rtl_draw(const char* str, int n, int x, int y);
|
|
|
|
void font(Fl_Font face, Fl_Fontsize size);
|
2010-05-27 21:20:18 +04:00
|
|
|
void draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
|
|
|
|
void draw(Fl_Bitmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
|
|
|
|
void draw(Fl_RGB_Image *img, int XP, int YP, int WP, int HP, int cx, int cy);
|
2010-12-28 18:17:23 +03:00
|
|
|
void draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0);
|
|
|
|
void draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3);
|
|
|
|
void draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0);
|
|
|
|
void draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=1);
|
2011-02-18 16:39:48 +03:00
|
|
|
double width(const char *str, int n);
|
|
|
|
double width(unsigned int c);
|
|
|
|
void text_extents(const char*, int n, int& dx, int& dy, int& w, int& h);
|
|
|
|
int height();
|
|
|
|
int descent();
|
2010-03-14 21:07:24 +03:00
|
|
|
};
|
2010-04-18 10:57:37 +04:00
|
|
|
#endif
|
2010-03-14 21:07:24 +03:00
|
|
|
|
2010-05-27 21:20:18 +04:00
|
|
|
/**
|
|
|
|
\brief A surface that's susceptible to receive graphical output.
|
|
|
|
*/
|
2010-12-13 02:21:03 +03:00
|
|
|
class FL_EXPORT Fl_Surface_Device : public Fl_Device {
|
2010-05-27 21:20:18 +04:00
|
|
|
/** \brief The graphics driver in use by this surface. */
|
|
|
|
Fl_Graphics_Driver *_driver;
|
2011-02-02 15:42:47 +03:00
|
|
|
static Fl_Surface_Device *_surface; // the surface that currently receives graphics output
|
2010-05-27 21:20:18 +04:00
|
|
|
protected:
|
|
|
|
/** \brief Constructor that sets the graphics driver to use for the created surface. */
|
|
|
|
Fl_Surface_Device(Fl_Graphics_Driver *graphics_driver) {_driver = graphics_driver; };
|
|
|
|
public:
|
2011-01-05 13:21:45 +03:00
|
|
|
static const char *class_id;
|
2011-02-23 17:36:18 +03:00
|
|
|
const char *class_name() {return class_id;};
|
2010-05-27 21:20:18 +04:00
|
|
|
virtual void set_current(void);
|
|
|
|
/** \brief Sets the graphics driver of this drawing surface. */
|
|
|
|
inline void driver(Fl_Graphics_Driver *graphics_driver) {_driver = graphics_driver;};
|
|
|
|
/** \brief Returns the graphics driver of this drawing surface. */
|
|
|
|
inline Fl_Graphics_Driver *driver() {return _driver; };
|
|
|
|
/** \brief the surface that currently receives graphics output */
|
2011-02-02 15:42:47 +03:00
|
|
|
static inline Fl_Surface_Device *surface() {return _surface; };
|
2010-05-27 21:20:18 +04:00
|
|
|
/** \brief The destructor. */
|
|
|
|
virtual ~Fl_Surface_Device() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
\brief A display to which the computer can draw.
|
|
|
|
*/
|
2010-12-13 02:21:03 +03:00
|
|
|
class FL_EXPORT Fl_Display_Device : public Fl_Surface_Device {
|
2011-02-02 15:42:47 +03:00
|
|
|
static Fl_Display_Device *_display; // the platform display device
|
2010-05-27 21:20:18 +04:00
|
|
|
public:
|
2011-01-05 13:21:45 +03:00
|
|
|
static const char *class_id;
|
2011-02-23 17:36:18 +03:00
|
|
|
const char *class_name() {return class_id;};
|
2010-05-27 21:20:18 +04:00
|
|
|
/** \brief A constructor that sets the graphics driver used by the display */
|
2011-03-01 14:58:36 +03:00
|
|
|
Fl_Display_Device(Fl_Graphics_Driver *graphics_driver);
|
2011-02-02 15:42:47 +03:00
|
|
|
/** Returns the platform display device. */
|
|
|
|
static inline Fl_Display_Device *display_device() {return _display;};
|
2010-05-27 21:20:18 +04:00
|
|
|
};
|
|
|
|
|
2010-12-12 19:13:55 +03:00
|
|
|
/**
|
|
|
|
This plugin socket allows the integration of new device drivers for special
|
|
|
|
window or screen types. It is currently used to provide an automated printing
|
|
|
|
service for OpenGL windows, if linked with fltk_gl.
|
|
|
|
*/
|
2010-12-13 02:21:03 +03:00
|
|
|
class FL_EXPORT Fl_Device_Plugin : public Fl_Plugin {
|
2010-12-12 19:13:55 +03:00
|
|
|
public:
|
|
|
|
/** \brief The constructor */
|
|
|
|
Fl_Device_Plugin(const char *name)
|
|
|
|
: Fl_Plugin(klass(), name) { }
|
|
|
|
/** \brief Returns the class name */
|
|
|
|
virtual const char *klass() { return "fltk:device"; }
|
|
|
|
/** \brief Returns the plugin name */
|
|
|
|
virtual const char *name() = 0;
|
|
|
|
/** \brief Prints a widget
|
|
|
|
\param w the widget
|
|
|
|
\param x,y offsets where to print relatively to coordinates origin
|
|
|
|
\param height height of the current drawing area
|
|
|
|
*/
|
2011-01-10 15:02:48 +03:00
|
|
|
virtual int print(Fl_Widget* w, int x, int y, int height) = 0;
|
2010-12-12 19:13:55 +03:00
|
|
|
};
|
|
|
|
|
2010-03-14 21:07:24 +03:00
|
|
|
#endif // Fl_Device_H
|
2010-03-18 18:15:41 +03:00
|
|
|
|
|
|
|
//
|
|
|
|
// End of "$Id$".
|
|
|
|
//
|