bump product version to 7.6.3.2-android
[LibreOffice.git] / canvas / source / vcl / canvasbitmap.hxx
blob1a95ce8c632c4ae160aefe7f5c8c66c10b45d9e4
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 #pragma once
22 #include <cppuhelper/compbase.hxx>
24 #include <com/sun/star/lang/XServiceInfo.hpp>
25 #include <com/sun/star/rendering/XBitmapCanvas.hpp>
26 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
27 #include <com/sun/star/beans/XFastPropertySet.hpp>
29 #include <vcl/bitmapex.hxx>
31 #include <base/bitmapcanvasbase.hxx>
32 #include <base/basemutexhelper.hxx>
33 #include <base/integerbitmapbase.hxx>
34 #include "canvasbitmaphelper.hxx"
36 #include "impltools.hxx"
37 #include "repainttarget.hxx"
40 /* Definition of CanvasBitmap class */
42 namespace vclcanvas
44 typedef ::cppu::WeakComponentImplHelper< css::rendering::XBitmapCanvas,
45 css::rendering::XIntegerBitmap,
46 css::lang::XServiceInfo,
47 css::beans::XFastPropertySet > CanvasBitmapBase_Base;
48 typedef ::canvas::IntegerBitmapBase<
49 canvas::BitmapCanvasBase2<
50 ::canvas::BaseMutexHelper< CanvasBitmapBase_Base >,
51 CanvasBitmapHelper,
52 tools::LocalGuard,
53 ::cppu::OWeakObject> > CanvasBitmap_Base;
55 class CanvasBitmap : public CanvasBitmap_Base,
56 public RepaintTarget
58 public:
59 /** Must be called with locked Solar mutex
61 @param rSize
62 Size in pixel of the bitmap to generate
64 @param bAlphaBitmap
65 When true, bitmap will have an alpha channel
67 @param rDevice
68 Reference device, with which bitmap should be compatible
70 CanvasBitmap( const ::Size& rSize,
71 bool bAlphaBitmap,
72 css::rendering::XGraphicDevice& rDevice,
73 const OutDevProviderSharedPtr& rOutDevProvider );
75 /// Must be called with locked Solar mutex
76 CanvasBitmap( const BitmapEx& rBitmap,
77 css::rendering::XGraphicDevice& rDevice,
78 const OutDevProviderSharedPtr& rOutDevProvider );
80 // XServiceInfo
81 virtual OUString SAL_CALL getImplementationName( ) override;
82 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
83 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
85 // RepaintTarget interface
86 virtual bool repaint( const GraphicObjectSharedPtr& rGrf,
87 const css::rendering::ViewState& viewState,
88 const css::rendering::RenderState& renderState,
89 const ::Point& rPt,
90 const ::Size& rSz,
91 const GraphicAttr& rAttr ) const override;
93 /// Not threadsafe! Returned object is shared!
94 BitmapEx getBitmap() const;
96 // XFastPropertySet
97 // used to retrieve BitmapEx pointer or X Pixmap handles for this bitmap
98 // handle values have these meanings:
99 // 0 ... get pointer to BitmapEx
100 // 1 ... get X pixmap handle to rgb content
101 // 2 ... get X pixmap handle to alpha mask
102 // returned any contains either BitmapEx pointer or array of three Any value
103 // 1st a bool value: true - free the pixmap after used by XFreePixmap, false do nothing, the pixmap is used internally in the canvas
104 // 2nd the pixmap handle (sal_Int64)
105 // 3rd the pixmap depth
106 virtual css::uno::Any SAL_CALL getFastPropertyValue(sal_Int32 nHandle) override;
107 virtual void SAL_CALL setFastPropertyValue(sal_Int32, const css::uno::Any&) override {}
109 private:
110 /** MUST hold here, too, since CanvasHelper only contains a
111 raw pointer (without refcounting)
113 css::uno::Reference<css::rendering::XGraphicDevice> mxDevice;
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */