Bump version to 5.0-14
[LibreOffice.git] / cppcanvas / source / wrapper / vclfactory.cxx
blob338daa4ba7319ed140e11e5198971aea5cfcbcaf
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 #include <rtl/instance.hxx>
21 #include <osl/getglobalmutex.hxx>
22 #include <osl/diagnose.h>
23 #include <com/sun/star/rendering/InterpolationMode.hpp>
24 #include <vcl/window.hxx>
25 #include <vcl/graph.hxx>
26 #include <vcl/canvastools.hxx>
27 #include <basegfx/polygon/b2dpolypolygon.hxx>
29 #include <cppcanvas/vclfactory.hxx>
31 #include <implbitmapcanvas.hxx>
32 #include <implspritecanvas.hxx>
33 #include <implpolypolygon.hxx>
34 #include <implbitmap.hxx>
35 #include <implrenderer.hxx>
36 #include <implsprite.hxx>
38 using namespace ::com::sun::star;
40 namespace cppcanvas
42 CanvasSharedPtr VCLFactory::createCanvas( const uno::Reference< rendering::XCanvas >& xCanvas )
44 return CanvasSharedPtr(
45 new internal::ImplCanvas( xCanvas ) );
48 BitmapCanvasSharedPtr VCLFactory::createBitmapCanvas( const uno::Reference< rendering::XBitmapCanvas >& xCanvas )
50 return BitmapCanvasSharedPtr(
51 new internal::ImplBitmapCanvas( xCanvas ) );
54 SpriteCanvasSharedPtr VCLFactory::createSpriteCanvas( const vcl::Window& rVCLWindow )
56 return SpriteCanvasSharedPtr(
57 new internal::ImplSpriteCanvas(
58 uno::Reference< rendering::XSpriteCanvas >(
59 rVCLWindow.GetSpriteCanvas(),
60 uno::UNO_QUERY) ) );
63 SpriteCanvasSharedPtr VCLFactory::createSpriteCanvas( const uno::Reference< rendering::XSpriteCanvas >& xCanvas )
65 return SpriteCanvasSharedPtr(
66 new internal::ImplSpriteCanvas( xCanvas ) );
69 BitmapSharedPtr VCLFactory::createBitmap( const CanvasSharedPtr& rCanvas,
70 const ::BitmapEx& rBmpEx )
72 OSL_ENSURE( rCanvas.get() != NULL &&
73 rCanvas->getUNOCanvas().is(),
74 "VCLFactory::createBitmap(): Invalid canvas" );
76 if( rCanvas.get() == NULL )
77 return BitmapSharedPtr();
79 uno::Reference< rendering::XCanvas > xCanvas( rCanvas->getUNOCanvas() );
80 if( !xCanvas.is() )
81 return BitmapSharedPtr();
83 return BitmapSharedPtr( new internal::ImplBitmap( rCanvas,
84 vcl::unotools::xBitmapFromBitmapEx(
85 xCanvas->getDevice(),
86 rBmpEx) ) );
89 RendererSharedPtr VCLFactory::createRenderer( const CanvasSharedPtr& rCanvas,
90 const ::GDIMetaFile& rMtf,
91 const Renderer::Parameters& rParms )
93 return RendererSharedPtr( new internal::ImplRenderer( rCanvas,
94 rMtf,
95 rParms ) );
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */