1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
12 #include <cppuhelper/compbase.hxx>
14 #include <com/sun/star/rendering/XCustomSprite.hpp>
15 #include <com/sun/star/rendering/XPolyPolygon2D.hpp>
17 #include <basegfx/point/b2dpoint.hxx>
19 #include <base/basemutexhelper.hxx>
21 #include "ogl_spritecanvas.hxx"
22 #include "ogl_canvashelper.hxx"
27 typedef ::cppu::WeakComponentImplHelper
< css::rendering::XCustomSprite
,
28 css::rendering::XCanvas
> CanvasCustomSpriteBase_Base
;
29 typedef ::canvas::CanvasBase
<
30 ::canvas::BaseMutexHelper
< CanvasCustomSpriteBase_Base
>,
33 ::cppu::OWeakObject
> CanvasCustomSpriteBaseT
;
35 /* Definition of CanvasCustomSprite class */
37 class CanvasCustomSprite
: public CanvasCustomSpriteBaseT
40 /** Create a custom sprite
43 Size of the sprite in pixel
46 Associated output device
54 CanvasCustomSprite( const css::geometry::RealSize2D
& rSpriteSize
,
55 const SpriteCanvasRef
& rRefDevice
,
56 SpriteDeviceHelper
& rDeviceHelper
);
58 virtual void disposeThis() override
;
61 virtual void SAL_CALL
setAlpha( double alpha
) override
;
62 virtual void SAL_CALL
move( const css::geometry::RealPoint2D
& aNewPos
, const css::rendering::ViewState
& viewState
, const css::rendering::RenderState
& renderState
) override
;
63 virtual void SAL_CALL
transform( const css::geometry::AffineMatrix2D
& aTransformation
) override
;
64 virtual void SAL_CALL
clip( const css::uno::Reference
< css::rendering::XPolyPolygon2D
>& aClip
) override
;
65 virtual void SAL_CALL
setPriority( double nPriority
) override
;
66 virtual void SAL_CALL
show() override
;
67 virtual void SAL_CALL
hide() override
;
70 virtual css::uno::Reference
< css::rendering::XCanvas
> SAL_CALL
getContentCanvas() override
;
72 double getPriority() const { return mfPriority
; }
74 /// Render sprite content at sprite position
75 bool renderSprite() const;
78 /** MUST hold here, too, since CanvasHelper only contains a
79 raw pointer (without refcounting)
81 SpriteCanvasRef mpSpriteCanvas
;
82 const css::geometry::RealSize2D maSize
;
84 css::uno::Reference
< css::rendering::XPolyPolygon2D
> mxClip
;
85 css::geometry::AffineMatrix2D maTransformation
;
86 ::basegfx::B2DPoint maPosition
;
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */