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 .
21 #include <rtl/instance.hxx>
22 #include <osl/getglobalmutex.hxx>
23 #include <osl/diagnose.h>
25 #include <com/sun/star/rendering/InterpolationMode.hpp>
27 #include <basegfx/polygon/b2dpolygon.hxx>
28 #include <basegfx/polygon/b2dpolypolygon.hxx>
29 #include <basegfx/tools/canvastools.hxx>
31 #include <cppcanvas/basegfxfactory.hxx>
33 #include <com/sun/star/rendering/RenderState.hpp>
34 #include <com/sun/star/rendering/StringContext.hpp>
35 #include <com/sun/star/rendering/XCanvas.hpp>
36 #include <com/sun/star/rendering/XCanvasFont.hpp>
38 #include <canvasgraphichelper.hxx>
40 #include "implpolypolygon.hxx"
41 #include "implbitmap.hxx"
43 using namespace ::com::sun::star
;
47 PolyPolygonSharedPtr
BaseGfxFactory::createPolyPolygon( const CanvasSharedPtr
& rCanvas
,
48 const ::basegfx::B2DPolygon
& rPoly
)
50 OSL_ENSURE( rCanvas
.get() != NULL
&&
51 rCanvas
->getUNOCanvas().is(),
52 "BaseGfxFactory::createPolyPolygon(): Invalid canvas" );
54 if( rCanvas
.get() == NULL
)
55 return PolyPolygonSharedPtr();
57 uno::Reference
< rendering::XCanvas
> xCanvas( rCanvas
->getUNOCanvas() );
59 return PolyPolygonSharedPtr();
61 return PolyPolygonSharedPtr(
62 new internal::ImplPolyPolygon( rCanvas
,
63 ::basegfx::unotools::xPolyPolygonFromB2DPolygon(
68 BitmapSharedPtr
BaseGfxFactory::createBitmap( const CanvasSharedPtr
& rCanvas
,
69 const ::basegfx::B2ISize
& rSize
)
71 OSL_ENSURE( rCanvas
.get() != NULL
&&
72 rCanvas
->getUNOCanvas().is(),
73 "BaseGfxFactory::createBitmap(): Invalid canvas" );
75 if( rCanvas
.get() == NULL
)
76 return BitmapSharedPtr();
78 uno::Reference
< rendering::XCanvas
> xCanvas( rCanvas
->getUNOCanvas() );
80 return BitmapSharedPtr();
82 return BitmapSharedPtr(
83 new internal::ImplBitmap( rCanvas
,
84 xCanvas
->getDevice()->createCompatibleBitmap(
85 ::basegfx::unotools::integerSize2DFromB2ISize(rSize
) ) ) );
88 BitmapSharedPtr
BaseGfxFactory::createAlphaBitmap( const CanvasSharedPtr
& rCanvas
,
89 const ::basegfx::B2ISize
& rSize
)
91 OSL_ENSURE( rCanvas
.get() != NULL
&&
92 rCanvas
->getUNOCanvas().is(),
93 "BaseGfxFactory::createBitmap(): Invalid canvas" );
95 if( rCanvas
.get() == NULL
)
96 return BitmapSharedPtr();
98 uno::Reference
< rendering::XCanvas
> xCanvas( rCanvas
->getUNOCanvas() );
100 return BitmapSharedPtr();
102 return BitmapSharedPtr(
103 new internal::ImplBitmap( rCanvas
,
104 xCanvas
->getDevice()->createCompatibleAlphaBitmap(
105 ::basegfx::unotools::integerSize2DFromB2ISize(rSize
) ) ) );
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */