Branch data Line data Source code
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 : : #ifndef _VCLCANVAS_SPRITEHELPER_HXX
21 : : #define _VCLCANVAS_SPRITEHELPER_HXX
22 : :
23 : : #include <com/sun/star/rendering/XCustomSprite.hpp>
24 : :
25 : : #include <vcl/virdev.hxx>
26 : :
27 : : #include <canvas/base/canvascustomspritehelper.hxx>
28 : : #include <canvas/base/spritesurface.hxx>
29 : : #include <canvas/vclwrapper.hxx>
30 : :
31 : : #include "backbuffer.hxx"
32 : : #include "impltools.hxx"
33 : : #include "spritecanvas.hxx"
34 : :
35 : :
36 : : namespace vclcanvas
37 : : {
38 : : /* Definition of SpriteHelper class */
39 : :
40 : : /** Helper class for canvas sprites.
41 : :
42 : : This class implements all sprite-related functionality, like
43 : : that available on the XSprite interface.
44 : : */
45 : 0 : class SpriteHelper : public ::canvas::CanvasCustomSpriteHelper
46 : : {
47 : : public:
48 : : SpriteHelper();
49 : :
50 : : // make CanvasCustomSpriteHelper::init visible for name lookup
51 : : using ::canvas::CanvasCustomSpriteHelper::init;
52 : :
53 : : /** Late-init the sprite helper
54 : :
55 : : @param rSpriteSize
56 : : Size of the sprite
57 : :
58 : : @param rSpriteCanvas
59 : : Sprite canvas this sprite is part of. Object stores
60 : : ref-counted reference to it, thus, don't forget to pass on
61 : : disposing()!
62 : :
63 : : @param rBackBuffer
64 : : Buffer of the sprite content (non-alpha part)
65 : :
66 : : @param rBackBufferMask
67 : : Buffer of the sprite content (alpha part)
68 : : */
69 : : void init( const ::com::sun::star::geometry::RealSize2D& rSpriteSize,
70 : : const ::canvas::SpriteSurface::Reference& rOwningSpriteCanvas,
71 : : const BackBufferSharedPtr& rBackBuffer,
72 : : const BackBufferSharedPtr& rBackBufferMask,
73 : : bool bShowSpriteBounds );
74 : :
75 : : void disposing();
76 : :
77 : : /** Repaint sprite content to associated sprite canvas
78 : :
79 : : @param rPos
80 : : Output position (sprite's own position is disregarded)
81 : :
82 : : @param io_bSurfacesDirty
83 : : When true, the referenced sprite surfaces (backBuffer and
84 : : backBufferMask) have been modified since last call.
85 : :
86 : : @param bBufferedUpdate
87 : : When true, the redraw does <em>not</em> happen directly on
88 : : the front buffer, but within a VDev. Used to speed up
89 : : drawing.
90 : : */
91 : : void redraw( OutputDevice& rOutDev,
92 : : const ::basegfx::B2DPoint& rPos,
93 : : bool& bSurfacesDirty,
94 : : bool bBufferedUpdate ) const;
95 : :
96 : : private:
97 : : virtual ::basegfx::B2DPolyPolygon polyPolygonFromXPolyPolygon2D(
98 : : ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPoly ) const;
99 : :
100 : : // for the redraw
101 : : BackBufferSharedPtr mpBackBuffer;
102 : : BackBufferSharedPtr mpBackBufferMask;
103 : :
104 : : /// Cached bitmap for the current sprite content
105 : : mutable ::canvas::vcltools::VCLObject<BitmapEx> maContent;
106 : :
107 : : /// When true, line sprite corners in red
108 : : bool mbShowSpriteBounds;
109 : :
110 : : };
111 : : }
112 : :
113 : : #endif /* _VCLCANVAS_SPRITEHELPER_HXX */
114 : :
115 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|