fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / canvas / source / cairo / cairo_canvasbitmap.hxx
blobb1d669ed5713875436dc1515228ef3e72e3f8b8c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 _CAIROCANVAS_CANVASBITMAP_HXX
21 #define _CAIROCANVAS_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>
29 #include <comphelper/uno3.hxx>
31 #include <basegfx/vector/b2isize.hxx>
33 #include <boost/shared_ptr.hpp>
35 #include <canvas/base/integerbitmapbase.hxx>
37 #include "cairo_cairo.hxx"
38 #include "cairo_canvashelper.hxx"
39 #include "cairo_repainttarget.hxx"
40 #include "cairo_spritecanvas.hxx"
43 /* Definition of CanvasBitmap class */
45 namespace cairocanvas
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 class CanvasBitmapSpriteSurface_Base :
52 public ::canvas::DisambiguationHelper<CanvasBitmapBase_Base>,
53 public SurfaceProvider
57 typedef ::canvas::IntegerBitmapBase<
58 CanvasBitmapSpriteSurface_Base,
59 CanvasHelper,
60 ::osl::MutexGuard,
61 ::cppu::OWeakObject > CanvasBitmap_Base;
63 class CanvasBitmap : public CanvasBitmap_Base,
64 public RepaintTarget
66 public:
67 /** Create a canvas bitmap for the given surface
69 @param rSize
70 Size of the bitmap
72 @param rDevice
73 Reference device, with which bitmap should be compatible
75 CanvasBitmap( const ::basegfx::B2ISize& rSize,
76 const SurfaceProviderRef& rDevice,
77 ::com::sun::star::rendering::XGraphicDevice* pDevice,
78 bool bHasAlpha );
80 /// Dispose all internal references
81 virtual void disposeThis();
83 // Forwarding the XComponent implementation to the
84 // cppu::ImplHelper templated base
85 // Classname Base doing refcounting Base implementing the XComponent interface
86 // | | |
87 // V V V
88 DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( CanvasBitmap, CanvasBitmapBase_Base, ::cppu::WeakComponentImplHelperBase );
90 // XServiceInfo
91 virtual OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
92 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
93 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
95 // SurfaceProvider
96 virtual SurfaceSharedPtr getSurface();
97 virtual SurfaceSharedPtr createSurface( const ::basegfx::B2ISize& rSize, Content aContent = CAIRO_CONTENT_COLOR_ALPHA );
98 virtual SurfaceSharedPtr createSurface( ::Bitmap& rBitmap );
99 virtual SurfaceSharedPtr changeSurface( bool bHasAlpha, bool bCopyContent );
100 virtual OutputDevice* getOutputDevice();
102 // RepaintTarget
103 virtual bool repaint( const SurfaceSharedPtr& pSurface,
104 const ::com::sun::star::rendering::ViewState& viewState,
105 const ::com::sun::star::rendering::RenderState& renderState );
107 // XFastPropertySet
108 // used to retrieve BitmapEx pointer or X Pixmap handles for this bitmap
109 // handle values have these meanings:
110 // 0 ... get pointer to BitmapEx
111 // 1 ... get X pixmap handle to rgb content
112 // 2 ... get X pitmap handle to alpha mask
113 // returned any contains either BitmapEx pointer or array of three Any value
114 // 1st a bool value: true - free the pixmap after used by XFreePixmap, false do nothing, the pixmap is used internally in the canvas
115 // 2nd the pixmap handle
116 // 3rd the pixmap depth
117 virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue(sal_Int32 nHandle) throw (::com::sun::star::uno::RuntimeException);
118 virtual void SAL_CALL setFastPropertyValue(sal_Int32, const ::com::sun::star::uno::Any&) throw (::com::sun::star::uno::RuntimeException) {}
120 private:
121 SurfaceProviderRef mpSurfaceProvider;
122 ::cairo::SurfaceSharedPtr mpBufferSurface;
123 ::cairo::CairoSharedPtr mpBufferCairo;
125 const ::basegfx::B2ISize maSize;
126 const bool mbHasAlpha;
130 #endif /* _CAIROCANVAS_CANVASBITMAP_HXX */
132 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */