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_CANVAS_SOURCE_VCL_IMPLTOOLS_HXX
21 #define INCLUDED_CANVAS_SOURCE_VCL_IMPLTOOLS_HXX
23 #include <osl/mutex.hxx>
25 #include <vcl/svapp.hxx>
26 #include <vcl/outdev.hxx>
28 #include <basegfx/polygon/b2dpolypolygon.hxx>
30 #include <com/sun/star/uno/Reference.hxx>
31 #include <com/sun/star/uno/Sequence.hxx>
33 #include <canvas/vclwrapper.hxx>
34 #include "outdevprovider.hxx"
49 namespace com
{ namespace sun
{ namespace star
{ namespace awt
56 namespace com
{ namespace sun
{ namespace star
{ namespace drawing
58 struct HomogenMatrix3
;
61 namespace com
{ namespace sun
{ namespace star
{ namespace geometry
65 struct RealRectangle2D
;
68 namespace com
{ namespace sun
{ namespace star
{ namespace rendering
81 bitmapExFromXBitmap( const ::com::sun::star::uno::Reference
<
82 ::com::sun::star::rendering::XBitmap
>& );
84 /** Setup VCL font and output position
86 @returns false, if no text output should happen
88 bool setupFontTransform( ::Point
& o_rPoint
,
89 vcl::Font
& io_rVCLFont
,
90 const ::com::sun::star::rendering::ViewState
& viewState
,
91 const ::com::sun::star::rendering::RenderState
& renderState
,
92 ::OutputDevice
& rOutDev
);
94 /** Predicate, to determine whether polygon is actually an axis-aligned rectangle
96 @return true, if the polygon is a rectangle.
98 bool isRectangle( const ::tools::PolyPolygon
& rPolyPoly
);
101 // Little helper to encapsulate locking into policy class
110 /// To be compatible with CanvasBase mutex concept
111 LocalGuard( const ::osl::Mutex
& ) :
117 SolarMutexGuard aSolarGuard
;
120 class OutDevStateKeeper
123 explicit OutDevStateKeeper( OutputDevice
& rOutDev
) :
124 mpOutDev( &rOutDev
),
125 mbMappingWasEnabled( mpOutDev
->IsMapModeEnabled() ),
126 mnAntiAliasing( mpOutDev
->GetAntialiasing() )
131 explicit OutDevStateKeeper( const OutDevProviderSharedPtr
& rOutDev
) :
132 mpOutDev( rOutDev
.get() ? &(rOutDev
->getOutDev()) : NULL
),
133 mbMappingWasEnabled( mpOutDev
&& mpOutDev
->IsMapModeEnabled() ),
134 mnAntiAliasing( mpOutDev
? mpOutDev
->GetAntialiasing() : AntialiasingFlags::NONE
)
143 mpOutDev
->EnableMapMode( mbMappingWasEnabled
);
144 mpOutDev
->SetAntialiasing( mnAntiAliasing
);
156 mpOutDev
->EnableMapMode(false);
157 mpOutDev
->SetAntialiasing( AntialiasingFlags::EnableB2dDraw
);
161 VclPtr
<OutputDevice
> mpOutDev
;
162 const bool mbMappingWasEnabled
;
163 const AntialiasingFlags mnAntiAliasing
;
166 ::Point
mapRealPoint2D( const ::com::sun::star::geometry::RealPoint2D
& rPoint
,
167 const ::com::sun::star::rendering::ViewState
& rViewState
,
168 const ::com::sun::star::rendering::RenderState
& rRenderState
);
170 ::tools::PolyPolygon
mapPolyPolygon( const ::basegfx::B2DPolyPolygon
& rPoly
,
171 const ::com::sun::star::rendering::ViewState
& rViewState
,
172 const ::com::sun::star::rendering::RenderState
& rRenderState
);
177 MODULATE_WITH_DEVICECOLOR
180 ::BitmapEx
transformBitmap( const BitmapEx
& rBitmap
,
181 const ::basegfx::B2DHomMatrix
& rTransform
,
182 const ::com::sun::star::uno::Sequence
< double >& rDeviceColor
,
183 ModulationMode eModulationMode
);
188 #endif // INCLUDED_CANVAS_SOURCE_VCL_IMPLTOOLS_HXX
190 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */