FLTK 1.4.4: Fl_Device.H Source File

FLTK 1.4.4

Loading...
Searching...
No Matches
Fl_Device.H
Go to the documentation of this file.
1//
2// Definition of classes Fl_Surface_Device, Fl_Display_Device
3// for the Fast Light Tool Kit (FLTK).
4//
5// Copyright 2010-2021 by Bill Spitzak and others.
6//
7// This library is free software. Distribution and use rights are outlined in
8// the file "COPYING" which should have been included with this file. If this
9// file is missing or damaged, see the license at:
10//
11// https://www.fltk.org/COPYING.php
12//
13// Please see the following page on how to report bugs and issues:
14//
15// https://www.fltk.org/bugs.php
16//
17
21
22#ifndef Fl_Device_H
23#define Fl_Device_H
24
25#include <FL/Fl_Plugin.H>
26#include <FL/platform_types.h>
27
28class Fl_Graphics_Driver;
29class Fl_RGB_Image;
30class Fl_Widget;
31class Fl_Image_Surface;
32
57 class FL_EXPORT Fl_Surface_Device {
59 Fl_Graphics_Driver *pGraphicsDriver;
60 static Fl_Surface_Device *surface_; // the surface that currently receives graphics requests
61 static Fl_Surface_Device *default_surface(); // create surface if none exists yet
62protected:
67 virtual void end_current() { surface_ = 0;}
69 Fl_Surface_Device(Fl_Graphics_Driver *graphics_driver) {pGraphicsDriver = graphics_driver; }
71 inline void driver(Fl_Graphics_Driver *graphics_driver) {pGraphicsDriver = graphics_driver;}
72public:
73 virtual void set_current(void);
74 virtual bool is_current();
76 inline Fl_Graphics_Driver *driver() {return pGraphicsDriver; }
81 static inline Fl_Surface_Device *surface() {
82 return surface_ ? surface_ : default_surface();
83 }
84
85 virtual ~Fl_Surface_Device();
86 static void push_current(Fl_Surface_Device *new_current);
87 static Fl_Surface_Device *pop_current();
88};
89
95 class FL_EXPORT Fl_Display_Device : public Fl_Surface_Device {
96 Fl_Display_Device(Fl_Graphics_Driver *graphics_driver);
97public:
98 static Fl_Display_Device *display_device();
99};
100
108 class Fl_Device_Plugin : public Fl_Plugin {
109public:
111 Fl_Device_Plugin(const char *pluginName)
112 : Fl_Plugin(klass(), pluginName) { }
113
114 virtual const char *klass() { return "fltk:device"; }
116 virtual const char *name() = 0;
118 virtual int print(Fl_Widget* w) = 0;
122 virtual Fl_RGB_Image* rectangle_capture(Fl_Widget *widget, int x, int y, int w, int h) = 0;
124 static Fl_Device_Plugin *opengl_plugin();
125};
126
127#endif // Fl_Device_H
Fl_Device_Plugin::opengl_plugin
static Fl_Device_Plugin * opengl_plugin()
Returns the OpenGL plugin.
Definition Fl_Device.cxx:160
Fl_Device_Plugin::print
virtual int print(Fl_Widget *w)=0
Prints a widget.
Fl_Device_Plugin::Fl_Device_Plugin
Fl_Device_Plugin(const char *pluginName)
The constructor.
Definition Fl_Device.H:111
Fl_Device_Plugin::klass
virtual const char * klass()
Returns the class name.
Definition Fl_Device.H:114
Fl_Device_Plugin::name
virtual const char * name()=0
Returns the plugin name.
Fl_Device_Plugin::rectangle_capture
virtual Fl_RGB_Image * rectangle_capture(Fl_Widget *widget, int x, int y, int w, int h)=0
Captures a rectangle of a widget as an image.
Fl_Display_Device::display_device
static Fl_Display_Device * display_device()
Returns a pointer to the unique display device.
Definition Fl_Device.cxx:119
Fl_Image_Surface
Directs all graphics requests to an Fl_Image.
Definition Fl_Image_Surface.H:65
Fl_Plugin::Fl_Plugin
Fl_Plugin(const char *klass, const char *name)
Create a plugin.
Definition Fl_Preferences.cxx:1956
Fl_RGB_Image
The Fl_RGB_Image class supports caching and drawing of full-color images with 1 to 4 channels of colo...
Definition Fl_Image.H:339
Fl_Surface_Device
A drawing surface that's susceptible to receive graphical output.
Definition Fl_Device.H:57
Fl_Surface_Device::driver
void driver(Fl_Graphics_Driver *graphics_driver)
Sets the graphics driver of this drawing surface.
Definition Fl_Device.H:71
Fl_Surface_Device::end_current
virtual void end_current()
FLTK calls this each time a surface ceases to be the current drawing surface.
Definition Fl_Device.H:67
Fl_Surface_Device::driver
Fl_Graphics_Driver * driver()
Returns the graphics driver of this drawing surface.
Definition Fl_Device.H:76
Fl_Surface_Device::Fl_Surface_Device
Fl_Surface_Device(Fl_Graphics_Driver *graphics_driver)
Constructor that sets the graphics driver to use for the created surface.
Definition Fl_Device.H:69
Fl_Surface_Device::surface
static Fl_Surface_Device * surface()
The current drawing surface.
Definition Fl_Device.H:81
Fl_Widget
Fl_Widget is the base class for all widgets in FLTK.
Definition Fl_Widget.H:112
platform_types.h
Definitions of platform-dependent types.