LibreOffice Module canvas (master) 1
cairo_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#include <comphelper/uno3.hxx>
29
33
36
37
38/* Definition of CanvasBitmap class */
39
40namespace cairocanvas
41{
42 typedef ::cppu::WeakComponentImplHelper< css::rendering::XBitmapCanvas,
43 css::rendering::XIntegerBitmap,
44 css::lang::XServiceInfo,
45 css::beans::XFastPropertySet > CanvasBitmapBase_Base;
47 public ::canvas::BaseMutexHelper<CanvasBitmapBase_Base>,
48 public SurfaceProvider
49 {
50 };
51
56 ::osl::MutexGuard,
58
60 public RepaintTarget
61 {
62 public:
71 CanvasBitmap( const ::basegfx::B2ISize& rSize,
72 SurfaceProviderRef rDevice,
73 css::rendering::XGraphicDevice* pDevice,
74 bool bHasAlpha );
75
77 virtual void disposeThis() override;
78
79 // Forwarding the XComponent implementation to the
80 // cppu::ImplHelper templated base
81 // Classname Base doing refcounting Base implementing the XComponent interface
82 // | | |
83 // V V V
84 DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( CanvasBitmap, CanvasBitmapBase_Base, ::cppu::WeakComponentImplHelperBase )
85
86 // XServiceInfo
87 virtual OUString SAL_CALL getImplementationName( ) override;
88 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
89 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
90
91 // SurfaceProvider
92 virtual ::cairo::SurfaceSharedPtr getSurface() override;
93 virtual ::cairo::SurfaceSharedPtr createSurface( const ::basegfx::B2ISize& rSize, int aContent ) override;
94 virtual ::cairo::SurfaceSharedPtr createSurface( ::Bitmap& rBitmap ) override;
95 virtual ::cairo::SurfaceSharedPtr changeSurface() override;
96 virtual OutputDevice* getOutputDevice() override;
97
98 // RepaintTarget
99 virtual bool repaint( const ::cairo::SurfaceSharedPtr& pSurface,
100 const css::rendering::ViewState& viewState,
101 const css::rendering::RenderState& renderState ) override;
102
103 // XFastPropertySet
104 // used to retrieve BitmapEx pointer or X Pixmap handles for this bitmap
105 // handle values have these meanings:
106 // 0 ... get pointer to BitmapEx
107 // 1 ... get X pixmap handle to rgb content
108 // 2 ... FIXME: leftover? ever called with this? always returns nothing (empty Any)
109 // returned any contains either BitmapEx pointer or array of two Any value
110 // 1st a bool value: true - free the pixmap after used by XFreePixmap, false do nothing, the pixmap is used internally in the canvas
111 // 2nd the pixmap handle (sal_Int64)
112 virtual css::uno::Any SAL_CALL getFastPropertyValue(sal_Int32 nHandle) override;
113 virtual void SAL_CALL setFastPropertyValue(sal_Int32, const css::uno::Any&) override {}
114
115 private:
119
120 const ::basegfx::B2ISize maSize;
121 const bool mbHasAlpha;
122 };
123}
124
125/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const ::basegfx::B2ISize maSize
virtual void SAL_CALL setFastPropertyValue(sal_Int32, const css::uno::Any &) override
::cairo::SurfaceSharedPtr mpBufferSurface
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual OUString SAL_CALL getImplementationName() override
virtual bool repaint(const ::cairo::SurfaceSharedPtr &pSurface, const css::rendering::ViewState &viewState, const css::rendering::RenderState &renderState) override
virtual ::cairo::SurfaceSharedPtr changeSurface() override
CanvasBitmap(const ::basegfx::B2ISize &rSize, SurfaceProviderRef rDevice, css::rendering::XGraphicDevice *pDevice, bool bHasAlpha)
Create a canvas bitmap for the given surface.
::cairo::CairoSharedPtr mpBufferCairo
SurfaceProviderRef mpSurfaceProvider
virtual css::uno::Any SAL_CALL getFastPropertyValue(sal_Int32 nHandle) override
virtual ::cairo::SurfaceSharedPtr getSurface() override
virtual void disposeThis() override
Dispose all internal references.
virtual ::cairo::SurfaceSharedPtr createSurface(const ::basegfx::B2ISize &rSize, int aContent) override
virtual OutputDevice * getOutputDevice() override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Base class, initializing its own baseclass with m_aMutex.
Helper template to handle XIntegerBitmap method forwarding to BitmapCanvasHelper.
std::shared_ptr< Surface > SurfaceSharedPtr
std::shared_ptr< cairo_t > CairoSharedPtr
::cppu::WeakComponentImplHelper< css::rendering::XBitmapCanvas, css::rendering::XIntegerBitmap, css::lang::XServiceInfo, css::beans::XFastPropertySet > CanvasBitmapBase_Base
class SAL_LOPLUGIN_ANNOTATE("crosscast") SurfaceProvider typedef ::rtl::Reference< SurfaceProvider > SurfaceProviderRef
Target interface for XCachedPrimitive implementations.
::canvas::IntegerBitmapBase< canvas::BitmapCanvasBase2< CanvasBitmapSpriteSurface_Base, CanvasHelper, ::osl::MutexGuard, ::cppu::OWeakObject > > CanvasBitmap_Base
unsigned char sal_Bool
#define DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS(classname, baseclass, implhelper)