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_CANVASBITMAP_HXX
21 #define INCLUDED_CANVAS_SOURCE_VCL_CANVASBITMAP_HXX
23 #include <cppuhelper/compbase4.hxx>
25 #include <com/sun/star/lang/XServiceInfo.hpp>
26 #include <com/sun/star/rendering/XBitmapCanvas.hpp>
27 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
28 #include <com/sun/star/beans/XFastPropertySet.hpp>
30 #include <vcl/virdev.hxx>
31 #include <vcl/bitmapex.hxx>
33 #include <canvas/vclwrapper.hxx>
35 #include <canvas/base/basemutexhelper.hxx>
36 #include <canvas/base/integerbitmapbase.hxx>
37 #include <canvasbitmaphelper.hxx>
39 #include "impltools.hxx"
40 #include "repainttarget.hxx"
41 #include "spritecanvas.hxx"
44 /* Definition of CanvasBitmap class */
48 typedef ::cppu::WeakComponentImplHelper4
< ::com::sun::star::rendering::XBitmapCanvas
,
49 ::com::sun::star::rendering::XIntegerBitmap
,
50 ::com::sun::star::lang::XServiceInfo
,
51 ::com::sun::star::beans::XFastPropertySet
> CanvasBitmapBase_Base
;
52 typedef ::canvas::IntegerBitmapBase
<
53 canvas::BitmapCanvasBase2
<
54 ::canvas::BaseMutexHelper
< CanvasBitmapBase_Base
>,
57 ::cppu::OWeakObject
> > CanvasBitmap_Base
;
59 class CanvasBitmap
: public CanvasBitmap_Base
,
63 /** Must be called with locked Solar mutex
66 Size in pixel of the bitmap to generate
69 When true, bitmap will have an alpha channel
72 Reference device, with which bitmap should be compatible
74 CanvasBitmap( const ::Size
& rSize
,
76 ::com::sun::star::rendering::XGraphicDevice
& rDevice
,
77 const OutDevProviderSharedPtr
& rOutDevProvider
);
79 /// Must be called with locked Solar mutex
80 CanvasBitmap( const BitmapEx
& rBitmap
,
81 ::com::sun::star::rendering::XGraphicDevice
& rDevice
,
82 const OutDevProviderSharedPtr
& rOutDevProvider
);
85 virtual OUString SAL_CALL
getImplementationName( ) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
86 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
87 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
89 // RepaintTarget interface
90 virtual bool repaint( const GraphicObjectSharedPtr
& rGrf
,
91 const ::com::sun::star::rendering::ViewState
& viewState
,
92 const ::com::sun::star::rendering::RenderState
& renderState
,
95 const GraphicAttr
& rAttr
) const SAL_OVERRIDE
;
97 /// Not threadsafe! Returned object is shared!
98 BitmapEx
getBitmap() const;
101 // used to retrieve BitmapEx pointer or X Pixmap handles for this bitmap
102 // handle values have these meanings:
103 // 0 ... get pointer to BitmapEx
104 // 1 ... get X pixmap handle to rgb content
105 // 2 ... get X pitmap handle to alpha mask
106 // returned any contains either BitmapEx pointer or array of three Any value
107 // 1st a bool value: true - free the pixmap after used by XFreePixmap, false do nothing, the pixmap is used internally in the canvas
108 // 2nd the pixmap handle
109 // 3rd the pixmap depth
110 virtual ::com::sun::star::uno::Any SAL_CALL
getFastPropertyValue(sal_Int32 nHandle
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
111 virtual void SAL_CALL
setFastPropertyValue(sal_Int32
, const ::com::sun::star::uno::Any
&) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
{}
114 /** MUST hold here, too, since CanvasHelper only contains a
115 raw pointer (without refcounting)
117 ::com::sun::star::uno::Reference
<com::sun::star::rendering::XGraphicDevice
> mxDevice
;
121 #endif // INCLUDED_CANVAS_SOURCE_VCL_CANVASBITMAP_HXX
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */