Painter.h
1 /* Copyright (C) 2015 Marc Boris Duerner
2 
3  This library is free software; you can redistribute it and/or
4  modify it under the terms of the GNU Lesser General Public
5  License as published by the Free Software Foundation; either
6  version 2.1 of the License, or (at your option) any later version.
7 
8  As a special exception, you may use this file as part of a free
9  software library without restriction. Specifically, if other files
10  instantiate templates or use macros or inline functions from this
11  file, or you compile this file and link it with other files to
12  produce an executable, this file does not by itself cause the
13  resulting executable to be covered by the GNU General Public
14  License. This exception does not however invalidate any other
15  reasons why the executable file might be covered by the GNU Library
16  General Public License.
17 
18  This library is distributed in the hope that it will be useful,
19  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21  Lesser General Public License for more details.
22 
23  You should have received a copy of the GNU Lesser General Public
24  License along with this library; if not, write to the Free Software
25  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
26  MA 02110-1301 USA
27 */
28 
29 #ifndef Pt_Forms_Painter_h
30 #define Pt_Forms_Painter_h
31 
32 #include <Pt/Forms/Api.h>
33 #include <Pt/Forms/PaintSurface.h>
34 #include <Pt/Gfx/PainterBase.h>
35 
36 namespace Pt {
37 
38 namespace Forms {
39 
40 class PaintContext;
41 class Pixmap;
42 
45 class PT_FORMS_API Painter : public Gfx::PainterBase
46 {
47  public:
51 
54  explicit Painter(PaintSurface& surface);
55 
58  explicit Painter(PaintContext& context);
59 
62  virtual ~Painter();
63 
66  void begin(PaintSurface& surface);
67 
70  void begin(PaintContext& context);
71 
74  void drawPixmap(const Gfx::PointF& to, const Pixmap& pixmap);
75 
78  void drawPixmap(const Gfx::PointF& to, const Pixmap& pixmap,
79  const Gfx::RectF& rect);
80 
81  protected:
82  virtual void onDetachSurface(Gfx::PaintSurface& surface);
83 
84  private:
85  PaintSurface* _formsSurface;
86 };
87 
88 } // namespace
89 
90 } // namespace
91 
92 #endif
Core module.
Definition: Allocator.h:33
Painter(PaintSurface &surface)
Constructs using a Forms paint surface.
Painter()
Default constructor.
Paint surface.
Definition: PaintSurface.h:44
2D painter for Forms paint surfaces.
Definition: Painter.h:46
Paint context.
Definition: PaintContext.h:45
Base class for drawing commands and paint state.
Definition: PainterBase.h:73
Point with floating-point X and Y coordinates.
Definition: Point.h:45
virtual ~Painter()
Destructor.
void drawPixmap(const Gfx::PointF &to, const Pixmap &pixmap)
Draws a pixmap.
Abstract target for drawing operations.
Definition: PaintSurface.h:55
void drawPixmap(const Gfx::PointF &to, const Pixmap &pixmap, const Gfx::RectF &rect)
Draws a part of a pixmap.
void begin(PaintContext &context)
Begins painting to a Forms paint context.
Rect with floating-point coordinates.
Definition: Rect.h:45
Back buffer drawing surface.
Definition: Pixmap.h:51
virtual void onDetachSurface(Gfx::PaintSurface &surface)
Called when the surface is detached.
Painter(PaintContext &context)
Constructs using a Forms paint context.
void begin(PaintSurface &surface)
Begins painting to a Forms paint surface.