summaryrefslogtreecommitdiffstats
path: root/include/canvas/rendering
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2013-04-18 18:26:28 +0200
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2013-04-23 22:20:31 +0200
commitb9337e22ce1dbf2eba0e8c8db294ae99f4111f91 (patch)
tree53ee1bd3dfd213815a21579151983cb997922b05 /include/canvas/rendering
parentmove global headers script (diff)
downloadcore-b9337e22ce1dbf2eba0e8c8db294ae99f4111f91.tar.gz
core-b9337e22ce1dbf2eba0e8c8db294ae99f4111f91.zip
execute move of global headers
see https://gerrit.libreoffice.org/#/c/3367/ and Change-Id: I00c96fa77d04b33a6f8c8cd3490dfcd9bdc9e84a for details Change-Id: I199a75bc4042af20817265d5ef85b1134a96ff5a
Diffstat (limited to 'include/canvas/rendering')
-rw-r--r--include/canvas/rendering/bitmap.hxx314
-rw-r--r--include/canvas/rendering/icachedprimitive.hxx60
-rw-r--r--include/canvas/rendering/icolorbuffer.hxx88
-rw-r--r--include/canvas/rendering/irendermodule.hxx143
-rw-r--r--include/canvas/rendering/isurface.hxx82
-rw-r--r--include/canvas/rendering/isurfaceproxy.hxx107
-rw-r--r--include/canvas/rendering/isurfaceproxymanager.hxx74
7 files changed, 868 insertions, 0 deletions
diff --git a/include/canvas/rendering/bitmap.hxx b/include/canvas/rendering/bitmap.hxx
new file mode 100644
index 000000000000..295057bd832b
--- /dev/null
+++ b/include/canvas/rendering/bitmap.hxx
@@ -0,0 +1,314 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_BITMAP_HXX
+#define INCLUDED_CANVAS_BITMAP_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/rendering/XCanvas.hpp>
+#include <com/sun/star/rendering/IntegerBitmapLayout.hpp>
+#include <com/sun/star/geometry/IntegerRectangle2D.hpp>
+#include <com/sun/star/geometry/IntegerPoint2D.hpp>
+#include <canvas/rendering/icolorbuffer.hxx>
+#include <canvas/rendering/icachedprimitive.hxx>
+#include <canvas/rendering/isurfaceproxymanager.hxx>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/scoped_ptr.hpp>
+#include <vector>
+
+namespace basegfx
+{
+ class B2IVector;
+ class B2DPoint;
+ class B2DHomMatrix;
+ class B2DPolyPolygon;
+}
+
+namespace canvas
+{
+ class ImplBitmap;
+
+ /** Bitmap class, with XCanvas-like render interface.
+
+ This class provides a bitmap, that can be rendered into,
+ with an interface compatible to XCanvas. Furthermore, the
+ bitmaps held here can optionally be backed by (possibly
+ hw-accelerated) textures.
+ */
+ class Bitmap
+ {
+ public:
+ /** Create bitmap with given size
+
+ @param rSize
+ Size of the bitmap, in pixel
+
+ @param rMgr
+ SurfaceProxyManager, to use for HW acceleration
+
+ @param bWithAlpha
+ When true, the created bitmap will have an alpha channel,
+ false otherwise
+ */
+ Bitmap( const ::basegfx::B2IVector& rSize,
+ const ISurfaceProxyManagerSharedPtr& rMgr,
+ bool bWithAlpha );
+ ~Bitmap();
+
+ /// Query whether this bitmap contains alpha channel information
+ bool hasAlpha() const;
+
+ /// Query size of the bitmap in pixel
+ ::basegfx::B2IVector getSize() const;
+
+ ::com::sun::star::uno::Sequence< sal_Int8 > getData(
+ ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
+ const ::com::sun::star::geometry::IntegerRectangle2D& rect );
+
+ void setData(
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& data,
+ const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
+ const ::com::sun::star::geometry::IntegerRectangle2D& rect );
+
+ void setPixel(
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& color,
+ const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
+ const ::com::sun::star::geometry::IntegerPoint2D& pos );
+
+ ::com::sun::star::uno::Sequence< sal_Int8 > getPixel(
+ ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
+ const ::com::sun::star::geometry::IntegerPoint2D& pos );
+
+ /** Render the bitmap content to associated
+ SurfaceProxyManager's 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 bitmap content to associated
+ SurfaceProxyManager's 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 draw( double fAlpha,
+ const ::basegfx::B2DPoint& rPos,
+ const ::basegfx::B2DRange& rArea,
+ const ::basegfx::B2DHomMatrix& rTransform );
+
+ /** Render the bitmap content to associated
+ SurfaceProxyManager's 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 draw( double fAlpha,
+ const ::basegfx::B2DPoint& rPos,
+ const ::basegfx::B2DPolyPolygon& rClipPoly,
+ const ::basegfx::B2DHomMatrix& rTransform );
+
+ /** Clear whole bitmap with given color.
+
+ This method sets every single pixel of the bitmap to the
+ specified color value.
+ */
+ void clear( const ::com::sun::star::uno::Sequence< double >& color );
+
+ void fillB2DPolyPolygon(
+ const ::basegfx::B2DPolyPolygon& rPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState );
+
+
+ // High-level drawing operations (from the XCanvas interface)
+ // ==========================================================
+
+ /// See XCanvas interface
+ void drawPoint( const ::com::sun::star::geometry::RealPoint2D& aPoint,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState );
+ /// See XCanvas interface
+ void drawLine( const ::com::sun::star::geometry::RealPoint2D& aStartPoint,
+ const ::com::sun::star::geometry::RealPoint2D& aEndPoint,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState );
+ /// See XCanvas interface
+ void drawBezier( const ::com::sun::star::geometry::RealBezierSegment2D& aBezierSegment,
+ const ::com::sun::star::geometry::RealPoint2D& aEndPoint,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState );
+ /// See XCanvas interface
+ ICachedPrimitiveSharedPtr drawPolyPolygon(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState );
+
+ /// See XCanvas interface
+ ICachedPrimitiveSharedPtr strokePolyPolygon(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState,
+ const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes );
+ /** See XCanvas interface
+
+ @param textureAnnotations
+ Vector of shared pointers to bitmap textures,
+ <em>corresponding</em> in indices to the textures
+ sequence. This is to decouple this interface from the
+ client's XBitmap-implementation class.
+ */
+ ICachedPrimitiveSharedPtr strokeTexturedPolyPolygon(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::rendering::Texture >& textures,
+ const ::std::vector< ::boost::shared_ptr<Bitmap> >& textureAnnotations,
+ const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes );
+ /** See XCanvas interface
+
+ @param textureAnnotations
+ Vector of shared pointers to bitmap textures,
+ <em>corresponding</em> in indices to the textures
+ sequence. This is to decouple this interface from the
+ client's XBitmap-implementation class.
+ */
+ ICachedPrimitiveSharedPtr strokeTextureMappedPolyPolygon(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::rendering::Texture >& textures,
+ const ::std::vector< ::boost::shared_ptr<Bitmap> >& textureAnnotations,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::geometry::XMapping2D >& xMapping,
+ const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes );
+ /// See XCanvas interface
+ ICachedPrimitiveSharedPtr fillPolyPolygon(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState );
+ /** See XCanvas interface
+
+ @param textureAnnotations
+ Vector of shared pointers to bitmap textures,
+ <em>corresponding</em> in indices to the textures
+ sequence. This is to decouple this interface from the
+ client's XBitmap-implementation class.
+ */
+ ICachedPrimitiveSharedPtr fillTexturedPolyPolygon(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::rendering::Texture >& textures,
+ const ::std::vector< ::boost::shared_ptr<Bitmap> >& textureAnnotations );
+ /** See XCanvas interface
+
+ @param textureAnnotations
+ Vector of shared pointers to bitmap textures,
+ <em>corresponding</em> in indices to the textures
+ sequence. This is to decouple this interface from the
+ client's XBitmap-implementation class.
+ */
+ ICachedPrimitiveSharedPtr fillTextureMappedPolyPolygon(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::rendering::Texture >& textures,
+ const ::std::vector< ::boost::shared_ptr<Bitmap> >& textureAnnotations,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::geometry::XMapping2D >& xMapping );
+
+ /// See XCanvas interface
+ ICachedPrimitiveSharedPtr drawBitmap(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XBitmap >& xBitmap,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState );
+ /// See XCanvas interface
+ ICachedPrimitiveSharedPtr drawBitmap(
+ const ::boost::shared_ptr<Bitmap>& rImage,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState );
+
+ /// See XCanvas interface
+ ICachedPrimitiveSharedPtr drawBitmapModulated(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XBitmap >& xBitmap,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState );
+ /// See XCanvas interface
+ ICachedPrimitiveSharedPtr drawBitmapModulated(
+ const ::boost::shared_ptr<Bitmap>& rImage,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState );
+
+ private:
+ friend class ImplBitmap;
+
+ const ::boost::scoped_ptr< ImplBitmap > mpImpl;
+ };
+
+ typedef ::boost::shared_ptr< Bitmap > BitmapSharedPtr;
+}
+
+#endif /* INCLUDED_CANVAS_BITMAP_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/rendering/icachedprimitive.hxx b/include/canvas/rendering/icachedprimitive.hxx
new file mode 100644
index 000000000000..f15fed3e72e8
--- /dev/null
+++ b/include/canvas/rendering/icachedprimitive.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_ICACHEDPRIMITIVE_HXX
+#define INCLUDED_CANVAS_ICACHEDPRIMITIVE_HXX
+
+#include <sal/types.h>
+
+#include <boost/shared_ptr.hpp>
+
+
+namespace basegfx
+{
+ class B2IRange;
+ class B2IPoint;
+}
+
+namespace canvas
+{
+ /** Objects with this interface are returned from every Bitmap
+ render operation.
+
+ These objects can be used to implement the
+ rendering::XCachedPrimitive interface, which in turn caches
+ render state and objects to facilitate quick redraws.
+ */
+ struct ICachedPrimitive
+ {
+ virtual ~ICachedPrimitive() {}
+
+ /** Redraw the primitive with the given view state
+
+ Note that the primitive will <em>always</em> be redrawn on
+ the bitmap it was created from.
+ */
+ virtual sal_Int8 redraw( const ::com::sun::star::rendering::ViewState& aState ) const = 0;
+ };
+
+ typedef ::boost::shared_ptr< ICachedPrimitive > ICachedPrimitiveSharedPtr;
+}
+
+#endif /* INCLUDED_CANVAS_ICACHEDPRIMITIVE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/rendering/icolorbuffer.hxx b/include/canvas/rendering/icolorbuffer.hxx
new file mode 100644
index 000000000000..4226a9a6d759
--- /dev/null
+++ b/include/canvas/rendering/icolorbuffer.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_ICOLORBUFFER_HXX
+#define INCLUDED_CANVAS_ICOLORBUFFER_HXX
+
+#include <sal/types.h>
+
+#include <boost/shared_ptr.hpp>
+
+
+namespace canvas
+{
+ /** Interface for a raw memory pixel container
+
+ Use this interface to represent a surface of raw pixel (e.g. a
+ bitmap) to the canvas rendering framework.
+ */
+ struct IColorBuffer
+ {
+ /// The underlying pixel format for this buffer
+ enum Format
+ {
+ // 24-bit RGB pixel format, 8 bits per channel.
+ FMT_R8G8B8,
+
+ // 32-bit ARGB pixel format with alpha, 8 bits per channel.
+ FMT_A8R8G8B8,
+
+ // 32-bit RGB pixel format, 8 bits per channel.
+ FMT_X8R8G8B8,
+
+ // for enum to 32bit
+ FMT_UNKNOWN = static_cast<sal_uInt32>(-1)
+ };
+
+ virtual ~IColorBuffer() {}
+
+ /** Get a pointer to the raw memory bits of the pixel
+ */
+ virtual sal_uInt8* lock() const = 0;
+
+ /** unlock previous locked buffer
+ */
+ virtual void unlock() const = 0;
+
+ /** Get width in pixel
+ */
+ virtual sal_uInt32 getWidth() const = 0;
+
+ /** Get height in pixel
+ */
+ virtual sal_uInt32 getHeight() const = 0;
+
+ /** Offset, in bytes, between consecutive scan lines of the bitmap.
+ If the stride is positive, the bitmap is top-down.
+ If the stride is negative, the bitmap is bottom-up.
+ The returned value is only valid while the buffer is locked.
+ */
+ virtual sal_uInt32 getStride() const = 0;
+
+ /** Get format of the color buffer
+ */
+ virtual Format getFormat() const = 0;
+ };
+
+ typedef ::boost::shared_ptr< IColorBuffer > IColorBufferSharedPtr;
+}
+
+#endif /* INCLUDED_CANVAS_ICOLORBUFFER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/rendering/irendermodule.hxx b/include/canvas/rendering/irendermodule.hxx
new file mode 100644
index 000000000000..413320eb85e9
--- /dev/null
+++ b/include/canvas/rendering/irendermodule.hxx
@@ -0,0 +1,143 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_IRENDERMODULE_HXX
+#define INCLUDED_CANVAS_IRENDERMODULE_HXX
+
+#include <sal/types.h>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/utility.hpp>
+
+
+namespace basegfx
+{
+ class B2DRange;
+ class B2IRange;
+ class B2IVector;
+ class B2IPoint;
+}
+
+namespace canvas
+{
+ struct ISurface;
+
+ struct Vertex
+ {
+ float r,g,b,a;
+ float u,v;
+ float x,y,z;
+ };
+
+ /** Output module interface for backend render implementations.
+
+ Implement this interface for each operating system- or
+ library-specific rendering backend, which needs coupling with
+ the canvas rendering framework (which can be shared between
+ all backend implementations).
+ */
+ struct IRenderModule
+ {
+ /** Type of primitive passed to the render module via
+ pushVertex()
+ */
+ enum PrimitiveType
+ {
+ PRIMITIVE_TYPE_UNKNOWN,
+ PRIMITIVE_TYPE_TRIANGLE,
+ PRIMITIVE_TYPE_QUAD
+ };
+
+ virtual ~IRenderModule() {}
+
+ /// Lock rendermodule against concurrent access
+ virtual void lock() const = 0;
+
+ /// Unlock rendermodule for concurrent access
+ virtual void unlock() const = 0;
+
+ /** Maximal size of VRAM pages available
+
+ This is typically the maximum texture size of the
+ hardware, or some arbitrary limit if the backend is
+ software.
+ */
+ virtual ::basegfx::B2IVector getPageSize() = 0;
+
+ /** Create a (possibly hardware-accelerated) surface
+
+ @return a pointer to a surface, which is an abstraction of
+ a piece of (possibly hardware-accelerated) texture memory.
+ */
+ virtual ::boost::shared_ptr<ISurface> createSurface( const ::basegfx::B2IVector& surfaceSize ) = 0;
+
+ /** Begin rendering the given primitive.
+
+ Each beginPrimitive() call must be matched with an
+ endPrimitive() call.
+ */
+ virtual void beginPrimitive( PrimitiveType eType ) = 0;
+
+ /** Finish rendering a primitive.
+
+ Each beginPrimitive() call must be matched with an
+ endPrimitive() call.
+ */
+ virtual void endPrimitive() = 0;
+
+ /** Add given vertex to current primitive
+
+ After issuing a beginPrimitive(), each pushVertex() adds a
+ vertex to the active primitive.
+ */
+ virtual void pushVertex( const Vertex& vertex ) = 0;
+
+ /** Query error status
+
+ @returns true, if an error occurred during primitive
+ construction.
+ */
+ virtual bool isError() = 0;
+ };
+
+ typedef ::boost::shared_ptr< IRenderModule > IRenderModuleSharedPtr;
+
+ /// Little RAII wrapper for guarding access to IRenderModule interface
+ class RenderModuleGuard : private ::boost::noncopyable
+ {
+ public:
+ explicit RenderModuleGuard( const IRenderModuleSharedPtr& rRenderModule ) :
+ mpRenderModule( rRenderModule )
+ {
+ mpRenderModule->lock();
+ }
+
+ ~RenderModuleGuard()
+ {
+ mpRenderModule->unlock();
+ }
+
+ private:
+ const IRenderModuleSharedPtr mpRenderModule;
+ };
+}
+
+#endif /* INCLUDED_CANVAS_IRENDERMODULE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/rendering/isurface.hxx b/include/canvas/rendering/isurface.hxx
new file mode 100644
index 000000000000..a79faf96a8c8
--- /dev/null
+++ b/include/canvas/rendering/isurface.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_ISURFACE_HXX
+#define INCLUDED_CANVAS_ISURFACE_HXX
+
+#include <sal/types.h>
+
+#include <boost/shared_ptr.hpp>
+
+
+namespace basegfx
+{
+ class B2IRange;
+ class B2IPoint;
+ class B2IVector;
+}
+
+namespace canvas
+{
+ struct IColorBuffer;
+
+ struct ISurface
+ {
+ virtual ~ISurface() {}
+
+ /** Select texture behind this interface to be the current one
+ for primitive output.
+ */
+ virtual bool selectTexture() = 0;
+
+ /** Tells whether the surface is valid or not
+ */
+ virtual bool isValid() = 0;
+
+ /** Update surface content from given IColorBuffer
+
+ This method updates the given subarea of the surface from
+ the given color buffer bits.
+
+ @param rDestPos
+ Position in the surface, where the subset update should
+ have its left, top edge
+
+ @param rSourceRect
+ Size and position of the rectangular subset update in the
+ source color buffer
+
+ @param rSource
+ Source bits to use for the update
+
+ @return true, if the update was successful
+ */
+ virtual bool update( const ::basegfx::B2IPoint& rDestPos,
+ const ::basegfx::B2IRange& rSourceRect,
+ IColorBuffer& rSource ) = 0;
+
+ virtual ::basegfx::B2IVector getSize() = 0;
+ };
+
+ typedef ::boost::shared_ptr< ISurface > ISurfaceSharedPtr;
+}
+
+#endif /* INCLUDED_CANVAS_ISURFACE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/rendering/isurfaceproxy.hxx b/include/canvas/rendering/isurfaceproxy.hxx
new file mode 100644
index 000000000000..f8db605a38d3
--- /dev/null
+++ b/include/canvas/rendering/isurfaceproxy.hxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_ISURFACEPROXY_HXX
+#define INCLUDED_CANVAS_ISURFACEPROXY_HXX
+
+#include <canvas/rendering/irendermodule.hxx>
+
+#include <boost/shared_ptr.hpp>
+
+namespace basegfx
+{
+ class B2DRange;
+ class B2DPoint;
+ class B2DPolyPolygon;
+ class B2DHomMatrix;
+}
+
+namespace canvas
+{
+ struct ISurfaceProxy
+ {
+ virtual ~ISurfaceProxy() {}
+
+ /** Notify the proxy that the color buffer has changed
+ */
+ virtual void setColorBufferDirty() = 0;
+
+ /** 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)
+ */
+ virtual bool draw( double fAlpha,
+ const ::basegfx::B2DPoint& rPos,
+ const ::basegfx::B2DHomMatrix& rTransform ) = 0;
+
+ /** 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)
+ */
+ virtual bool draw( double fAlpha,
+ const ::basegfx::B2DPoint& rPos,
+ const ::basegfx::B2DRange& rArea,
+ const ::basegfx::B2DHomMatrix& rTransform ) = 0;
+
+ /** 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)
+ */
+ virtual bool draw( double fAlpha,
+ const ::basegfx::B2DPoint& rPos,
+ const ::basegfx::B2DPolyPolygon& rClipPoly,
+ const ::basegfx::B2DHomMatrix& rTransform ) = 0;
+ };
+
+ typedef ::boost::shared_ptr< ISurfaceProxy > ISurfaceProxySharedPtr;
+}
+
+#endif /* INCLUDED_CANVAS_ISURFACEPROXY_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/rendering/isurfaceproxymanager.hxx b/include/canvas/rendering/isurfaceproxymanager.hxx
new file mode 100644
index 000000000000..98c7795a293e
--- /dev/null
+++ b/include/canvas/rendering/isurfaceproxymanager.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_ISURFACEPROXYMANAGER_HXX
+#define INCLUDED_CANVAS_ISURFACEPROXYMANAGER_HXX
+
+#include <canvas/rendering/irendermodule.hxx>
+#include <canvas/rendering/icolorbuffer.hxx>
+
+#include <boost/shared_ptr.hpp>
+
+#include <canvas/canvastoolsdllapi.h>
+
+namespace canvas
+{
+ struct ISurfaceProxy;
+
+ /** Manager interface, which handles surface proxy objects.
+
+ Typically, each canvas instantiation has one
+ SurfaceProxyManager object, to handle their surfaces. Surfaces
+ itself are opaque objects, which encapsulate a framebuffer to
+ render upon, plus an optional (possibly accelerated) texture.
+ */
+ struct ISurfaceProxyManager
+ {
+ virtual ~ISurfaceProxyManager() {}
+
+ /** Create a surface proxy for a color buffer.
+
+ The whole idea is build around the concept that you create
+ some arbitrary buffer which contains the image data and
+ tell the texture manager about it. From there on you can
+ draw into this image using any kind of graphics api you
+ want. In the technical sense we allocate some space in
+ local videomemory or AGP memory which will be filled on
+ demand, which means if there exists any rendering
+ operation that needs to read from this memory location.
+ This method creates a logical hardware surface object
+ which uses the given color buffer as the image source.
+ Internally this texture may even be distributed to several
+ real hardware surfaces.
+ */
+ virtual ::boost::shared_ptr< ISurfaceProxy > createSurfaceProxy(
+ const IColorBufferSharedPtr& pBuffer ) const = 0;
+ };
+
+ typedef ::boost::shared_ptr< ISurfaceProxyManager > ISurfaceProxyManagerSharedPtr;
+
+
+ /** Create a surface proxy for the given render module.
+ */
+ CANVASTOOLS_DLLPUBLIC ISurfaceProxyManagerSharedPtr createSurfaceProxyManager( const IRenderModuleSharedPtr& rRenderModule );
+}
+
+#endif /* INCLUDED_CANVAS_ISURFACEPROXYMANAGER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */