1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: canvasbitmap.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _VCLCANVAS_CANVASBITMAP_HXX
32 #define _VCLCANVAS_CANVASBITMAP_HXX
34 #include <cppuhelper/compbase4.hxx>
36 #include <com/sun/star/lang/XServiceInfo.hpp>
37 #include <com/sun/star/rendering/XBitmapCanvas.hpp>
38 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
39 #include <com/sun/star/beans/XFastPropertySet.hpp>
41 #include <vcl/virdev.hxx>
42 #include <vcl/bitmapex.hxx>
44 #include <canvas/vclwrapper.hxx>
46 #include <canvas/base/integerbitmapbase.hxx>
47 #include <canvasbitmaphelper.hxx>
49 #include "impltools.hxx"
50 #include "repainttarget.hxx"
51 #include "spritecanvas.hxx"
54 /* Definition of CanvasBitmap class */
58 typedef ::cppu::WeakComponentImplHelper4
< ::com::sun::star::rendering::XBitmapCanvas
,
59 ::com::sun::star::rendering::XIntegerBitmap
,
60 ::com::sun::star::lang::XServiceInfo
,
61 ::com::sun::star::beans::XFastPropertySet
> CanvasBitmapBase_Base
;
62 typedef ::canvas::IntegerBitmapBase
< ::canvas::BaseMutexHelper
< CanvasBitmapBase_Base
>,
65 ::cppu::OWeakObject
> CanvasBitmap_Base
;
67 class CanvasBitmap
: public CanvasBitmap_Base
,
71 /** Must be called with locked Solar mutex
74 Size in pixel of the bitmap to generate
77 When true, bitmap will have an alpha channel
80 Reference device, with which bitmap should be compatible
82 CanvasBitmap( const ::Size
& rSize
,
84 ::com::sun::star::rendering::XGraphicDevice
& rDevice
,
85 const OutDevProviderSharedPtr
& rOutDevProvider
);
87 /// Must be called with locked Solar mutex
88 CanvasBitmap( const BitmapEx
& rBitmap
,
89 ::com::sun::star::rendering::XGraphicDevice
& rDevice
,
90 const OutDevProviderSharedPtr
& rOutDevProvider
);
92 // overridden because of mpDevice
93 virtual void SAL_CALL
disposing();
96 virtual ::rtl::OUString SAL_CALL
getImplementationName( ) throw (::com::sun::star::uno::RuntimeException
);
97 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
) throw (::com::sun::star::uno::RuntimeException
);
98 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException
);
100 // RepaintTarget interface
101 virtual bool repaint( const GraphicObjectSharedPtr
& rGrf
,
102 const ::com::sun::star::rendering::ViewState
& viewState
,
103 const ::com::sun::star::rendering::RenderState
& renderState
,
106 const GraphicAttr
& rAttr
) const;
108 /// Not threadsafe! Returned object is shared!
109 BitmapEx
getBitmap() const;
112 // used to retrieve BitmapEx pointer or X Pixmap handles for this bitmap
113 // handle values have these meanings:
114 // 0 ... get pointer to BitmapEx
115 // 1 ... get X pixmap handle to rgb content
116 // 2 ... get X pitmap handle to alpha mask
117 // returned any contains either BitmapEx pointer or array of three Any value
118 // 1st a bool value: true - free the pixmap after used by XFreePixmap, false do nothing, the pixmap is used internally in the canvas
119 // 2nd the pixmap handle
120 // 3rd the pixmap depth
121 virtual ::com::sun::star::uno::Any SAL_CALL
getFastPropertyValue(sal_Int32 nHandle
) throw (::com::sun::star::uno::RuntimeException
);
122 virtual void SAL_CALL
setFastPropertyValue(sal_Int32
, const ::com::sun::star::uno::Any
&) throw (::com::sun::star::uno::RuntimeException
) {}
125 /** MUST hold here, too, since CanvasHelper only contains a
126 raw pointer (without refcounting)
128 ::com::sun::star::uno::Reference
<com::sun::star::rendering::XGraphicDevice
> mxDevice
;
132 #endif /* _VCLCANVAS_CANVASBITMAP_HXX */