LibreOffice Module canvas (master)  1
ogl_canvascustomsprite.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 
10 #ifndef INCLUDED_CANVAS_SOURCE_OPENGL_OGL_CANVASCUSTOMSPRITE_HXX
11 #define INCLUDED_CANVAS_SOURCE_OPENGL_OGL_CANVASCUSTOMSPRITE_HXX
12 
13 #include <cppuhelper/compbase.hxx>
14 
15 #include <com/sun/star/rendering/XCustomSprite.hpp>
16 #include <com/sun/star/rendering/XPolyPolygon2D.hpp>
17 
19 
20 #include <base/basemutexhelper.hxx>
21 
22 #include "ogl_spritecanvas.hxx"
23 #include "ogl_canvashelper.hxx"
24 
25 
26 namespace oglcanvas
27 {
28  typedef ::cppu::WeakComponentImplHelper< css::rendering::XCustomSprite,
29  css::rendering::XCanvas > CanvasCustomSpriteBase_Base;
30  typedef ::canvas::CanvasBase<
33  ::osl::MutexGuard,
35 
36  /* Definition of CanvasCustomSprite class */
37 
38  class CanvasCustomSprite : public CanvasCustomSpriteBaseT
39  {
40  public:
55  CanvasCustomSprite( const css::geometry::RealSize2D& rSpriteSize,
56  const SpriteCanvasRef& rRefDevice,
57  SpriteDeviceHelper& rDeviceHelper );
58 
59  virtual void disposeThis() override;
60 
61  // XSprite
62  virtual void SAL_CALL setAlpha( double alpha ) override;
63  virtual void SAL_CALL move( const css::geometry::RealPoint2D& aNewPos, const css::rendering::ViewState& viewState, const css::rendering::RenderState& renderState ) override;
64  virtual void SAL_CALL transform( const css::geometry::AffineMatrix2D& aTransformation ) override;
65  virtual void SAL_CALL clip( const css::uno::Reference< css::rendering::XPolyPolygon2D >& aClip ) override;
66  virtual void SAL_CALL setPriority( double nPriority ) override;
67  virtual void SAL_CALL show() override;
68  virtual void SAL_CALL hide() override;
69 
70  // XCustomSprite
71  virtual css::uno::Reference< css::rendering::XCanvas > SAL_CALL getContentCanvas() override;
72 
73  double getPriority() const { return mfPriority; }
74 
76  bool renderSprite() const;
77 
78  private:
83  const css::geometry::RealSize2D maSize;
84 
85  css::uno::Reference< css::rendering::XPolyPolygon2D > mxClip;
86  css::geometry::AffineMatrix2D maTransformation;
88  double mfAlpha;
89  double mfPriority;
90  };
91 }
92 
93 #endif
94 
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
::canvas::CanvasBase< ::canvas::BaseMutexHelper< CanvasCustomSpriteBase_Base >, CanvasHelper,::osl::MutexGuard,::cppu::OWeakObject > CanvasCustomSpriteBaseT
bool renderSprite() const
Render sprite content at sprite position.
Helper class for basic canvas functionality.
const css::geometry::RealSize2D maSize
virtual void SAL_CALL hide() override
virtual void SAL_CALL setPriority(double nPriority) override
css::uno::Reference< css::rendering::XPolyPolygon2D > mxClip
virtual void SAL_CALL move(const css::geometry::RealPoint2D &aNewPos, const css::rendering::ViewState &viewState, const css::rendering::RenderState &renderState) override
virtual void SAL_CALL clip(const css::uno::Reference< css::rendering::XPolyPolygon2D > &aClip) override
virtual css::uno::Reference< css::rendering::XCanvas > SAL_CALL getContentCanvas() override
SpriteCanvasRef mpSpriteCanvas
MUST hold here, too, since CanvasHelper only contains a raw pointer (without refcounting) ...
virtual void SAL_CALL setAlpha(double alpha) override
::cppu::WeakComponentImplHelper< css::rendering::XCustomSprite, css::rendering::XCanvas > CanvasCustomSpriteBase_Base
css::geometry::AffineMatrix2D maTransformation
CanvasCustomSprite(const css::geometry::RealSize2D &rSpriteSize, const SpriteCanvasRef &rRefDevice, SpriteDeviceHelper &rDeviceHelper)
Create a custom sprite.
virtual void SAL_CALL transform(const css::geometry::AffineMatrix2D &aTransformation) override
virtual void SAL_CALL show() override