summaryrefslogtreecommitdiff
path: root/canvas/source/tools/surface.hxx
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2005-11-02 11:55:38 +0000
committerKurt Zenker <kz@openoffice.org>2005-11-02 11:55:38 +0000
commit2518d8979a761cfb89f1fa0ac3cdb31226f66106 (patch)
tree41c88353755c524740b414a039f5bd2dd4f36def /canvas/source/tools/surface.hxx
parent45d53a75ba86743af8ecdc1cf5db1752ca3136c4 (diff)
INTEGRATION: CWS canvas02 (1.1.2); FILE ADDED
2005/10/11 15:41:20 thb 1.1.2.3: #i54170# Corrected license headers 2005/10/07 23:05:05 thb 1.1.2.2: #i48939# Unified formatting; improved constness; avoided a few copy constructions; pruned debug code; removed empty destructors; moved end iterator queries out of the loops 2005/09/29 09:41:30 mbu 1.1.2.1: surfaceproxy now has completely redesigned strategy, does no longer depend on amount of available videomemory
Diffstat (limited to 'canvas/source/tools/surface.hxx')
-rw-r--r--canvas/source/tools/surface.hxx188
1 files changed, 188 insertions, 0 deletions
diff --git a/canvas/source/tools/surface.hxx b/canvas/source/tools/surface.hxx
new file mode 100644
index 000000000000..d3271d794a10
--- /dev/null
+++ b/canvas/source/tools/surface.hxx
@@ -0,0 +1,188 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: surface.hxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: kz $ $Date: 2005-11-02 12:55:38 $
+ *
+ * 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_SURFACE_HXX
+#define INCLUDED_CANVAS_SURFACE_HXX
+
+#ifndef _BGFX_POINT_B2IPOINT_HXX
+#include <basegfx/point/b2ipoint.hxx>
+#endif
+#ifndef _BGFX_POINT_B2DPOINT_HXX
+#include <basegfx/point/b2dpoint.hxx>
+#endif
+#ifndef _BGFX_POLYGON_B2DPOLYGON_HXX
+#include <basegfx/polygon/b2dpolygon.hxx>
+#endif
+#ifndef _BGFX_RANGE_B2DRECTANGLE_HXX
+#include <basegfx/range/b2drectangle.hxx>
+#endif
+#ifndef _BGFX_VECTOR_B2ISIZE_HXX
+#include <basegfx/vector/b2isize.hxx>
+#endif
+#ifndef _BGFX_MATRIX_B2DHOMMATRIX_HXX
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#endif
+#ifndef INCLUDED_CANVAS_IRENDERMODULE_HXX
+#include <canvas/rendering/irendermodule.hxx>
+#endif
+#ifndef INCLUDED_CANVAS_ICOLORBUFFER_HXX
+#include <canvas/rendering/icolorbuffer.hxx>
+#endif
+#ifndef INCLUDED_CANVAS_ISURFACE_HXX
+#include <canvas/rendering/isurface.hxx>
+#endif
+
+#include "surfacerect.hxx"
+#include "pagemanager.hxx"
+
+namespace canvas
+{
+ //////////////////////////////////////////////////////////////////////////////////
+ // Surface
+ //////////////////////////////////////////////////////////////////////////////////
+
+ /** surfaces denote occupied areas withing pages.
+
+ pages encapsulate the hardware buffers that
+ contain image data which can be used for texturing.
+ surfaces are areas within those pages.
+ */
+ class Surface
+ {
+ public:
+
+ Surface( const PageManagerSharedPtr& rPageManager,
+ const IColorBufferSharedPtr& rColorBuffer,
+ const ::basegfx::B2IPoint& rPos,
+ const ::basegfx::B2ISize& rSize );
+ ~Surface();
+
+ void setColorBufferDirty();
+
+ /** Render the surface content to screen.
+
+ @param fAlpha
+ Overall alpha for content
+
+ @param rPos
+ Output position
+
+ @param rTransform
+ Output transformation (does not affect output position)
+ */
+ bool draw( double fAlpha,
+ const ::basegfx::B2DPoint& rPos,
+ const ::basegfx::B2DHomMatrix& rTransform );
+
+ /** Render the surface content to screen.
+
+ @param fAlpha
+ Overall alpha for content
+
+ @param rPos
+ Output position
+
+ @param rArea
+ Subset of the surface to render. Coordinate system are
+ surface area pixel, given area will be clipped to the
+ surface bounds.
+
+ @param rTransform
+ Output transformation (does not affect output position)
+ */
+ bool drawRectangularArea(
+ double fAlpha,
+ const ::basegfx::B2DPoint& rPos,
+ const ::basegfx::B2DRange& rArea,
+ const ::basegfx::B2DHomMatrix& rTransform );
+
+ /** Render the surface content to screen.
+
+ @param fAlpha
+ Overall alpha for content
+
+ @param rPos
+ Output position
+
+ @param rClipPoly
+ Clip polygon for the surface. The clip polygon is also
+ subject to the output transformation.
+
+ @param rTransform
+ Output transformation (does not affect output position)
+ */
+ bool drawWithClip( double fAlpha,
+ const ::basegfx::B2DPoint& rPos,
+ const ::basegfx::B2DPolygon& rClipPoly,
+ const ::basegfx::B2DHomMatrix& rTransform );
+
+ // private attributes
+ private:
+ IColorBufferSharedPtr mpColorBuffer;
+
+ // invoking any of the above defined 'draw' methods
+ // will forward primitive commands to the rendermodule.
+ PageManagerSharedPtr mpPageManager;
+
+ FragmentSharedPtr mpFragment;
+
+ // the offset of this surface with regard to the source
+ // image. if the source image had to be tiled into multiple
+ // surfaces, this offset denotes the relative pixel distance
+ // from the source image's upper, left corner
+ ::basegfx::B2IPoint maSourceOffset;
+
+ // the size in pixels of this surface. please note that
+ // this size is likely to be smaller than the size of
+ // the colorbuffer we're associated with since we
+ // maybe represent only a part of it.
+ ::basegfx::B2ISize maSize;
+
+ bool mbIsDirty;
+
+ // private methods
+ private:
+ bool refresh( canvas::IColorBuffer& rBuffer ) const;
+ void prepareRendering();
+
+ basegfx::B2DRectangle getUVCoords() const;
+ basegfx::B2DRectangle getUVCoords( const ::basegfx::B2IPoint& rPos,
+ const ::basegfx::B2ISize& rSize ) const;
+ };
+
+ typedef ::boost::shared_ptr< Surface > SurfaceSharedPtr;
+}
+
+#endif