Update git submodules
[LibreOffice.git] / include / cppcanvas / renderer.hxx
blobd71be2f09e89d083d69751940e46f077087630be
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_CPPCANVAS_RENDERER_HXX
21 #define INCLUDED_CPPCANVAS_RENDERER_HXX
23 #include <sal/types.h>
24 #include <rtl/ustring.hxx>
25 #include <optional>
26 #include <basegfx/matrix/b2dhommatrix.hxx>
27 #include <cppcanvas/canvasgraphic.hxx>
28 #include <cppcanvas/color.hxx>
29 #include <memory>
31 namespace basegfx
33 class B2DRange;
36 /* Definition of Renderer interface */
38 namespace cppcanvas
41 class Renderer : public virtual CanvasGraphic
43 public:
44 /** Render subset of metafile to given canvas
46 This method renders the given subset of the content to the
47 associated canvas.
49 @param nStartIndex
50 The index of the first action to be rendered (the indices
51 correspond roughly to the action indices of the
52 originating GDIMetaFile. Note, although, that certain
53 actions, e.g. text, accounts for more than one index: a
54 text produces as many addressable indices as it has
55 characters).
57 @param nEndIndex
58 The index of the first action _not_ painted anymore,
59 i.e. the action after the last action rendered (the
60 indices correspond roughly to the action indices of the
61 originating GDIMetaFile. Note, although, that certain
62 actions, e.g. text, accounts for more than one index: a
63 text produces as many addressable indices as it has
64 characters).
66 @return whether the rendering finished successfully.
68 virtual bool drawSubset( sal_Int32 nStartIndex,
69 sal_Int32 nEndIndex ) const = 0;
71 /** Query bounding box of metafile subset
73 This method queries the actual bounding box of the given
74 subset, when rendered on the associated canvas.
76 @param nStartIndex
77 The index of the first action to be rendered (the indices
78 correspond roughly to the action indices of the
79 originating GDIMetaFile. Note, although, that certain
80 actions, e.g. text, accounts for more than one index: a
81 text produces as many addressable indices as it has
82 characters).
84 @param nEndIndex
85 The index of the first action _not_ painted anymore,
86 i.e. the action after the last action rendered (the
87 indices correspond roughly to the action indices of the
88 originating GDIMetaFile. Note, although, that certain
89 actions, e.g. text, accounts for more than one index: a
90 text produces as many addressable indices as it has
91 characters).
93 @return the bounding box of the specified subset
95 virtual ::basegfx::B2DRange getSubsetArea( sal_Int32 nStartIndex,
96 sal_Int32 nEndIndex ) const = 0;
98 /** Parameters for the Renderer
100 struct Parameters
102 /// Optionally forces the fill color attribute for all actions
103 ::std::optional< IntSRGBA > maFillColor;
105 /// Optionally forces the line color attribute for all actions
106 ::std::optional< IntSRGBA > maLineColor;
108 /// Optionally forces the text color attribute for all actions
109 ::std::optional< IntSRGBA > maTextColor;
111 /// Optionally forces the given fontname for all text actions
112 ::std::optional< OUString > maFontName;
114 /** Optionally transforms all text output actions with the
115 given matrix (in addition to the overall canvas
116 transformation).
118 Note that the matrix given here is applied to the unit
119 rect coordinate system, i.e. the metafile is assumed
120 to be contained in the unit rect.
122 ::std::optional< ::basegfx::B2DHomMatrix > maTextTransformation;
124 /// Optionally forces the given font weight for all text actions
125 ::std::optional< sal_Int8 > maFontWeight;
127 /// Optionally forces the given font letter form (italics etc.) for all text actions
128 ::std::optional< sal_Int8 > maFontLetterForm;
130 /// Optionally forces underlining for all text actions
131 ::std::optional< bool > maFontUnderline;
135 typedef std::shared_ptr< ::cppcanvas::Renderer > RendererSharedPtr;
138 #endif // INCLUDED_CPPCANVAS_RENDERER_HXX
140 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */