Mercurial > hg > orthanc-stone
annotate OrthancStone/Sources/Fonts/Glyph.cpp @ 1939:efed41b76dc7
todo
author | Alain Mazy <am@osimis.io> |
---|---|
date | Tue, 10 May 2022 15:58:58 +0200 |
parents | 7053b8a0aaec |
children | 07964689cb0b |
rev | line source |
---|---|
576 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
1871
7053b8a0aaec
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1870
diff
changeset
|
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium |
7053b8a0aaec
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1870
diff
changeset
|
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
576 | 7 * |
8 * This program is free software: you can redistribute it and/or | |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
9 * modify it under the terms of the GNU Lesser General Public License |
576 | 10 * as published by the Free Software Foundation, either version 3 of |
11 * the License, or (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, but | |
14 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
16 * Lesser General Public License for more details. |
1596
4fb8fdf03314
removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
17 * |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
18 * You should have received a copy of the GNU Lesser General Public |
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
19 * License along with this program. If not, see |
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
20 * <http://www.gnu.org/licenses/>. |
576 | 21 **/ |
22 | |
23 | |
24 #include "Glyph.h" | |
25 | |
1455
30deba7bc8e2
simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1270
diff
changeset
|
26 #include <OrthancException.h> |
576 | 27 |
28 | |
29 namespace OrthancStone | |
30 { | |
31 Glyph::Glyph(const Glyph& other) : | |
32 width_(other.width_), | |
33 height_(other.height_), | |
34 offsetLeft_(other.offsetLeft_), | |
35 offsetTop_(other.offsetTop_), | |
36 advanceX_(other.advanceX_), | |
37 lineHeight_(other.lineHeight_) | |
38 { | |
39 } | |
40 | |
41 | |
42 Glyph::Glyph(unsigned int width, | |
43 unsigned int height, | |
44 int offsetLeft, | |
45 int offsetTop, | |
46 int advanceX, | |
47 unsigned int lineHeight) : | |
48 width_(width), | |
49 height_(height), | |
50 offsetLeft_(offsetLeft), | |
51 offsetTop_(offsetTop), | |
52 advanceX_(advanceX), | |
53 lineHeight_(lineHeight) | |
54 { | |
55 } | |
56 | |
57 | |
58 void Glyph::SetPayload(Orthanc::IDynamicObject* payload) // Takes ownership | |
59 { | |
60 if (payload == NULL) | |
61 { | |
62 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer); | |
63 } | |
64 else | |
65 { | |
66 payload_.reset(payload); | |
67 } | |
68 } | |
69 | |
70 | |
71 const Orthanc::IDynamicObject& Glyph::GetPayload() const | |
72 { | |
73 if (payload_.get() == NULL) | |
74 { | |
75 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); | |
76 } | |
77 else | |
78 { | |
79 return *payload_; | |
80 } | |
81 } | |
82 | |
83 | |
84 Orthanc::IDynamicObject* Glyph::ReleasePayload() | |
85 { | |
86 if (payload_.get() == NULL) | |
87 { | |
88 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); | |
89 } | |
90 else | |
91 { | |
92 return payload_.release(); | |
93 } | |
94 } | |
95 } |