Mercurial > hg > orthanc-stone
annotate Framework/Wrappers/CairoSurface.h @ 1290:7def6ab2929f bugs/2020-02-invisible-slice
Removal of debugging logs
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Fri, 21 Feb 2020 15:20:29 +0100 |
parents | 2d8ab34c8c91 |
children | 30deba7bc8e2 |
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 | |
1270
2d8ab34c8c91
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
807
diff
changeset
|
5 * Copyright (C) 2017-2020 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_; | |
560
aaeec7be8fb7
add support for alpha channel in CairoSurface
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
556
diff
changeset
|
39 bool hasAlpha_; |
0 | 40 |
41 void Release(); | |
42 | |
43 void Allocate(unsigned int width, | |
560
aaeec7be8fb7
add support for alpha channel in CairoSurface
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
556
diff
changeset
|
44 unsigned int height, |
aaeec7be8fb7
add support for alpha channel in CairoSurface
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
556
diff
changeset
|
45 bool hasAlpha); |
0 | 46 |
47 public: | |
48 CairoSurface() : | |
49 surface_(NULL) | |
50 { | |
560
aaeec7be8fb7
add support for alpha channel in CairoSurface
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
556
diff
changeset
|
51 Allocate(0, 0, false); |
0 | 52 } |
53 | |
54 CairoSurface(unsigned int width, | |
560
aaeec7be8fb7
add support for alpha channel in CairoSurface
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
556
diff
changeset
|
55 unsigned int height, |
aaeec7be8fb7
add support for alpha channel in CairoSurface
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
556
diff
changeset
|
56 bool hasAlpha) : |
0 | 57 surface_(NULL) |
58 { | |
560
aaeec7be8fb7
add support for alpha channel in CairoSurface
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
556
diff
changeset
|
59 Allocate(width, height, hasAlpha); |
0 | 60 } |
61 | |
560
aaeec7be8fb7
add support for alpha channel in CairoSurface
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
556
diff
changeset
|
62 CairoSurface(Orthanc::ImageAccessor& accessor, |
aaeec7be8fb7
add support for alpha channel in CairoSurface
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
556
diff
changeset
|
63 bool hasAlpha); |
0 | 64 |
65 ~CairoSurface() | |
66 { | |
67 Release(); | |
68 } | |
69 | |
70 void SetSize(unsigned int width, | |
560
aaeec7be8fb7
add support for alpha channel in CairoSurface
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
556
diff
changeset
|
71 unsigned int height, |
aaeec7be8fb7
add support for alpha channel in CairoSurface
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
556
diff
changeset
|
72 bool hasAlpha); |
0 | 73 |
74 void Copy(const CairoSurface& other); | |
75 | |
560
aaeec7be8fb7
add support for alpha channel in CairoSurface
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
556
diff
changeset
|
76 void Copy(const Orthanc::ImageAccessor& source, |
aaeec7be8fb7
add support for alpha channel in CairoSurface
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
556
diff
changeset
|
77 bool hasAlpha); |
556
b1e1eccee214
CairoSurface::Copy()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
78 |
0 | 79 unsigned int GetWidth() const |
80 { | |
81 return width_; | |
82 } | |
83 | |
84 unsigned int GetHeight() const | |
85 { | |
86 return height_; | |
87 } | |
88 | |
89 unsigned int GetPitch() const | |
90 { | |
91 return pitch_; | |
92 } | |
93 | |
94 const void* GetBuffer() const | |
95 { | |
96 return buffer_; | |
97 } | |
98 | |
99 void* GetBuffer() | |
100 { | |
101 return buffer_; | |
102 } | |
103 | |
104 cairo_surface_t* GetObject() | |
105 { | |
106 return surface_; | |
107 } | |
108 | |
560
aaeec7be8fb7
add support for alpha channel in CairoSurface
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
556
diff
changeset
|
109 bool HasAlpha() const |
aaeec7be8fb7
add support for alpha channel in CairoSurface
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
556
diff
changeset
|
110 { |
aaeec7be8fb7
add support for alpha channel in CairoSurface
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
556
diff
changeset
|
111 return hasAlpha_; |
aaeec7be8fb7
add support for alpha channel in CairoSurface
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
556
diff
changeset
|
112 } |
aaeec7be8fb7
add support for alpha channel in CairoSurface
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
556
diff
changeset
|
113 |
316
ce48c3b3b0e9
fix for new ImageAccessor API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
212
diff
changeset
|
114 void GetReadOnlyAccessor(Orthanc::ImageAccessor& target) const; |
0 | 115 |
316
ce48c3b3b0e9
fix for new ImageAccessor API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
212
diff
changeset
|
116 void GetWriteableAccessor(Orthanc::ImageAccessor& target); |
0 | 117 }; |
118 } |