LibreOffice Module canvas (master) 1
canvasbitmap.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
23
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>
28
29#include <vcl/bitmapex.hxx>
30
35
36#include "impltools.hxx"
37#include "repainttarget.hxx"
38
39
40/* Definition of CanvasBitmap class */
41
42namespace vclcanvas
43{
44 typedef ::cppu::WeakComponentImplHelper< css::rendering::XBitmapCanvas,
45 css::rendering::XIntegerBitmap,
46 css::lang::XServiceInfo,
47 css::beans::XFastPropertySet > CanvasBitmapBase_Base;
54
56 public RepaintTarget
57 {
58 public:
70 CanvasBitmap( const ::Size& rSize,
71 bool bAlphaBitmap,
72 css::rendering::XGraphicDevice& rDevice,
73 const OutDevProviderSharedPtr& rOutDevProvider );
74
76 CanvasBitmap( const BitmapEx& rBitmap,
77 css::rendering::XGraphicDevice& rDevice,
78 const OutDevProviderSharedPtr& rOutDevProvider );
79
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;
84
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;
92
94 BitmapEx getBitmap() const;
95
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 {}
108
109 private:
113 css::uno::Reference<css::rendering::XGraphicDevice> mxDevice;
114 };
115}
116
117/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Helper template to handle XIntegerBitmap method forwarding to BitmapCanvasHelper.
Helper class for basic canvasbitmap functionality.
css::uno::Reference< css::rendering::XGraphicDevice > mxDevice
MUST hold here, too, since CanvasHelper only contains a raw pointer (without refcounting)
BitmapEx getBitmap() const
Not threadsafe! Returned object is shared!
virtual css::uno::Any SAL_CALL getFastPropertyValue(sal_Int32 nHandle) override
CanvasBitmap(const BitmapEx &rBitmap, css::rendering::XGraphicDevice &rDevice, const OutDevProviderSharedPtr &rOutDevProvider)
Must be called with locked Solar mutex.
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual void SAL_CALL setFastPropertyValue(sal_Int32, const css::uno::Any &) override
virtual bool repaint(const GraphicObjectSharedPtr &rGrf, const css::rendering::ViewState &viewState, const css::rendering::RenderState &renderState, const ::Point &rPt, const ::Size &rSz, const GraphicAttr &rAttr) const override
CanvasBitmap(const ::Size &rSize, bool bAlphaBitmap, css::rendering::XGraphicDevice &rDevice, const OutDevProviderSharedPtr &rOutDevProvider)
Must be called with locked Solar mutex.
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual OUString SAL_CALL getImplementationName() override
std::shared_ptr< OutDevProvider > OutDevProviderSharedPtr
::cppu::WeakComponentImplHelper< css::rendering::XBitmapCanvas, css::rendering::XIntegerBitmap, css::lang::XServiceInfo, css::beans::XFastPropertySet > CanvasBitmapBase_Base
std::shared_ptr< GraphicObject > GraphicObjectSharedPtr
::canvas::IntegerBitmapBase< canvas::BitmapCanvasBase2< ::canvas::BaseMutexHelper< CanvasBitmapBase_Base >, CanvasBitmapHelper, tools::LocalGuard, ::cppu::OWeakObject > > CanvasBitmap_Base
unsigned char sal_Bool