annotate OrthancStone/Sources/Toolbox/TextRenderer.h @ 1512:244ad1e4e76a

reorganization of folders
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 07 Jul 2020 16:21:02 +0200
parents Framework/Toolbox/TextRenderer.h@28c64c246312
children 8563ea5d8ae4
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
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
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
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
15 * Affero General Public License for more details.
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
16 *
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
19 **/
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 #pragma once
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
23
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
24 #include <Images/Image.h>
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
25
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
26 namespace OrthancStone
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
27 {
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
28 // Helpers methods to render text in bitmaps.
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
29 // Compared to the GlyphBitmapAlphabet::RenderText, these methods do not need a
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
30 // code page.
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
31 class TextRenderer : public boost::noncopyable
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
32 {
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
33 public:
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
34 // 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
35 static Orthanc::ImageAccessor* Render(const std::string& ttf,
1463
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
36 unsigned int fontSize,
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
37 const std::string& utf8String);
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
38
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
39 // 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
40 static Orthanc::ImageAccessor* RenderWithAlpha(const std::string& ttf,
1463
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
41 unsigned int fontSize,
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
42 const std::string& utf8String,
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
43 uint8_t foreground);
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
44
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
45 // // 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
46 // static Orthanc::ImageAccessor* RenderWithAlpha(const std::string& ttf,
1463
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
47 // unsigned int fontSize,
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
48 // const std::string& utf8String,
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
49 // uint8_t foreground,
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
50 // uint8_t borderColor);
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
51 };
182bf3106ee2 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
52 }