Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
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>
28 :
29 : #include <cppcanvas/vclfactory.hxx>
30 :
31 : #include <implbitmapcanvas.hxx>
32 : #include <implspritecanvas.hxx>
33 : #include <implpolypolygon.hxx>
34 : #include <implbitmap.hxx>
35 : #include <implrenderer.hxx>
36 : #include <implsprite.hxx>
37 :
38 : using namespace ::com::sun::star;
39 :
40 : namespace cppcanvas
41 : {
42 0 : CanvasSharedPtr VCLFactory::createCanvas( const uno::Reference< rendering::XCanvas >& xCanvas )
43 : {
44 : return CanvasSharedPtr(
45 0 : new internal::ImplCanvas( xCanvas ) );
46 : }
47 :
48 2 : BitmapCanvasSharedPtr VCLFactory::createBitmapCanvas( const uno::Reference< rendering::XBitmapCanvas >& xCanvas )
49 : {
50 : return BitmapCanvasSharedPtr(
51 2 : new internal::ImplBitmapCanvas( xCanvas ) );
52 : }
53 :
54 0 : SpriteCanvasSharedPtr VCLFactory::createSpriteCanvas( const vcl::Window& rVCLWindow )
55 : {
56 : return SpriteCanvasSharedPtr(
57 : new internal::ImplSpriteCanvas(
58 : uno::Reference< rendering::XSpriteCanvas >(
59 : rVCLWindow.GetSpriteCanvas(),
60 0 : uno::UNO_QUERY) ) );
61 : }
62 :
63 0 : SpriteCanvasSharedPtr VCLFactory::createSpriteCanvas( const uno::Reference< rendering::XSpriteCanvas >& xCanvas )
64 : {
65 : return SpriteCanvasSharedPtr(
66 0 : new internal::ImplSpriteCanvas( xCanvas ) );
67 : }
68 :
69 0 : BitmapSharedPtr VCLFactory::createBitmap( const CanvasSharedPtr& rCanvas,
70 : const ::BitmapEx& rBmpEx )
71 : {
72 : OSL_ENSURE( rCanvas.get() != NULL &&
73 : rCanvas->getUNOCanvas().is(),
74 : "VCLFactory::createBitmap(): Invalid canvas" );
75 :
76 0 : if( rCanvas.get() == NULL )
77 0 : return BitmapSharedPtr();
78 :
79 0 : uno::Reference< rendering::XCanvas > xCanvas( rCanvas->getUNOCanvas() );
80 0 : if( !xCanvas.is() )
81 0 : return BitmapSharedPtr();
82 :
83 : return BitmapSharedPtr( new internal::ImplBitmap( rCanvas,
84 : vcl::unotools::xBitmapFromBitmapEx(
85 0 : xCanvas->getDevice(),
86 0 : rBmpEx) ) );
87 : }
88 :
89 2 : RendererSharedPtr VCLFactory::createRenderer( const CanvasSharedPtr& rCanvas,
90 : const ::GDIMetaFile& rMtf,
91 : const Renderer::Parameters& rParms )
92 : {
93 : return RendererSharedPtr( new internal::ImplRenderer( rCanvas,
94 : rMtf,
95 2 : rParms ) );
96 : }
97 : }
98 :
99 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|