Mercurial > hg > orthanc-stone
annotate Framework/Viewport/CairoSurface.h @ 556:b1e1eccee214
CairoSurface::Copy()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 17 Apr 2019 14:37:18 +0200 |
parents | b70e9be013e4 |
children | aaeec7be8fb7 |
rev | line source |
---|---|
0 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
439 | 5 * Copyright (C) 2017-2019 Osimis S.A., Belgium |
0 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
47 | 8 * modify it under the terms of the GNU Affero General Public License |
9 * as published by the Free Software Foundation, either version 3 of | |
10 * the License, or (at your option) any later version. | |
0 | 11 * |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
47 | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 * Affero General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Affero General Public License | |
0 | 18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 **/ | |
20 | |
21 | |
22 #pragma once | |
23 | |
212
5412adf19980
resort to OrthancFramework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
24 #include <Core/Images/ImageAccessor.h> |
0 | 25 |
26 #include <boost/noncopyable.hpp> | |
27 #include <cairo.h> | |
28 | |
29 namespace OrthancStone | |
30 { | |
31 class CairoSurface : public boost::noncopyable | |
32 { | |
33 private: | |
34 cairo_surface_t* surface_; | |
35 unsigned int width_; | |
36 unsigned int height_; | |
37 unsigned int pitch_; | |
38 void* buffer_; | |
39 | |
40 void Release(); | |
41 | |
42 void Allocate(unsigned int width, | |
43 unsigned int height); | |
44 | |
45 public: | |
46 CairoSurface() : | |
47 surface_(NULL) | |
48 { | |
49 Allocate(0, 0); | |
50 } | |
51 | |
52 CairoSurface(unsigned int width, | |
53 unsigned int height) : | |
54 surface_(NULL) | |
55 { | |
56 Allocate(width, height); | |
57 } | |
58 | |
556
b1e1eccee214
CairoSurface::Copy()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
59 private: |
0 | 60 CairoSurface(Orthanc::ImageAccessor& accessor); |
61 | |
556
b1e1eccee214
CairoSurface::Copy()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
62 public: |
0 | 63 ~CairoSurface() |
64 { | |
65 Release(); | |
66 } | |
67 | |
68 void SetSize(unsigned int width, | |
69 unsigned int height); | |
70 | |
71 void Copy(const CairoSurface& other); | |
72 | |
556
b1e1eccee214
CairoSurface::Copy()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
73 void Copy(const Orthanc::ImageAccessor& source); |
b1e1eccee214
CairoSurface::Copy()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
74 |
0 | 75 unsigned int GetWidth() const |
76 { | |
77 return width_; | |
78 } | |
79 | |
80 unsigned int GetHeight() const | |
81 { | |
82 return height_; | |
83 } | |
84 | |
85 unsigned int GetPitch() const | |
86 { | |
87 return pitch_; | |
88 } | |
89 | |
90 const void* GetBuffer() const | |
91 { | |
92 return buffer_; | |
93 } | |
94 | |
95 void* GetBuffer() | |
96 { | |
97 return buffer_; | |
98 } | |
99 | |
100 cairo_surface_t* GetObject() | |
101 { | |
102 return surface_; | |
103 } | |
104 | |
316
ce48c3b3b0e9
fix for new ImageAccessor API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
212
diff
changeset
|
105 void GetReadOnlyAccessor(Orthanc::ImageAccessor& target) const; |
0 | 106 |
316
ce48c3b3b0e9
fix for new ImageAccessor API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
212
diff
changeset
|
107 void GetWriteableAccessor(Orthanc::ImageAccessor& target); |
0 | 108 }; |
109 } |