annotate OrthancStone/Sources/Toolbox/TextRenderer.h @ 1653:2e3b2ed239b9

Fixed usage of object cookie
author Benjamin Golinvaux <bgo@osimis.io>
date Mon, 16 Nov 2020 22:17:01 +0100
parents 8563ea5d8ae4
children 9ac2a65d4172
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1463
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
1 /**
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
2 * Stone of Orthanc
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
4 * Department, University Hospital of Liege, Belgium
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
6 *
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
7 * 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: 1512
diff changeset
8 * modify it under the terms of the GNU Lesser General Public License
1463
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
10 * the License, or (at your option) any later version.
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
11 *
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
12 * This program is distributed in the hope that it will be useful, but
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
13 * 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: 1512
diff changeset
14 * 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: 1512
diff changeset
15 * Lesser General Public License for more details.
1463
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
16 *
1598
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
17 * 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: 1512
diff changeset
18 * 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: 1512
diff changeset
19 * <http://www.gnu.org/licenses/>.
1463
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
20 **/
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
21
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
22
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
23 #pragma once
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
24
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
25 #include <Images/Image.h>
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
26
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
27 namespace OrthancStone
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
28 {
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
29 // Helpers methods to render text in bitmaps.
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
30 // Compared to the GlyphBitmapAlphabet::RenderText, these methods do not need a
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
31 // code page.
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
32 class TextRenderer : public boost::noncopyable
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
33 {
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
34 public:
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
35 // simply renders text in GrayScale8 with a black background and a white text
1471
28c64c246312 working on a shared library
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1463
diff changeset
36 static Orthanc::ImageAccessor* Render(const std::string& ttf,
1463
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
37 unsigned int fontSize,
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
38 const std::string& utf8String);
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
39
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
40 // renders text in "color" with alpha in a RGBA32 image
1471
28c64c246312 working on a shared library
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1463
diff changeset
41 static Orthanc::ImageAccessor* RenderWithAlpha(const std::string& ttf,
1463
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
42 unsigned int fontSize,
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
43 const std::string& utf8String,
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
44 uint8_t foreground);
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
45
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
46 // // renders text in color + a border with alpha in a RGBA32 image
1471
28c64c246312 working on a shared library
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1463
diff changeset
47 // static Orthanc::ImageAccessor* RenderWithAlpha(const std::string& ttf,
1463
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
48 // unsigned int fontSize,
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
49 // const std::string& utf8String,
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
50 // uint8_t foreground,
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
51 // uint8_t borderColor);
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
52 };
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
53 }