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 _VCLCANVAS_CANVASBITMAP_HXX
21 #define _VCLCANVAS_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/integerbitmapbase.hxx>
36 #include <canvasbitmaphelper.hxx>
38 #include "impltools.hxx"
39 #include "repainttarget.hxx"
40 #include "spritecanvas.hxx"
43 /* Definition of CanvasBitmap class */
47 typedef ::cppu::WeakComponentImplHelper4
< ::com::sun::star::rendering::XBitmapCanvas
,
48 ::com::sun::star::rendering::XIntegerBitmap
,
49 ::com::sun::star::lang::XServiceInfo
,
50 ::com::sun::star::beans::XFastPropertySet
> CanvasBitmapBase_Base
;
51 typedef ::canvas::IntegerBitmapBase
< ::canvas::DisambiguationHelper
< CanvasBitmapBase_Base
>,
54 ::cppu::OWeakObject
> CanvasBitmap_Base
;
56 class CanvasBitmap
: public CanvasBitmap_Base
,
60 /** Must be called with locked Solar mutex
63 Size in pixel of the bitmap to generate
66 When true, bitmap will have an alpha channel
69 Reference device, with which bitmap should be compatible
71 CanvasBitmap( const ::Size
& rSize
,
73 ::com::sun::star::rendering::XGraphicDevice
& rDevice
,
74 const OutDevProviderSharedPtr
& rOutDevProvider
);
76 /// Must be called with locked Solar mutex
77 CanvasBitmap( const BitmapEx
& rBitmap
,
78 ::com::sun::star::rendering::XGraphicDevice
& rDevice
,
79 const OutDevProviderSharedPtr
& rOutDevProvider
);
82 virtual OUString SAL_CALL
getImplementationName( ) throw (::com::sun::star::uno::RuntimeException
);
83 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) throw (::com::sun::star::uno::RuntimeException
);
84 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException
);
86 // RepaintTarget interface
87 virtual bool repaint( const GraphicObjectSharedPtr
& rGrf
,
88 const ::com::sun::star::rendering::ViewState
& viewState
,
89 const ::com::sun::star::rendering::RenderState
& renderState
,
92 const GraphicAttr
& rAttr
) const;
94 /// Not threadsafe! Returned object is shared!
95 BitmapEx
getBitmap() const;
98 // used to retrieve BitmapEx pointer or X Pixmap handles for this bitmap
99 // handle values have these meanings:
100 // 0 ... get pointer to BitmapEx
101 // 1 ... get X pixmap handle to rgb content
102 // 2 ... get X pitmap handle to alpha mask
103 // returned any contains either BitmapEx pointer or array of three Any value
104 // 1st a bool value: true - free the pixmap after used by XFreePixmap, false do nothing, the pixmap is used internally in the canvas
105 // 2nd the pixmap handle
106 // 3rd the pixmap depth
107 virtual ::com::sun::star::uno::Any SAL_CALL
getFastPropertyValue(sal_Int32 nHandle
) throw (::com::sun::star::uno::RuntimeException
);
108 virtual void SAL_CALL
setFastPropertyValue(sal_Int32
, const ::com::sun::star::uno::Any
&) throw (::com::sun::star::uno::RuntimeException
) {}
111 /** MUST hold here, too, since CanvasHelper only contains a
112 raw pointer (without refcounting)
114 ::com::sun::star::uno::Reference
<com::sun::star::rendering::XGraphicDevice
> mxDevice
;
118 #endif /* _VCLCANVAS_CANVASBITMAP_HXX */
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */