GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
base-text-renderer.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2009-2023 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if ! defined (octave_base_text_renderer_h)
27 #define octave_base_text_renderer_h 1
28 
29 #include "octave-config.h"
30 
31 #include <list>
32 #include <string>
33 
34 #include "dMatrix.h"
35 #include "oct-map.h"
36 #include "uint8NDArray.h"
37 
38 #include "text-engine.h"
39 #include "text-renderer.h"
40 
42 
43 class
45 {
46 public:
47 
48  enum
49  {
50  ROTATION_0 = 0,
51  ROTATION_90 = 1,
52  ROTATION_180 = 2,
53  ROTATION_270 = 3
54  };
55 
57 
58  // No copying!
59 
61 
62  base_text_renderer& operator = (const base_text_renderer&) = delete;
63 
64  virtual ~base_text_renderer (void) = default;
65 
66  virtual void
67  set_anti_aliasing (bool val) = 0;
68 
69  virtual Matrix
70  get_extent (text_element *elt, double rotation) = 0;
71 
72  virtual Matrix
73  get_extent (const std::string& txt, double rotation,
74  const caseless_str& interpreter) = 0;
75 
76  virtual void
77  set_font (const std::string& name, const std::string& weight,
78  const std::string& angle, double size) = 0;
79 
80  virtual bool
81  ok (void) { return true; };
82 
83  virtual octave_map
84  get_system_fonts (void) = 0;
85 
86  virtual void set_color (const Matrix& c) = 0;
87 
88  virtual void
89  text_to_pixels (const std::string& txt, uint8NDArray& pxls,
90  Matrix& bbox, int halign, int valign, double rotation,
92  bool handle_rotation) = 0;
93 
94  virtual void
95  text_to_strlist (const std::string& txt,
96  std::list<text_renderer::string>& lst,
97  Matrix& box, int halign, int valign, double rotation,
98  const caseless_str& interpreter = "tex") = 0;
99 
100  void rotate_pixels (uint8NDArray& pixels, int rot_mode) const;
101 
102  int rotation_to_mode (double rotation) const;
103 
104  void fix_bbox_anchor (Matrix& bbox, int halign,
105  int valign, int rot_mode,
106  bool handle_rotation) const;
107 
108 };
109 
111 
112 #endif
OCTAVE_END_NAMESPACE(octave)
Definition: dMatrix.h:42
virtual octave_map get_system_fonts(void)=0
virtual Matrix get_extent(text_element *elt, double rotation)=0
virtual void text_to_pixels(const std::string &txt, uint8NDArray &pxls, Matrix &bbox, int halign, int valign, double rotation, const caseless_str &interpreter, bool handle_rotation)=0
base_text_renderer(const base_text_renderer &)=delete
virtual ~base_text_renderer(void)=default
virtual void text_to_strlist(const std::string &txt, std::list< text_renderer::string > &lst, Matrix &box, int halign, int valign, double rotation, const caseless_str &interpreter="tex")=0
virtual void set_color(const Matrix &c)=0
virtual Matrix get_extent(const std::string &txt, double rotation, const caseless_str &interpreter)=0
virtual void set_anti_aliasing(bool val)=0
virtual void set_font(const std::string &name, const std::string &weight, const std::string &angle, double size)=0
virtual bool ok(void)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
static octave_value box(JNIEnv *jni_env, void *jobj, void *jcls_arg=nullptr)