Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _VCLCANVAS_CANVASBITMAP_HXX
30 : : #define _VCLCANVAS_CANVASBITMAP_HXX
31 : :
32 : : #include <cppuhelper/compbase4.hxx>
33 : :
34 : : #include <com/sun/star/lang/XServiceInfo.hpp>
35 : : #include <com/sun/star/rendering/XBitmapCanvas.hpp>
36 : : #include <com/sun/star/rendering/XIntegerBitmap.hpp>
37 : : #include <com/sun/star/beans/XFastPropertySet.hpp>
38 : :
39 : : #include <vcl/virdev.hxx>
40 : : #include <vcl/bitmapex.hxx>
41 : :
42 : : #include <canvas/vclwrapper.hxx>
43 : :
44 : : #include <canvas/base/integerbitmapbase.hxx>
45 : : #include <canvasbitmaphelper.hxx>
46 : :
47 : : #include "impltools.hxx"
48 : : #include "repainttarget.hxx"
49 : : #include "spritecanvas.hxx"
50 : :
51 : :
52 : : /* Definition of CanvasBitmap class */
53 : :
54 : : namespace vclcanvas
55 : : {
56 : : typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::rendering::XBitmapCanvas,
57 : : ::com::sun::star::rendering::XIntegerBitmap,
58 : : ::com::sun::star::lang::XServiceInfo,
59 : : ::com::sun::star::beans::XFastPropertySet > CanvasBitmapBase_Base;
60 : : typedef ::canvas::IntegerBitmapBase< ::canvas::DisambiguationHelper< CanvasBitmapBase_Base >,
61 : : CanvasBitmapHelper,
62 : : tools::LocalGuard,
63 : : ::cppu::OWeakObject > CanvasBitmap_Base;
64 : :
65 : 0 : class CanvasBitmap : public CanvasBitmap_Base,
66 : : public RepaintTarget
67 : : {
68 : : public:
69 : : /** Must be called with locked Solar mutex
70 : :
71 : : @param rSize
72 : : Size in pixel of the bitmap to generate
73 : :
74 : : @param bAlphaBitmap
75 : : When true, bitmap will have an alpha channel
76 : :
77 : : @param rDevice
78 : : Reference device, with which bitmap should be compatible
79 : : */
80 : : CanvasBitmap( const ::Size& rSize,
81 : : bool bAlphaBitmap,
82 : : ::com::sun::star::rendering::XGraphicDevice& rDevice,
83 : : const OutDevProviderSharedPtr& rOutDevProvider );
84 : :
85 : : /// Must be called with locked Solar mutex
86 : : CanvasBitmap( const BitmapEx& rBitmap,
87 : : ::com::sun::star::rendering::XGraphicDevice& rDevice,
88 : : const OutDevProviderSharedPtr& rOutDevProvider );
89 : :
90 : : // XServiceInfo
91 : : virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
92 : : virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
93 : : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
94 : :
95 : : // RepaintTarget interface
96 : : virtual bool repaint( const GraphicObjectSharedPtr& rGrf,
97 : : const ::com::sun::star::rendering::ViewState& viewState,
98 : : const ::com::sun::star::rendering::RenderState& renderState,
99 : : const ::Point& rPt,
100 : : const ::Size& rSz,
101 : : const GraphicAttr& rAttr ) const;
102 : :
103 : : /// Not threadsafe! Returned object is shared!
104 : : BitmapEx getBitmap() const;
105 : :
106 : : // XFastPropertySet
107 : : // used to retrieve BitmapEx pointer or X Pixmap handles for this bitmap
108 : : // handle values have these meanings:
109 : : // 0 ... get pointer to BitmapEx
110 : : // 1 ... get X pixmap handle to rgb content
111 : : // 2 ... get X pitmap handle to alpha mask
112 : : // returned any contains either BitmapEx pointer or array of three Any value
113 : : // 1st a bool value: true - free the pixmap after used by XFreePixmap, false do nothing, the pixmap is used internally in the canvas
114 : : // 2nd the pixmap handle
115 : : // 3rd the pixmap depth
116 : : virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue(sal_Int32 nHandle) throw (::com::sun::star::uno::RuntimeException);
117 : 0 : virtual void SAL_CALL setFastPropertyValue(sal_Int32, const ::com::sun::star::uno::Any&) throw (::com::sun::star::uno::RuntimeException) {}
118 : :
119 : : private:
120 : : /** MUST hold here, too, since CanvasHelper only contains a
121 : : raw pointer (without refcounting)
122 : : */
123 : : ::com::sun::star::uno::Reference<com::sun::star::rendering::XGraphicDevice> mxDevice;
124 : : };
125 : : }
126 : :
127 : : #endif /* _VCLCANVAS_CANVASBITMAP_HXX */
128 : :
129 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|