summaryrefslogtreecommitdiff
path: root/canvas/inc
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2005-11-02 11:43:56 +0000
committerKurt Zenker <kz@openoffice.org>2005-11-02 11:43:56 +0000
commitf87a3910b3c405e63dd8090424136d844248a005 (patch)
treeb78061bd60e97bbb9b97e733de309e8b52e95823 /canvas/inc
parent47b985ea67c39c75c7bb8eb86adb7ad5a7408abb (diff)
INTEGRATION: CWS canvas02 (1.1.2); FILE ADDED
2005/10/14 21:38:49 thb 1.1.2.4: #118732# Added working sprite prio; now correctly calculating remaining (inactive) set of sprites. 2005/10/11 15:40:35 thb 1.1.2.3: #i54170# Corrected license headers 2005/07/21 14:52:32 thb 1.1.2.2: #i48939# Factored out round up/down to integer; removed backend specific methods from base Sprite interface; removed updateScreen overwrite from SpriteCanvasBase (too much backend specifics need to be passed to HW canvases); now passing the target OutputDevice directly via Sprite::redraw() method in VCL canvas; made XFont -> impl font conversion dynamic cast, too; removed the getSpriteTargetSurface crap from SpriteCanvas 2005/06/17 23:36:53 thb 1.1.2.1: #i48939# Refactored canvas, these are base classes that encapsulate common functionality (like input checking, locking, and general behaviour common to all canvas implementations)
Diffstat (limited to 'canvas/inc')
-rw-r--r--canvas/inc/canvas/base/sprite.hxx135
1 files changed, 135 insertions, 0 deletions
diff --git a/canvas/inc/canvas/base/sprite.hxx b/canvas/inc/canvas/base/sprite.hxx
new file mode 100644
index 000000000000..4e193ec7b6f9
--- /dev/null
+++ b/canvas/inc/canvas/base/sprite.hxx
@@ -0,0 +1,135 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: sprite.hxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: kz $ $Date: 2005-11-02 12:43:56 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_CANVAS_SPRITE_HXX
+#define INCLUDED_CANVAS_SPRITE_HXX
+
+#ifndef _RTL_REF_HXX_
+#include <rtl/ref.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
+#include <com/sun/star/lang/XComponent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_RENDERING_XCANVAS_HPP_
+#include <com/sun/star/rendering/XCanvas.hpp>
+#endif
+
+#ifndef _BGFX_POINT_B2DPOINT_HXX
+#include <basegfx/vector/b2dpoint.hxx>
+#endif
+#ifndef _BGFX_VECTOR_B2DSIZE_HXX
+#include <basegfx/vector/b2dsize.hxx>
+#endif
+
+namespace basegfx
+{
+ class B2DPoint;
+ class B2DVector;
+ class B2DRange;
+}
+
+namespace canvas
+{
+ /* Definition of Sprite interface (as we mix with UNO here, has to
+ be XInterface - reference holders to a Sprite must be able to
+ control lifetime of reference target)
+ */
+
+ /** Helper interface to connect SpriteCanvas with various
+ sprite implementations.
+
+ This interface should be implemented from every sprite class,
+ as it provides essential repaint and update area facilitates.
+
+ @derive typically, each canvas implementation will derive
+ another interface from this one, that adds rendering
+ functionality (which, of course, is impossible here in a
+ generic way)
+ */
+ class Sprite : public virtual ::com::sun::star::lang::XComponent
+ {
+ public:
+ typedef ::rtl::Reference< Sprite > Reference;
+
+ /** Query whether sprite update will fully cover the given area.
+
+ Use this method to determine whether any background
+ content (regardless of static or sprite) needs an update
+ before rendering this sprite.
+
+ @return true, if sprite redraw will fully overwrite given
+ area (and thus, the background need not be redrawn
+ beforehand).
+ */
+ virtual bool isAreaUpdateOpaque( const ::basegfx::B2DRange& rUpdateArea ) const = 0;
+
+ /** Query position of the left, top pixel of the sprite
+ */
+ virtual ::basegfx::B2DPoint getPosPixel() const = 0;
+
+ /** Query size of the sprite in pixel.
+ */
+ virtual ::basegfx::B2DVector getSizePixel() const = 0;
+
+ /** Get area that is currently covered by the sprite
+
+ This area is already adapted to clipping, alpha and
+ transformation state of this sprite.
+ */
+ virtual ::basegfx::B2DRange getUpdateArea() const = 0;
+
+ /** Query sprite priority
+ */
+ virtual double getPriority() const = 0;
+ };
+
+ /** Functor providing a StrictWeakOrdering for sprite references
+ */
+ struct SpriteComparator
+ {
+ bool operator()( const Sprite::Reference& rLHS,
+ const Sprite::Reference& rRHS )
+ {
+ const double nPrioL( rLHS->getPriority() );
+ const double nPrioR( rRHS->getPriority() );
+
+ // if prios are equal, tie-break on ptr value
+ return nPrioL == nPrioR ? rLHS.get() < rRHS.get() : nPrioL < nPrioR;
+ }
+ };
+}
+
+#endif /* INCLUDED_CANVAS_SPRITE_HXX */