1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 <boost/optional.hpp>
26 #include <basegfx/matrix/b2dhommatrix.hxx>
27 #include <cppcanvas/canvasgraphic.hxx>
28 #include <cppcanvas/color.hxx>
36 /* Definition of Renderer interface */
41 class Renderer
: public virtual CanvasGraphic
44 /** Render subset of metafile to given canvas
46 This method renders the given subset of the content to the
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
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
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.
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
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
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
102 /// Optionally forces the fill color attribute for all actions
103 ::boost::optional
< IntSRGBA
> maFillColor
;
105 /// Optionally forces the line color attribute for all actions
106 ::boost::optional
< IntSRGBA
> maLineColor
;
108 /// Optionally forces the text color attribute for all actions
109 ::boost::optional
< IntSRGBA
> maTextColor
;
111 /// Optionally forces the given fontname for all text actions
112 ::boost::optional
< OUString
> maFontName
;
114 /** Optionally transforms all text output actions with the
115 given matrix (in addition to the overall canvas
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 ::boost::optional
< ::basegfx::B2DHomMatrix
> maTextTransformation
;
124 /// Optionally forces the given font weight for all text actions
125 ::boost::optional
< sal_Int8
> maFontWeight
;
127 /// Optionally forces the given font letter form (italics etc.) for all text actions
128 ::boost::optional
< sal_Int8
> maFontLetterForm
;
130 /// Optionally forces underlining for all text actions
131 ::boost::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: */