LibreOffice Module canvas (master) 1
bitmapcanvasbase.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
22#include <base/canvasbase.hxx>
23#include <com/sun/star/geometry/IntegerSize2D.hpp>
24
25namespace com::sun::star::rendering { class XBitmapCanvas; }
26
27namespace canvas
28{
62 template< class Base,
63 class CanvasHelper,
64 class Mutex=::osl::MutexGuard,
65 class UnambiguousBase=css::uno::XInterface > class BitmapCanvasBase :
66 public CanvasBase< Base, CanvasHelper, Mutex, UnambiguousBase >
67 {
68 public:
70
71 // XBitmap
72 virtual css::geometry::IntegerSize2D SAL_CALL getSize( ) override
73 {
74 typename BaseType::MutexType aGuard( BaseType::m_aMutex );
75
76 return BaseType::maCanvasHelper.getSize();
77 }
78
79 virtual sal_Bool SAL_CALL hasAlpha( ) override
80 {
81 return true;
82 }
83
84 virtual css::uno::Reference< css::rendering::XBitmap > SAL_CALL getScaledBitmap( const css::geometry::RealSize2D& newSize,
85 sal_Bool beFast ) override
86 {
87 typename BaseType::MutexType aGuard( BaseType::m_aMutex );
88
89 return BaseType::maCanvasHelper.getScaledBitmap( newSize, beFast );
90 }
91
92 };
93
94 template< class Base,
95 class CanvasHelper,
96 class Mutex=::osl::MutexGuard,
97 class UnambiguousBase = css::uno::XInterface > class BitmapCanvasBase2 :
98 public BitmapCanvasBase< Base, CanvasHelper, Mutex, UnambiguousBase >
99 {
102
103 public:
104 // XBitmapCanvas
105 virtual void SAL_CALL copyRect( const css::uno::Reference< css::rendering::XBitmapCanvas >& sourceCanvas,
106 const css::geometry::RealRectangle2D& sourceRect,
107 const css::rendering::ViewState& sourceViewState,
108 const css::rendering::RenderState& sourceRenderState,
109 const css::geometry::RealRectangle2D& destRect,
110 const css::rendering::ViewState& destViewState,
111 const css::rendering::RenderState& destRenderState ) override
112 {
113 tools::verifyArgs(sourceCanvas, sourceRect, sourceViewState, sourceRenderState,
114 destRect, destViewState, destRenderState,
115 __func__,
116 static_cast< typename BaseType::UnambiguousBaseType* >(this));
117
118 typename BaseType::BaseType::MutexType aGuard( BaseType::m_aMutex );
119
121 }
122 };
123}
124
125/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
BitmapCanvasBase< Base, CanvasHelper, Mutex, UnambiguousBase > BaseType
virtual void SAL_CALL copyRect(const css::uno::Reference< css::rendering::XBitmapCanvas > &sourceCanvas, const css::geometry::RealRectangle2D &sourceRect, const css::rendering::ViewState &sourceViewState, const css::rendering::RenderState &sourceRenderState, const css::geometry::RealRectangle2D &destRect, const css::rendering::ViewState &destViewState, const css::rendering::RenderState &destRenderState) override
Helper template to handle XBitmapCanvas method forwarding to BitmapCanvasHelper.
virtual css::uno::Reference< css::rendering::XBitmap > SAL_CALL getScaledBitmap(const css::geometry::RealSize2D &newSize, sal_Bool beFast) override
virtual sal_Bool SAL_CALL hasAlpha() override
virtual css::geometry::IntegerSize2D SAL_CALL getSize() override
CanvasBase< Base, CanvasHelper, Mutex, UnambiguousBase > BaseType
Helper template to handle XCanvas method forwarding to CanvasHelper.
Definition: canvasbase.hxx:109
CanvasHelper maCanvasHelper
Definition: canvasbase.hxx:441
void verifyArgs(const Arg0 &rArg0, const char *pStr, const css::uno::Reference< css::uno::XInterface > &xIf)
unsigned char sal_Bool
Base