PaintContext.h
1/* Copyright (C) 2015 Laurentiu-Gheorghe Crisan
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_PaintContext_h
30#define Pt_Forms_PaintContext_h
31
32#include <Pt/Forms/Api.h>
33#include <Pt/Forms/PaintSurface.h>
34#include <Pt/Gfx/PaintContext.h>
35
36namespace Pt {
37
38namespace Forms {
39
40class Painter;
41
50class PT_FORMS_API PaintContext : public Gfx::PaintContext
51{
52 friend class Painter;
53
54 public:
57 explicit PaintContext(PaintSurface& surface);
58
61 PaintContext(PaintSurface& surface, const Gfx::RectF& clip);
62
66
69 PaintSurface& paintSurface();
70
71 protected:
74 virtual void onDetachSurface(Gfx::PaintSurface& surface) override;
75
76 private:
77 PaintSurface* surface();
78
79 private:
80 PaintSurface* _surface;
81};
82
83} // namespace
84
85} // namespace
86
87#endif
PaintSurface & paintSurface()
Returns the Forms paint surface.
PaintContext(PaintSurface &surface)
Constructs a context for surface.
~PaintContext()
Destructor.
virtual void onDetachSurface(Gfx::PaintSurface &surface) override
Clears the Forms surface binding when the Gfx surface detaches.
PaintContext(PaintSurface &surface, const Gfx::RectF &clip)
Constructs a context for surface with initial clip clip.
Draws on a Forms paint surface or paint context.
Definition Painter.h:53
Active painting session on a surface.
Definition PaintContext.h:61
const RectF * clip() const
Returns the default clip rect or null if clipping is disabled.
Target for drawing operations.
Definition PaintSurface.h:66
Graphical user interfaces.
Definition ActivateEvent.h:40
Core module.
Definition Allocator.h:33