FLTK 1.4.4: Fl_Image_Surface.H Source File

FLTK 1.4.4

Loading...
Searching...
No Matches
Fl_Image_Surface.H
1//
2// Draw-to-image code for the Fast Light Tool Kit (FLTK).
3//
4// Copyright 1998-2016 by Bill Spitzak and others.
5//
6// This library is free software. Distribution and use rights are outlined in
7// the file "COPYING" which should have been included with this file. If this
8// file is missing or damaged, see the license at:
9//
10// https://www.fltk.org/COPYING.php
11//
12// Please see the following page on how to report bugs and issues:
13//
14// https://www.fltk.org/bugs.php
15//
16
17#ifndef Fl_Image_Surface_H
18#define Fl_Image_Surface_H
19
20#include <FL/Fl_Widget_Surface.H>
21#include <FL/Fl_Image.H>
22#include <FL/Fl_Shared_Image.H>
23#include <FL/platform_types.h> // for Fl_Offscreen
24
25
65 class FL_EXPORT Fl_Image_Surface : public Fl_Widget_Surface {
66 friend class Fl_Graphics_Driver;
67private:
68 class Fl_Image_Surface_Driver *platform_surface;
69 Fl_Offscreen get_offscreen_before_delete_();
70protected:
71 void translate(int x, int y) FL_OVERRIDE;
72 void untranslate() FL_OVERRIDE;
73public:
74 Fl_Image_Surface(int w, int h, int high_res = 0, Fl_Offscreen off = 0);
75 ~Fl_Image_Surface();
76 void set_current() FL_OVERRIDE;
77 bool is_current() FL_OVERRIDE;
78 Fl_RGB_Image *image();
79 Fl_Shared_Image *highres_image();
80 void origin(int *x, int *y) FL_OVERRIDE;
81 void origin(int x, int y) FL_OVERRIDE;
82 int printable_rect(int *w, int *h) FL_OVERRIDE;
83 Fl_Offscreen offscreen();
84 void rescale();
85 void mask(const Fl_RGB_Image *);
86};
87
88
94
100class Fl_Image_Surface_Driver : public Fl_Widget_Surface {
101 friend class Fl_Image_Surface;
102private:
103 Fl_Image_Surface *image_surface_;
104protected:
105 int width;
106 int height;
107 Fl_Offscreen offscreen;
108 int external_offscreen;
109 Fl_Image_Surface_Driver(int w, int h, int /*high_res*/, Fl_Offscreen off) : Fl_Widget_Surface(NULL), width(w), height(h), offscreen(off) {external_offscreen = (off != 0);}
110 virtual ~Fl_Image_Surface_Driver() {}
111 static void copy_with_mask(Fl_RGB_Image* mask, uchar *dib_dst, uchar *dib_src,
112 int line_size, bool bottom_to_top);
113 static Fl_RGB_Image *RGB3_to_RGB1(const Fl_RGB_Image *rgb3, int W, int H);
114 void set_current() FL_OVERRIDE = 0;
115 void translate(int x, int y) FL_OVERRIDE = 0;
116 void untranslate() FL_OVERRIDE = 0;
117 int printable_rect(int *w, int *h) FL_OVERRIDE;
118 virtual Fl_RGB_Image *image() = 0;
119 virtual void mask(const Fl_RGB_Image *) {}
124 static Fl_Image_Surface_Driver *newImageSurfaceDriver(int w, int h, int high_res, Fl_Offscreen off);
125public:
127 Fl_Image_Surface *image_surface() { return image_surface_; }
128};
129
134
135#endif // Fl_Image_Surface_H
Fl_Image.H
Fl_Image, Fl_RGB_Image classes.
Fl_Shared_Image.H
Fl_Shared_Image class.
Fl_Image_Surface
Directs all graphics requests to an Fl_Image.
Definition Fl_Image_Surface.H:65
Fl_Image_Surface::highres_image
Fl_Shared_Image * highres_image()
Returns a possibly high resolution image made of all drawings sent to the Fl_Image_Surface object.
Definition Fl_Image_Surface.cxx:168
Fl_Image_Surface::rescale
void rescale()
Adapts the Fl_Image_Surface object to the new value of the GUI scale factor.
Definition Fl_Image_Surface.cxx:190
Fl_Image_Surface::Fl_Image_Surface
Fl_Image_Surface(int w, int h, int high_res=0, Fl_Offscreen off=0)
Constructor with optional high resolution.
Definition Fl_Image_Surface.cxx:38
Fl_Image_Surface::image
Fl_RGB_Image * image()
Returns a depth-3 image made of all drawings sent to the Fl_Image_Surface object.
Definition Fl_Image_Surface.cxx:151
Fl_Image_Surface::mask
void mask(const Fl_RGB_Image *)
Defines a mask applied to drawings made after use of this function.
Definition Fl_Image_Surface.cxx:260
Fl_Image_Surface::offscreen
Fl_Offscreen offscreen()
Returns the Fl_Offscreen object associated to the image surface.
Definition Fl_Image_Surface.cxx:77
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_Shared_Image
This class supports caching, loading, and drawing of image files.
Definition Fl_Shared_Image.H:94
Fl_Surface_Device::is_current
virtual bool is_current()
Is this surface the current drawing surface?
Definition Fl_Device.cxx:103
Fl_Surface_Device::set_current
virtual void set_current(void)
Make this surface the current drawing surface.
Definition Fl_Device.cxx:91
Fl_Widget_Surface
A surface on which any FLTK widget can be drawn.
Definition Fl_Widget_Surface.H:25
Fl_Widget_Surface::printable_rect
virtual int printable_rect(int *w, int *h)
Computes the width and height of the drawable area of the drawing surface.
Definition Fl_Widget_Surface.cxx:190
Fl_Widget_Surface::Fl_Widget_Surface
Fl_Widget_Surface(Fl_Graphics_Driver *d)
The constructor.
Definition Fl_Widget_Surface.cxx:28
Fl_Widget_Surface::origin
virtual void origin(int x, int y)
Sets the position of the origin of graphics in the drawable part of the drawing surface.
Definition Fl_Widget_Surface.cxx:145
Fl_Widget_Surface::untranslate
virtual void untranslate()
Undoes the effect of a previous translate() call.
Definition Fl_Widget_Surface.cxx:121
Fl_Widget_Surface::translate
virtual void translate(int x, int y)
Translates the current graphics origin accounting for the current rotation.
Definition Fl_Widget_Surface.cxx:114
FL_OVERRIDE
#define FL_OVERRIDE
This macro makes it safe to use the C++11 keyword override with older compilers.
Definition fl_attr.h:46
uchar
unsigned char uchar
unsigned char
Definition fl_types.h:30
platform_types.h
Definitions of platform-dependent types.
Fl_Offscreen
opaque Fl_Offscreen
Platform-specific value representing an offscreen drawing buffer.
Definition platform_types.h:46