update dev300-m58
[ooovba.git] / canvas / source / vcl / spritehelper.hxx
blob07bda7a33c2638a63039da92fa0268653b4d9e18
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: spritehelper.hxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _VCLCANVAS_SPRITEHELPER_HXX
32 #define _VCLCANVAS_SPRITEHELPER_HXX
34 #include <com/sun/star/rendering/XCustomSprite.hpp>
36 #include <vcl/virdev.hxx>
38 #include <canvas/base/canvascustomspritehelper.hxx>
39 #include <canvas/base/spritesurface.hxx>
40 #include <canvas/vclwrapper.hxx>
42 #include "backbuffer.hxx"
43 #include "impltools.hxx"
44 #include "spritecanvas.hxx"
47 namespace vclcanvas
49 /* Definition of SpriteHelper class */
51 /** Helper class for canvas sprites.
53 This class implements all sprite-related functionality, like
54 that available on the XSprite interface.
56 class SpriteHelper : public ::canvas::CanvasCustomSpriteHelper
58 public:
59 SpriteHelper();
61 // make CanvasCustomSpriteHelper::init visible for name lookup
62 using ::canvas::CanvasCustomSpriteHelper::init;
64 /** Late-init the sprite helper
66 @param rSpriteSize
67 Size of the sprite
69 @param rSpriteCanvas
70 Sprite canvas this sprite is part of. Object stores
71 ref-counted reference to it, thus, don't forget to pass on
72 disposing()!
74 @param rBackBuffer
75 Buffer of the sprite content (non-alpha part)
77 @param rBackBufferMask
78 Buffer of the sprite content (alpha part)
80 void init( const ::com::sun::star::geometry::RealSize2D& rSpriteSize,
81 const ::canvas::SpriteSurface::Reference& rOwningSpriteCanvas,
82 const BackBufferSharedPtr& rBackBuffer,
83 const BackBufferSharedPtr& rBackBufferMask,
84 bool bShowSpriteBounds );
86 void disposing();
88 /** Repaint sprite content to associated sprite canvas
90 @param rPos
91 Output position (sprite's own position is disregarded)
93 @param io_bSurfacesDirty
94 When true, the referenced sprite surfaces (backBuffer and
95 backBufferMask) have been modified since last call.
97 @param bBufferedUpdate
98 When true, the redraw does <em>not</em> happen directly on
99 the front buffer, but within a VDev. Used to speed up
100 drawing.
102 void redraw( OutputDevice& rOutDev,
103 const ::basegfx::B2DPoint& rPos,
104 bool& bSurfacesDirty,
105 bool bBufferedUpdate ) const;
107 private:
108 virtual ::basegfx::B2DPolyPolygon polyPolygonFromXPolyPolygon2D(
109 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPoly ) const;
111 // for the redraw
112 BackBufferSharedPtr mpBackBuffer;
113 BackBufferSharedPtr mpBackBufferMask;
115 /// Cached bitmap for the current sprite content
116 mutable ::canvas::vcltools::VCLObject<BitmapEx> maContent;
118 /// When true, line sprite corners in red
119 bool mbShowSpriteBounds;
124 #endif /* _VCLCANVAS_SPRITEHELPER_HXX */