[Libreoffice-commits] .: canvas/prj canvas/source

René Engelhard rene at kemper.freedesktop.org
Sat Oct 30 08:20:41 PDT 2010


 canvas/prj/build.lst                  |    2 
 canvas/source/tools/bitmap.cxx        |  841 -----------
 canvas/source/tools/canvastools.flt   |    1 
 canvas/source/tools/image.cxx         | 2397 ----------------------------------
 canvas/source/tools/image.hxx         |  301 ----
 canvas/source/tools/image_sysprereq.h |  104 -
 canvas/source/tools/makefile.mk       |   10 
 7 files changed, 1 insertion(+), 3655 deletions(-)

New commits:
commit 6559d60992c5d67ee3632f5ce8c6b92f69ea06e8
Author: Rene Engelhard <rene at debian.org>
Date:   Wed Oct 27 20:29:29 2010 +0200

    bin agg

diff --git a/canvas/prj/build.lst b/canvas/prj/build.lst
index cacbdb5..d75602d 100644
--- a/canvas/prj/build.lst
+++ b/canvas/prj/build.lst
@@ -1,4 +1,4 @@
-cv	canvas	:	javaunohelper comphelper cppuhelper offuh unoil tools svtools vcl AGG:agg basegfx CAIRO:cairo NULL
+cv	canvas	:	javaunohelper comphelper cppuhelper offuh unoil tools svtools vcl basegfx CAIRO:cairo NULL
 cv	canvas											 usr1	-	all	cv_mkout NULL
 cv	canvas\inc										 nmake	-	all	cv_inc NULL
 cv	canvas\source\tools								 nmake	-	all cv_tools cv_inc NULL
diff --git a/canvas/source/tools/bitmap.cxx b/canvas/source/tools/bitmap.cxx
deleted file mode 100644
index 3a4ed00..0000000
--- a/canvas/source/tools/bitmap.cxx
+++ /dev/null
@@ -1,841 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_canvas.hxx"
-
-#include <canvas/debug.hxx>
-#include <tools/diagnose_ex.h>
-#include <canvas/rendering/bitmap.hxx>
-#include <canvas/rendering/isurfaceproxy.hxx>
-#include <basegfx/vector/b2isize.hxx>
-#include "image.hxx"
-#include <algorithm>
-#include <iterator>
-
-
-using namespace ::com::sun::star;
-
-namespace canvas
-{
-    class ImplBitmap
-    {
-    public:
-        ImplBitmap( const ::basegfx::B2IVector&          rSize,
-                    const ISurfaceProxyManagerSharedPtr& rMgr,
-                    bool                                 bWithAlpha ) :
-            mpImage(),
-            mpSurfaceProxy(),
-            mbIsSurfaceDirty( true )
-        {
-            ENSURE_OR_THROW( rMgr,
-                             "Bitmap::Bitmap(): Invalid surface proxy manager" );
-
-            Image::Description desc;
-
-            desc.eFormat = bWithAlpha ? Image::FMT_A8R8G8B8 : Image::FMT_R8G8B8;
-            desc.nWidth  = rSize.getX();
-            desc.nHeight = rSize.getY();
-            desc.nStride = 0;
-            desc.pBuffer = NULL;
-
-            mpImage.reset( new Image(desc) );
-
-            // clear the surface [fill with opaque black]
-            mpImage->clear(0,255,255,255);
-
-            // create a (possibly hardware accelerated) mirror surface.
-            mpSurfaceProxy = rMgr->createSurfaceProxy( mpImage );
-        }
-
-        bool hasAlpha() const
-        {
-            if( !mpImage )
-                return false;
-
-            return (mpImage->getDescription().eFormat == Image::FMT_A8R8G8B8);
-        }
-
-        ::basegfx::B2IVector getSize() const
-        {
-            return ::basegfx::B2IVector( mpImage->getWidth(),
-                                         mpImage->getHeight() );
-        }
-
-        ::com::sun::star::uno::Sequence< sal_Int8 > getData( ::com::sun::star::rendering::IntegerBitmapLayout&     /*bitmapLayout*/,
-                                                             const ::com::sun::star::geometry::IntegerRectangle2D& rect )
-        {
-            const IColorBuffer::Format format = mpImage->getFormat();
-            const sal_uInt32 dwNumBytesPerPixel = getNumBytes(format);
-            const sal_uInt32 dwPitch = mpImage->getWidth()*dwNumBytesPerPixel;
-
-            if(!(dwNumBytesPerPixel))
-                return uno::Sequence< sal_Int8 >();
-
-            const sal_uInt32 dwWidth = rect.X2-rect.X1;
-            const sal_uInt32 dwHeight = rect.Y2-rect.Y1;
-
-            uno::Sequence< sal_Int8 > aRes(dwWidth*dwHeight*4);
-            sal_uInt8 *pDst = reinterpret_cast<sal_uInt8 *>(aRes.getArray());
-
-            const sal_uInt8 *pSrc = mpImage->lock()+(rect.Y1*dwPitch)+(rect.X1*dwNumBytesPerPixel);
-            const sal_uInt32 dwSpanSizeInBytes = dwNumBytesPerPixel*dwWidth;
-            for(sal_uInt32 y=0; y<dwHeight; ++y)
-            {
-                rtl_copyMemory(pDst,pSrc,dwSpanSizeInBytes);
-                pDst += dwSpanSizeInBytes;
-                pSrc += dwPitch;
-            }
-            mpImage->unlock();
-
-            return aRes;
-        }
-
-        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 )
-        {
-            const IColorBuffer::Format format = mpImage->getFormat();
-            const sal_uInt32 dwNumBytesPerPixel = getNumBytes(format);
-            const sal_uInt32 dwPitch = mpImage->getWidth()*dwNumBytesPerPixel;
-
-            if(!(dwNumBytesPerPixel))
-                return;
-
-            const sal_uInt32 dwWidth = rect.X2-rect.X1;
-            const sal_uInt32 dwHeight = rect.Y2-rect.Y1;
-            const sal_uInt8 *pSrc = reinterpret_cast<const sal_uInt8 *>(data.getConstArray());
-
-            sal_uInt8 *pDst = mpImage->lock()+(rect.Y1*dwPitch)+(rect.X1*dwNumBytesPerPixel);
-            const sal_uInt32 dwSpanSizeInBytes = dwNumBytesPerPixel*dwWidth;
-            for(sal_uInt32 y=0; y<dwHeight; ++y)
-            {
-                rtl_copyMemory(pDst,pSrc,dwSpanSizeInBytes);
-                pSrc += dwSpanSizeInBytes;
-                pDst += dwPitch;
-            }
-            mpImage->unlock();
-        }
-
-        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 )
-        {
-            struct ARGBColor
-            {
-                sal_uInt8 a;
-                sal_uInt8 r;
-                sal_uInt8 g;
-                sal_uInt8 b;
-            };
-
-            union ARGB
-            {
-                ARGBColor  Color;
-                sal_uInt32 color;
-
-                inline ARGB( sal_uInt32 _color ) : color(_color) {}
-            };
-
-            ARGB argb(0xFFFFFFFF);
-
-            if(color.getLength() > 2)
-            {
-                argb.Color.r = static_cast<sal_uInt8>(color[0]);
-                argb.Color.g = static_cast<sal_uInt8>(color[1]);
-                argb.Color.b = static_cast<sal_uInt8>(color[2]);
-                if(color.getLength() > 3)
-                    argb.Color.a = static_cast<sal_uInt8>(255.0f*color[3]);
-            }
-
-            const IColorBuffer::Format format = mpImage->getFormat();
-            const sal_uInt32 dwNumBytesPerPixel = getNumBytes(format);
-            const sal_uInt32 dwPitch = mpImage->getWidth()*dwNumBytesPerPixel;
-
-            if(!(dwNumBytesPerPixel))
-                return;
-
-            sal_uInt8 *pDst = mpImage->lock()+(pos.Y*dwPitch)+(pos.X*dwNumBytesPerPixel);
-
-            switch(format)
-            {
-                case IColorBuffer::FMT_R8G8B8:
-                    pDst[0] = argb.Color.r;
-                    pDst[1] = argb.Color.g;
-                    pDst[2] = argb.Color.b;
-                    break;
-                case IColorBuffer::FMT_A8R8G8B8:
-                case IColorBuffer::FMT_X8R8G8B8:
-                    pDst[0] = argb.Color.a;
-                    pDst[1] = argb.Color.r;
-                    pDst[2] = argb.Color.g;
-                    pDst[3] = argb.Color.b;
-                    break;
-                default:
-                    break;
-            }
-
-            mpImage->unlock();
-        }
-
-        uno::Sequence< sal_Int8 > getPixel( ::com::sun::star::rendering::IntegerBitmapLayout& /*bitmapLayout*/,
-                                            const ::com::sun::star::geometry::IntegerPoint2D& pos )
-        {
-            const IColorBuffer::Format format = mpImage->getFormat();
-            const sal_uInt32 dwNumBytesPerPixel = getNumBytes(format);
-            const sal_uInt32 dwPitch = mpImage->getWidth()*dwNumBytesPerPixel;
-
-            if(!(dwNumBytesPerPixel))
-                return uno::Sequence< sal_Int8 >();
-
-            uno::Sequence< sal_Int8 > aRet(dwNumBytesPerPixel);
-            const sal_uInt8 *pSrc = mpImage->lock()+(pos.Y*dwPitch)+(pos.X*dwNumBytesPerPixel);
-
-            switch(format)
-            {
-                case IColorBuffer::FMT_R8G8B8:
-                    aRet[0] = pSrc[0];
-                    aRet[1] = pSrc[1];
-                    aRet[2] = pSrc[2];
-                    break;
-                case IColorBuffer::FMT_A8R8G8B8:
-                case IColorBuffer::FMT_X8R8G8B8:
-                    aRet[0] = pSrc[1];
-                    aRet[1] = pSrc[2];
-                    aRet[2] = pSrc[3];
-                    aRet[3] = pSrc[0];
-                    break;
-                default:
-                    break;
-            }
-
-            mpImage->unlock();
-
-            return aRet;
-        }
-
-        // the IColorBuffer interface
-        // ==========================
-
-        bool draw( double                         fAlpha,
-                   const ::basegfx::B2DPoint&     rPos,
-                   const ::basegfx::B2DHomMatrix& rTransform )
-        {
-            if( mbIsSurfaceDirty )
-            {
-                mpSurfaceProxy->setColorBufferDirty();
-                mbIsSurfaceDirty = false;
-            }
-
-            return mpSurfaceProxy->draw( fAlpha, rPos, rTransform );
-        }
-
-        bool draw( double                         fAlpha,
-                   const ::basegfx::B2DPoint&     rPos,
-                   const ::basegfx::B2DRange&     rArea,
-                   const ::basegfx::B2DHomMatrix& rTransform )
-        {
-            if( mbIsSurfaceDirty )
-            {
-                mpSurfaceProxy->setColorBufferDirty();
-                mbIsSurfaceDirty = false;
-            }
-
-            return mpSurfaceProxy->draw( fAlpha, rPos, rArea, rTransform );
-        }
-
-
-        bool draw( double                           fAlpha,
-                   const ::basegfx::B2DPoint&       rPos,
-                   const ::basegfx::B2DPolyPolygon& rClipPoly,
-                   const ::basegfx::B2DHomMatrix&   rTransform )
-        {
-            if( mbIsSurfaceDirty )
-            {
-                mpSurfaceProxy->setColorBufferDirty();
-                mbIsSurfaceDirty = false;
-            }
-
-            return mpSurfaceProxy->draw( fAlpha, rPos, rClipPoly, rTransform );
-        }
-
-        void clear( const uno::Sequence< double >& color )
-        {
-            if(color.getLength() > 2)
-            {
-                mbIsSurfaceDirty = true;
-
-                if(color.getLength() > 3)
-                {
-                    mpImage->clear( static_cast<sal_uInt8>(255.0f*color[0]),
-                                    static_cast<sal_uInt8>(255.0f*color[1]),
-                                    static_cast<sal_uInt8>(255.0f*color[2]),
-                                    static_cast<sal_uInt8>(255.0f*color[3]) );
-                }
-                else
-                {
-                    mpImage->clear( static_cast<sal_uInt8>(255.0f*color[0]),
-                                    static_cast<sal_uInt8>(255.0f*color[1]),
-                                    static_cast<sal_uInt8>(255.0f*color[2]),
-                                    255 );
-                }
-            }
-        }
-
-        void fillB2DPolyPolygon( const ::basegfx::B2DPolyPolygon&   rPolyPolygon,
-                                 const rendering::ViewState& 		viewState,
-                                 const rendering::RenderState&      renderState )
-        {
-            mbIsSurfaceDirty = true;
-
-            mpImage->fillB2DPolyPolygon( rPolyPolygon,
-                                         viewState,
-                                         renderState );
-        }
-
-
-        // the XCanvas-render interface
-        // ============================
-
-        void drawPoint( const geometry::RealPoint2D& 	aPoint,
-                        const rendering::ViewState& 	viewState,
-                        const rendering::RenderState& 	renderState )
-        {
-            mbIsSurfaceDirty = true;
-
-            mpImage->drawPoint( aPoint, viewState, renderState );
-        }
-
-        void drawLine( const geometry::RealPoint2D& 	aStartPoint,
-                       const geometry::RealPoint2D& 	aEndPoint,
-                       const rendering::ViewState&      viewState,
-                       const rendering::RenderState& 	renderState	)
-        {
-            mbIsSurfaceDirty = true;
-
-            mpImage->drawLine( aStartPoint, aEndPoint, viewState, renderState );
-        }
-
-        void drawBezier( const geometry::RealBezierSegment2D&	aBezierSegment,
-                         const geometry::RealPoint2D&           aEndPoint,
-                         const rendering::ViewState& 			viewState,
-                         const rendering::RenderState&          renderState )
-        {
-            mbIsSurfaceDirty = true;
-
-            mpImage->drawBezier( aBezierSegment, aEndPoint, viewState, renderState );
-        }
-
-        ICachedPrimitiveSharedPtr drawPolyPolygon(
-            const uno::Reference< rendering::XPolyPolygon2D >& 	xPolyPolygon,
-            const rendering::ViewState&                         viewState,
-            const rendering::RenderState&                       renderState )
-        {
-            mbIsSurfaceDirty = true;
-
-            return setupCachedPrimitive(
-                mpImage->drawPolyPolygon( xPolyPolygon, viewState, renderState ) );
-        }
-
-        ICachedPrimitiveSharedPtr strokePolyPolygon(
-            const uno::Reference< rendering::XPolyPolygon2D >& 	xPolyPolygon,
-            const rendering::ViewState&                         viewState,
-            const rendering::RenderState&                       renderState,
-            const rendering::StrokeAttributes&                  strokeAttributes )
-        {
-            mbIsSurfaceDirty = true;
-
-            return setupCachedPrimitive(
-                mpImage->strokePolyPolygon( xPolyPolygon,
-                                            viewState,
-                                            renderState,
-                                            strokeAttributes ) );
-        }
-
-        ICachedPrimitiveSharedPtr strokeTexturedPolyPolygon(
-            const uno::Reference< rendering::XPolyPolygon2D >& 	 xPolyPolygon,
-            const rendering::ViewState&                          viewState,
-            const rendering::RenderState&                        renderState,
-            const uno::Sequence< rendering::Texture >&           textures,
-            const ::std::vector< ::boost::shared_ptr<Bitmap> >&  textureAnnotations,
-            const rendering::StrokeAttributes&                   strokeAttributes )
-        {
-            mbIsSurfaceDirty = true;
-
-            ::std::vector< ImageSharedPtr > aTextureAnnotations;
-            convertTextureAnnotations( aTextureAnnotations,
-                                       textureAnnotations );
-
-            return setupCachedPrimitive(
-                mpImage->strokeTexturedPolyPolygon( xPolyPolygon,
-                                                    viewState,
-                                                    renderState,
-                                                    textures,
-                                                    aTextureAnnotations,
-                                                    strokeAttributes ) );
-        }
-
-        ICachedPrimitiveSharedPtr strokeTextureMappedPolyPolygon(
-            const uno::Reference< rendering::XPolyPolygon2D >& 	 xPolyPolygon,
-            const rendering::ViewState&                          viewState,
-            const rendering::RenderState&                        renderState,
-            const uno::Sequence< rendering::Texture >&           textures,
-            const ::std::vector< ::boost::shared_ptr<Bitmap> >&  textureAnnotations,
-            const uno::Reference< geometry::XMapping2D >&        xMapping,
-            const rendering::StrokeAttributes&                   strokeAttributes )
-        {
-            mbIsSurfaceDirty = true;
-
-            ::std::vector< ImageSharedPtr > aTextureAnnotations;
-            convertTextureAnnotations( aTextureAnnotations,
-                                       textureAnnotations );
-
-            return setupCachedPrimitive(
-                mpImage->strokeTextureMappedPolyPolygon( xPolyPolygon,
-                                                         viewState,
-                                                         renderState,
-                                                         textures,
-                                                         aTextureAnnotations,
-                                                         xMapping,
-                                                         strokeAttributes ) );
-        }
-
-
-        ICachedPrimitiveSharedPtr fillPolyPolygon(
-            const uno::Reference< rendering::XPolyPolygon2D >& 	xPolyPolygon,
-            const rendering::ViewState&                         viewState,
-            const rendering::RenderState&                       renderState )
-        {
-            mbIsSurfaceDirty = true;
-
-            return setupCachedPrimitive(
-                mpImage->fillPolyPolygon( xPolyPolygon,
-                                          viewState,
-                                          renderState ) );
-        }
-
-        ICachedPrimitiveSharedPtr fillTexturedPolyPolygon(
-            const uno::Reference< rendering::XPolyPolygon2D >&	 xPolyPolygon,
-            const rendering::ViewState&                          viewState,
-            const rendering::RenderState&                        renderState,
-            const uno::Sequence< rendering::Texture >&           textures,
-            const ::std::vector< ::boost::shared_ptr<Bitmap> >&  textureAnnotations )
-        {
-            mbIsSurfaceDirty = true;
-
-            ::std::vector< ImageSharedPtr > aTextureAnnotations;
-            convertTextureAnnotations( aTextureAnnotations,
-                                       textureAnnotations );
-
-            return setupCachedPrimitive(
-                mpImage->fillTexturedPolyPolygon( xPolyPolygon,
-                                                  viewState,
-                                                  renderState,
-                                                  textures,
-                                                  aTextureAnnotations ) );
-        }
-
-
-        ICachedPrimitiveSharedPtr fillTextureMappedPolyPolygon(
-            const uno::Reference< rendering::XPolyPolygon2D >& 	 xPolyPolygon,
-            const rendering::ViewState&                          viewState,
-            const rendering::RenderState&                        renderState,
-            const uno::Sequence< rendering::Texture >&           textures,
-            const ::std::vector< ::boost::shared_ptr<Bitmap> >&  textureAnnotations,
-            const uno::Reference< geometry::XMapping2D >&        xMapping )
-        {
-            mbIsSurfaceDirty = true;
-
-            ::std::vector< ImageSharedPtr > aTextureAnnotations;
-            convertTextureAnnotations( aTextureAnnotations,
-                                       textureAnnotations );
-
-            return setupCachedPrimitive(
-                mpImage->fillTextureMappedPolyPolygon( xPolyPolygon,
-                                                       viewState,
-                                                       renderState,
-                                                       textures,
-                                                       aTextureAnnotations,
-                                                       xMapping ) );
-        }
-
-        ICachedPrimitiveSharedPtr drawBitmap(
-            const uno::Reference< rendering::XBitmap >&   xBitmap,
-            const rendering::ViewState&                   viewState,
-            const rendering::RenderState&                 renderState )
-        {
-            mbIsSurfaceDirty = true;
-
-            return setupCachedPrimitive(
-                mpImage->drawBitmap( xBitmap,
-                                     viewState,
-                                     renderState ) );
-        }
-
-        ICachedPrimitiveSharedPtr drawBitmap(
-            const ::boost::shared_ptr<Bitmap>&  rImage,
-            const rendering::ViewState&         viewState,
-            const rendering::RenderState&       renderState )
-        {
-            mbIsSurfaceDirty = true;
-
-            return setupCachedPrimitive(
-                mpImage->drawBitmap( rImage->mpImpl->mpImage,
-                                     viewState,
-                                     renderState ) );
-        }
-
-        ICachedPrimitiveSharedPtr drawBitmapModulated(
-            const uno::Reference< rendering::XBitmap >&		xBitmap,
-            const rendering::ViewState&                     viewState,
-            const rendering::RenderState&                   renderState )
-        {
-            mbIsSurfaceDirty = true;
-
-            return setupCachedPrimitive(
-                mpImage->drawBitmapModulated( xBitmap,
-                                              viewState,
-                                              renderState ) );
-        }
-
-
-        ICachedPrimitiveSharedPtr drawBitmapModulated(
-            const ::boost::shared_ptr<Bitmap>&   rImage,
-            const rendering::ViewState&          viewState,
-            const rendering::RenderState&        renderState )
-        {
-            mbIsSurfaceDirty = true;
-
-            return setupCachedPrimitive(
-                mpImage->drawBitmapModulated( rImage->mpImpl->mpImage,
-                                              viewState,
-                                              renderState ) );
-        }
-
-    private:
-        ICachedPrimitiveSharedPtr setupCachedPrimitive(
-            const ImageCachedPrimitiveSharedPtr& rCachedPrimitive ) const
-        {
-            if( rCachedPrimitive )
-                rCachedPrimitive->setImage( mpImage );
-
-            return rCachedPrimitive;
-        }
-
-        void convertTextureAnnotations( ::std::vector< ImageSharedPtr >&         o_rTextureAnnotations,
-                                        const ::std::vector< BitmapSharedPtr >&  textureAnnotations )
-        {
-            ::std::vector< BitmapSharedPtr >::const_iterator       aCurr( textureAnnotations.begin() );
-            const ::std::vector< BitmapSharedPtr >::const_iterator aEnd( textureAnnotations.end() );
-            while( aCurr != aEnd )
-            {
-                if( aCurr->get() != NULL )
-                    o_rTextureAnnotations.push_back( (*aCurr)->mpImpl->mpImage );
-                else
-                    o_rTextureAnnotations.push_back( ImageSharedPtr() );
-
-                ++aCurr;
-            }
-        }
-
-        sal_uInt32 getNumBytes( IColorBuffer::Format format )
-        {
-            switch(format)
-            {
-                case IColorBuffer::FMT_R8G8B8:
-                    return 3;
-                case IColorBuffer::FMT_A8R8G8B8:
-                case IColorBuffer::FMT_X8R8G8B8:
-                    return 4;
-                default:
-                    return 0;
-            }
-        }
-
-        ImageSharedPtr          mpImage;
-        ISurfaceProxySharedPtr  mpSurfaceProxy;
-        bool                    mbIsSurfaceDirty;
-    };
-
-
-    /////////////////////////////////////////////////////////////////
-    // Actual Bitmap pimpl forwarding functions
-    /////////////////////////////////////////////////////////////////
-
-    Bitmap::Bitmap( const ::basegfx::B2IVector&          rSize,
-                    const ISurfaceProxyManagerSharedPtr& rMgr,
-                    bool                                 bWithAlpha ) :
-        mpImpl( new ImplBitmap( rSize,
-                                rMgr,
-                                bWithAlpha ) )
-    {
-    }
-
-    Bitmap::~Bitmap()
-    {
-        // outline destructor is _necessary_, because ImplBitmap is an
-        // incomplete type outside this file.
-    }
-
-    // forward all methods to ImplBitmap
-    // ==================================================
-
-    bool Bitmap::hasAlpha() const
-    {
-        return mpImpl->hasAlpha();
-    }
-
-    ::basegfx::B2IVector Bitmap::getSize() const
-    {
-        return mpImpl->getSize();
-    }
-
-    ::com::sun::star::uno::Sequence< sal_Int8 > Bitmap::getData(
-        ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
-        const ::com::sun::star::geometry::IntegerRectangle2D& rect )
-    {
-        return mpImpl->getData(bitmapLayout,rect);
-    }
-
-    void Bitmap::setData(
-        const ::com::sun::star::uno::Sequence< sal_Int8 >& data,
-        const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
-        const ::com::sun::star::geometry::IntegerRectangle2D& rect )
-    {
-        mpImpl->setData(data,bitmapLayout,rect);
-    }
-
-    void Bitmap::setPixel(
-        const ::com::sun::star::uno::Sequence< sal_Int8 >&		color,
-        const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
-        const ::com::sun::star::geometry::IntegerPoint2D&		pos )
-    {
-        mpImpl->setPixel(color,bitmapLayout,pos);
-    }
-
-    uno::Sequence< sal_Int8 > Bitmap::getPixel(
-        ::com::sun::star::rendering::IntegerBitmapLayout&		bitmapLayout,
-        const ::com::sun::star::geometry::IntegerPoint2D&		pos )
-    {
-        return mpImpl->getPixel(bitmapLayout,pos);
-    }
-
-    bool Bitmap::draw( double                         fAlpha,
-                       const ::basegfx::B2DPoint&     rPos,
-                       const ::basegfx::B2DHomMatrix& rTransform )
-    {
-        return mpImpl->draw( fAlpha, rPos, rTransform );
-    }
-
-    bool Bitmap::draw( double                         fAlpha,
-                       const ::basegfx::B2DPoint&     rPos,
-                       const ::basegfx::B2DRange&     rArea,
-                       const ::basegfx::B2DHomMatrix& rTransform )
-    {
-        return mpImpl->draw( fAlpha, rPos, rArea, rTransform );
-    }
-
-
-    bool Bitmap::draw( double                           fAlpha,
-                       const ::basegfx::B2DPoint&       rPos,
-                       const ::basegfx::B2DPolyPolygon& rClipPoly,
-                       const ::basegfx::B2DHomMatrix&   rTransform )
-    {
-        return mpImpl->draw( fAlpha, rPos, rClipPoly, rTransform );
-    }
-
-    void Bitmap::clear( const uno::Sequence< double >& color )
-    {
-        mpImpl->clear( color );
-    }
-
-    void Bitmap::fillB2DPolyPolygon(
-            const ::basegfx::B2DPolyPolygon&    rPolyPolygon,
-            const rendering::ViewState& 		viewState,
-            const rendering::RenderState&       renderState )
-    {
-        mpImpl->fillB2DPolyPolygon( rPolyPolygon, viewState, renderState );
-    }
-
-    void Bitmap::drawPoint( const geometry::RealPoint2D& 	aPoint,
-                            const rendering::ViewState& 	viewState,
-                            const rendering::RenderState& 	renderState )
-    {
-        return mpImpl->drawPoint( aPoint, viewState, renderState );
-    }
-
-    void Bitmap::drawLine( const geometry::RealPoint2D& 	aStartPoint,
-                           const geometry::RealPoint2D& 	aEndPoint,
-                           const rendering::ViewState&      viewState,
-                           const rendering::RenderState& 	renderState	)
-    {
-        return mpImpl->drawLine( aStartPoint, aEndPoint, viewState, renderState );
-    }
-
-    void Bitmap::drawBezier( const geometry::RealBezierSegment2D&	aBezierSegment,
-                             const geometry::RealPoint2D&           aEndPoint,
-                             const rendering::ViewState& 			viewState,
-                             const rendering::RenderState&          renderState )
-    {
-        return mpImpl->drawBezier( aBezierSegment, aEndPoint, viewState, renderState );
-    }
-
-    ICachedPrimitiveSharedPtr Bitmap::drawPolyPolygon(
-        const uno::Reference< rendering::XPolyPolygon2D >& 	xPolyPolygon,
-        const rendering::ViewState&                         viewState,
-        const rendering::RenderState&                       renderState )
-    {
-        return mpImpl->drawPolyPolygon( xPolyPolygon, viewState, renderState );
-    }
-
-    ICachedPrimitiveSharedPtr Bitmap::strokePolyPolygon(
-        const uno::Reference< rendering::XPolyPolygon2D >& 	xPolyPolygon,
-        const rendering::ViewState&                         viewState,
-        const rendering::RenderState&                       renderState,
-        const rendering::StrokeAttributes&                  strokeAttributes )
-    {
-        return mpImpl->strokePolyPolygon( xPolyPolygon, viewState, renderState, strokeAttributes );
-    }
-
-    ICachedPrimitiveSharedPtr Bitmap::strokeTexturedPolyPolygon(
-        const uno::Reference< rendering::XPolyPolygon2D >& 	 xPolyPolygon,
-        const rendering::ViewState&                          viewState,
-        const rendering::RenderState&                        renderState,
-        const uno::Sequence< rendering::Texture >&           textures,
-        const ::std::vector< ::boost::shared_ptr<Bitmap> >&  textureAnnotations,
-        const rendering::StrokeAttributes&                   strokeAttributes )
-    {
-        return mpImpl->strokeTexturedPolyPolygon( xPolyPolygon,
-                                                  viewState,
-                                                  renderState,
-                                                  textures,
-                                                  textureAnnotations,
-                                                  strokeAttributes );
-    }
-
-    ICachedPrimitiveSharedPtr Bitmap::strokeTextureMappedPolyPolygon(
-        const uno::Reference< rendering::XPolyPolygon2D >& 	 xPolyPolygon,
-        const rendering::ViewState&                          viewState,
-        const rendering::RenderState&                        renderState,
-        const uno::Sequence< rendering::Texture >&           textures,
-        const ::std::vector< ::boost::shared_ptr<Bitmap> >&  textureAnnotations,
-        const uno::Reference< geometry::XMapping2D >&        xMapping,
-        const rendering::StrokeAttributes&                   strokeAttributes )
-    {
-        return mpImpl->strokeTextureMappedPolyPolygon( xPolyPolygon,
-                                                       viewState,
-                                                       renderState,
-                                                       textures,
-                                                       textureAnnotations,
-                                                       xMapping,
-                                                       strokeAttributes );
-    }
-
-
-    ICachedPrimitiveSharedPtr Bitmap::fillPolyPolygon(
-        const uno::Reference< rendering::XPolyPolygon2D >& 	xPolyPolygon,
-        const rendering::ViewState&                         viewState,
-        const rendering::RenderState&                       renderState )
-    {
-        return mpImpl->fillPolyPolygon( xPolyPolygon,
-                                        viewState,
-                                        renderState );
-    }
-
-    ICachedPrimitiveSharedPtr Bitmap::fillTexturedPolyPolygon(
-        const uno::Reference< rendering::XPolyPolygon2D >&	 xPolyPolygon,
-        const rendering::ViewState&                          viewState,
-        const rendering::RenderState&                        renderState,
-        const uno::Sequence< rendering::Texture >&           textures,
-        const ::std::vector< ::boost::shared_ptr<Bitmap> >&  textureAnnotations )
-    {
-        return mpImpl->fillTexturedPolyPolygon( xPolyPolygon,
-                                                viewState,
-                                                renderState,
-                                                textures,
-                                                textureAnnotations );
-    }
-
-    ICachedPrimitiveSharedPtr Bitmap::fillTextureMappedPolyPolygon(
-        const uno::Reference< rendering::XPolyPolygon2D >& 	 xPolyPolygon,
-        const rendering::ViewState&                          viewState,
-        const rendering::RenderState&                        renderState,
-        const uno::Sequence< rendering::Texture >&           textures,
-        const ::std::vector< ::boost::shared_ptr<Bitmap> >&  textureAnnotations,
-        const uno::Reference< geometry::XMapping2D >&        xMapping )
-    {
-        return mpImpl->fillTextureMappedPolyPolygon( xPolyPolygon,
-                                                     viewState,
-                                                     renderState,
-                                                     textures,
-                                                     textureAnnotations,
-                                                     xMapping );
-    }
-
-    ICachedPrimitiveSharedPtr Bitmap::drawBitmap(
-        const uno::Reference< rendering::XBitmap >&   xBitmap,
-        const rendering::ViewState&                   viewState,
-        const rendering::RenderState&                 renderState )
-    {
-        return mpImpl->drawBitmap( xBitmap,
-                                   viewState,
-                                   renderState );
-    }
-
-    ICachedPrimitiveSharedPtr Bitmap::drawBitmap(
-        const ::boost::shared_ptr<Bitmap>&  rImage,
-        const rendering::ViewState&         viewState,
-        const rendering::RenderState&       renderState )
-    {
-        return mpImpl->drawBitmap( rImage,
-                                   viewState,
-                                   renderState );
-    }
-
-    ICachedPrimitiveSharedPtr Bitmap::drawBitmapModulated(
-        const uno::Reference< rendering::XBitmap >&		xBitmap,
-        const rendering::ViewState&                     viewState,
-        const rendering::RenderState&                   renderState )
-    {
-        return mpImpl->drawBitmapModulated( xBitmap,
-                                            viewState,
-                                            renderState );
-    }
-
-    ICachedPrimitiveSharedPtr Bitmap::drawBitmapModulated(
-        const ::boost::shared_ptr<Bitmap>&   rImage,
-        const rendering::ViewState&          viewState,
-        const rendering::RenderState&        renderState )
-    {
-        return mpImpl->drawBitmapModulated( rImage,
-                                            viewState,
-                                            renderState );
-    }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/canvas/source/tools/canvastools.flt b/canvas/source/tools/canvastools.flt
index a230939..67e7134 100644
--- a/canvas/source/tools/canvastools.flt
+++ b/canvas/source/tools/canvastools.flt
@@ -1,4 +1,3 @@
 __CT
 __real
 internal
-agg
\ No newline at end of file
diff --git a/canvas/source/tools/image.cxx b/canvas/source/tools/image.cxx
deleted file mode 100644
index 91d8b6b..0000000
--- a/canvas/source/tools/image.cxx
+++ /dev/null
@@ -1,2397 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_canvas.hxx"
-
-#include <canvas/debug.hxx>
-#include <tools/diagnose_ex.h>
-
-#include <canvas/canvastools.hxx>
-#include <canvas/parametricpolypolygon.hxx>
-
-#include <com/sun/star/rendering/RepaintResult.hpp>
-#include <com/sun/star/rendering/XIntegerReadOnlyBitmap.hpp>
-
-#include <vcl/canvastools.hxx>
-#include <vcl/bitmapex.hxx>
-#include <vcl/bmpacc.hxx>
-
-#include <basegfx/range/b2drange.hxx>
-#include <basegfx/point/b2dpoint.hxx>
-#include <basegfx/matrix/b2dhommatrix.hxx>
-#include <basegfx/polygon/b2dpolygon.hxx>
-#include <basegfx/polygon/b2dpolypolygon.hxx>
-#include <basegfx/polygon/b2dpolygoncutandtouch.hxx>
-#include <basegfx/polygon/b2dpolygontriangulator.hxx>
-#include <basegfx/polygon/b2dpolypolygontools.hxx>
-#include <basegfx/polygon/b2dpolygontools.hxx>
-#include <basegfx/polygon/b2dpolygonclipper.hxx>
-#include <basegfx/tools/canvastools.hxx>
-#include <basegfx/polygon/b2dpolypolygoncutter.hxx>
-#include <basegfx/polygon/b2dpolygonclipper.hxx>
-
-#include "image.hxx"
-
-#define CANVAS_IMAGE_CXX
-#include "image_sysprereq.h"
-
-//////////////////////////////////////////////////////////////////////////////////
-// platform-dependend includes [wrapped into their own namepsaces]
-//////////////////////////////////////////////////////////////////////////////////
-
-#if defined(WNT)
-# if defined _MSC_VER
-# pragma warning(push,1)
-# endif
-
-    namespace  win32
-    {
-        #undef DECLARE_HANDLE
-        #undef WB_LEFT
-        #undef WB_RIGHT
-        #undef APIENTRY
-        #define WIN32_LEAN_AND_MEAN
-        #define NOMINMAX
-        #include <windows.h>
-    }
-
-# if defined _MSC_VER
-# pragma warning(pop)
-# endif
-#elif defined(OS2)
-    namespace os2
-    {
-        #include <svpm.h>
-    }
-#else
-#if !defined(QUARTZ)
-    namespace unx
-    {
-        #include <X11/Xlib.h>
-    }
-#endif
-#endif
-
-#include <algorithm>
-
-using namespace ::com::sun::star;
-
-namespace canvas { namespace
-{
-    //////////////////////////////////////////////////////////////////////////////////
-    // TransAffineFromAffineMatrix
-    //////////////////////////////////////////////////////////////////////////////////
-
-    ::agg::trans_affine transAffineFromAffineMatrix( const geometry::AffineMatrix2D& m )
-    {
-        return agg::trans_affine(m.m00,
-                                 m.m10,
-                                 m.m01,
-                                 m.m11,
-                                 m.m02,
-                                 m.m12);
-    }
-
-    //////////////////////////////////////////////////////////////////////////////////
-    // TransAffineFromB2DHomMatrix
-    //////////////////////////////////////////////////////////////////////////////////
-
-    ::agg::trans_affine transAffineFromB2DHomMatrix( const ::basegfx::B2DHomMatrix& m )
-    {
-        return agg::trans_affine(m.get(0,0),
-                                 m.get(1,0),
-                                 m.get(0,1),
-                                 m.get(1,1),
-                                 m.get(0,2),
-                                 m.get(1,2));
-    }
-
-    //////////////////////////////////////////////////////////////////////////////////
-    // ARGB
-    //////////////////////////////////////////////////////////////////////////////////
-
-    struct ARGBColor
-    {
-        sal_uInt8 a;
-        sal_uInt8 r;
-        sal_uInt8 g;
-        sal_uInt8 b;
-    };
-
-    /// ARGB color
-    union ARGB
-    {
-        ARGBColor  Color;
-        sal_uInt32 color;
-
-        ARGB() :
-            color(0)
-        {
-        }
-
-        explicit ARGB( sal_uInt32 _color ) :
-            color(_color)
-        {
-        }
-
-        ARGB( sal_uInt8 _a,
-              sal_uInt8 _r,
-              sal_uInt8 _g,
-              sal_uInt8 _b )
-        {
-            Color.a = _a;
-            Color.r = _r;
-            Color.g = _g;
-            Color.b = _b;
-        }
-
-        ARGB( sal_uInt32                                       default_color,
-              const ::com::sun::star::uno::Sequence< double >& sequence ) :
-            color(default_color)
-        {
-            if(sequence.getLength() > 2)
-            {
-                Color.r = static_cast<sal_uInt8>(255.0f*sequence[0]);
-                Color.g = static_cast<sal_uInt8>(255.0f*sequence[1]);
-                Color.b = static_cast<sal_uInt8>(255.0f*sequence[2]);
-                if(sequence.getLength() > 3)
-                    Color.a = static_cast<sal_uInt8>(255.0f*sequence[3]);
-            }
-        }
-
-        ARGB( const ARGB& rhs ) :
-            color( rhs.color )
-        {
-        }
-
-        ARGB &operator=( const ARGB &rhs )
-        {
-            color=rhs.color;
-            return *this;
-        }
-    };
-
-    //////////////////////////////////////////////////////////////////////////////////
-    // setupState
-    //////////////////////////////////////////////////////////////////////////////////
-
-    /// Calc common output state from XCanvas parameters
-    void setupState( ::basegfx::B2DHomMatrix&                        o_rViewTransform,
-                     ::basegfx::B2DHomMatrix&                        o_rRenderTransform,
-                     ::std::auto_ptr< ::basegfx::B2DPolyPolygon >&   o_rViewClip,
-                     ::std::auto_ptr< ::basegfx::B2DPolyPolygon >&   o_rRenderClip,
-                     ARGB&                                           o_rRenderColor,
-                     const rendering::ViewState&                     viewState,
-                     const rendering::RenderState&                   renderState )
-    {
-        ::basegfx::unotools::homMatrixFromAffineMatrix(o_rRenderTransform,
-                                                       renderState.AffineTransform);
-        ::basegfx::unotools::homMatrixFromAffineMatrix(o_rViewTransform,
-                                                       viewState.AffineTransform);
-
-        o_rRenderColor = ARGB(0xFFFFFFFF,
-                              renderState.DeviceColor);
-
-        // TODO(F3): handle compositing modes
-
-        if( viewState.Clip.is() )
-        {
-            ::basegfx::B2DPolyPolygon aViewClip(
-                ::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D( viewState.Clip ));
-
-            if(aViewClip.areControlPointsUsed())
-                aViewClip = ::basegfx::tools::adaptiveSubdivideByAngle(aViewClip);
-
-            o_rViewClip.reset( new ::basegfx::B2DPolyPolygon( aViewClip ) );
-        }
-
-        if( renderState.Clip.is() )
-        {
-            ::basegfx::B2DPolyPolygon aRenderClip(
-                ::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D( viewState.Clip ) );
-
-            if(aRenderClip.areControlPointsUsed())
-                aRenderClip = ::basegfx::tools::adaptiveSubdivideByAngle(aRenderClip);
-
-            o_rRenderClip.reset( new ::basegfx::B2DPolyPolygon( aRenderClip ) );
-        }
-    }
-
-    //////////////////////////////////////////////////////////////////////////////////
-    // clipAndTransformPolygon
-    //////////////////////////////////////////////////////////////////////////////////
-
-    /** Clip and transform given polygon
-
-        @param io_rClippee
-        Polygon to clip
-
-        @param bIsFilledPolyPolygon
-        When true, the polygon is clipped as if it was to be rendered
-        with fill, when false, the polygon is clipped as if it was to
-        be rendered with stroking.
-     */
-    void clipAndTransformPolygon( ::basegfx::B2DPolyPolygon&         io_rClippee,
-                                  bool                               bIsFilledPolyPolygon,
-                                  const ::basegfx::B2DHomMatrix&     rViewTransform,
-                                  const ::basegfx::B2DHomMatrix&     rRenderTransform,
-                                  const ::basegfx::B2DPolyPolygon*   pViewClip,
-                                  const ::basegfx::B2DPolyPolygon*   pRenderClip )
-    {
-        ::basegfx::B2DPolyPolygon aPolyPolygon(io_rClippee);
-        io_rClippee.clear();
-
-        // clip contour against renderclip
-        if( pRenderClip )
-        {
-            // AW: Simplified
-            aPolyPolygon = basegfx::tools::clipPolyPolygonOnPolyPolygon(
-                aPolyPolygon, *pRenderClip, true, !bIsFilledPolyPolygon);
-        }
-
-        if( !aPolyPolygon.count() )
-            return;
-
-        // transform result into view space
-        aPolyPolygon.transform(rRenderTransform);
-
-        // clip contour against viewclip
-        if( pViewClip )
-        {
-            // AW: Simplified
-            aPolyPolygon = basegfx::tools::clipPolyPolygonOnPolyPolygon(
-                aPolyPolygon, *pViewClip, true, !bIsFilledPolyPolygon);
-        }
-
-        if(!(aPolyPolygon.count()))
-            return;
-
-        // transform result into device space
-        aPolyPolygon.transform(rViewTransform);
-
-        io_rClippee = aPolyPolygon;
-    }
-
-    //////////////////////////////////////////////////////////////////////////////////
-    // setupPolyPolygon
-    //////////////////////////////////////////////////////////////////////////////////
-
-    void setupPolyPolygon( ::basegfx::B2DPolyPolygon&         io_rClippee,
-                           bool                               bIsFilledPolyPolygon,
-                           ARGB&                              o_rRenderColor,
-                           const rendering::ViewState&        viewState,
-                           const rendering::RenderState&      renderState )
-    {
-        ::basegfx::B2DHomMatrix                      aViewTransform;
-        ::basegfx::B2DHomMatrix                      aRenderTransform;
-        ::std::auto_ptr< ::basegfx::B2DPolyPolygon > pViewClip;
-        ::std::auto_ptr< ::basegfx::B2DPolyPolygon > pRenderClip;
-
-        setupState( aViewTransform,
-                    aRenderTransform,
-                    pViewClip,
-                    pRenderClip,
-                    o_rRenderColor,
-                    viewState,
-                    renderState );
-
-        clipAndTransformPolygon( io_rClippee,
-                                 bIsFilledPolyPolygon,
-                                 aViewTransform,
-                                 aRenderTransform,
-                                 pViewClip.get(),
-                                 pRenderClip.get() );
-    }
-
-    //////////////////////////////////////////////////////////////////////////////////
-    // RawABGRBitmap
-    //////////////////////////////////////////////////////////////////////////////////
-
-    // Raw ABGR [AABBGGRR] 32bit continous
-    struct RawABGRBitmap
-    {
-        sal_Int32  mnWidth;
-        sal_Int32  mnHeight;
-        sal_uInt8* mpBitmapData;
-    };
-
-    //////////////////////////////////////////////////////////////////////////////////
-    // vclBitmapEx2Raw
-    //////////////////////////////////////////////////////////////////////////////////
-
-    void vclBitmapEx2Raw( const ::BitmapEx& rBmpEx, RawABGRBitmap& rBmpData )
-    {
-        Bitmap aBitmap( rBmpEx.GetBitmap() );
-
-        ScopedBitmapReadAccess pReadAccess( aBitmap.AcquireReadAccess(),
-                                            aBitmap );
-
-        const sal_Int32 nWidth( rBmpData.mnWidth );
-        const sal_Int32 nHeight( rBmpData.mnHeight );
-
-        ENSURE_OR_THROW( pReadAccess.get() != NULL,
-                          "vclBitmapEx2Raw(): "
-                          "Unable to acquire read acces to bitmap" );
-
-        if( rBmpEx.IsTransparent())
-        {
-            if( rBmpEx.IsAlpha() )
-            {
-                // 8bit alpha mask
-                Bitmap aAlpha( rBmpEx.GetAlpha().GetBitmap() );
-
-                ScopedBitmapReadAccess pAlphaReadAccess( aAlpha.AcquireReadAccess(),
-                                                         aAlpha );
-
-                // By convention, the access buffer always has
-                // one of the following formats:
-                //
-                //    BMP_FORMAT_1BIT_MSB_PAL
-                //	  BMP_FORMAT_4BIT_MSN_PAL
-                //	  BMP_FORMAT_8BIT_PAL
-                //	  BMP_FORMAT_16BIT_TC_LSB_MASK
-                //	  BMP_FORMAT_24BIT_TC_BGR
-                //	  BMP_FORMAT_32BIT_TC_MASK
-                //
-                // and is always BMP_FORMAT_BOTTOM_UP
-                //
-                // This is the way
-                // WinSalBitmap::AcquireBuffer() sets up the
-                // buffer
-
-                ENSURE_OR_THROW( pAlphaReadAccess.get() != NULL,
-                                  "vclBitmapEx2Raw(): "
-                                  "Unable to acquire read acces to alpha" );
-
-                ENSURE_OR_THROW( pAlphaReadAccess->GetScanlineFormat() == BMP_FORMAT_8BIT_PAL ||
-                                  pAlphaReadAccess->GetScanlineFormat() == BMP_FORMAT_8BIT_TC_MASK,
-                                  "vclBitmapEx2Raw(): "
-                                  "Unsupported alpha scanline format" );
-
-                BitmapColor		aCol;
-                sal_uInt8* 		pCurrOutput( rBmpData.mpBitmapData );
-                int 			x, y;
-
-                for( y=0; y<nHeight; ++y )
-                {
-                    switch( pReadAccess->GetScanlineFormat() )
-                    {
-                        case BMP_FORMAT_8BIT_PAL:
-                        {
-                            Scanline pScan  = pReadAccess->GetScanline( y );
-                            Scanline pAScan = pAlphaReadAccess->GetScanline( y );
-
-                            for( x=0; x<nWidth; ++x )
-                            {
-                                aCol = pReadAccess->GetPaletteColor( *pScan++ );
-
-                                *pCurrOutput++ = aCol.GetBlue();
-                                *pCurrOutput++ = aCol.GetGreen();
-                                *pCurrOutput++ = aCol.GetRed();
-
-                                // out notion of alpha is
-                                // different from the rest
-                                // of the world's
-                                *pCurrOutput++ = 255 - (BYTE)*pAScan++;
-                            }
-                        }
-                        break;
-
-                        case BMP_FORMAT_24BIT_TC_BGR:
-                        {
-                            Scanline pScan  = pReadAccess->GetScanline( y );
-                            Scanline pAScan = pAlphaReadAccess->GetScanline( y );
-
-                            for( x=0; x<nWidth; ++x )
-                            {
-                                // store as RGBA
-                                *pCurrOutput++ = *pScan++;
-                                *pCurrOutput++ = *pScan++;
-                                *pCurrOutput++ = *pScan++;
-
-                                // out notion of alpha is
-                                // different from the rest
-                                // of the world's
-                                *pCurrOutput++ = 255 - (BYTE)*pAScan++;
-                            }
-                        }
-                        break;
-
-                        // TODO(P2): Might be advantageous
-                        // to hand-formulate the following
-                        // formats, too.
-                        case BMP_FORMAT_1BIT_MSB_PAL:
-                            // FALLTHROUGH intended
-                        case BMP_FORMAT_4BIT_MSN_PAL:
-                            // FALLTHROUGH intended
-                        case BMP_FORMAT_16BIT_TC_LSB_MASK:
-                            // FALLTHROUGH intended
-                        case BMP_FORMAT_32BIT_TC_MASK:
-                        {
-                            Scanline pAScan = pAlphaReadAccess->GetScanline( y );
-
-                            // using fallback for those
-                            // seldom formats
-                            for( x=0; x<nWidth; ++x )
-                            {
-                                // yes. x and y are swapped on Get/SetPixel
-                                aCol = pReadAccess->GetColor(y,x);
-
-                                *pCurrOutput++ = aCol.GetBlue();
-                                *pCurrOutput++ = aCol.GetGreen();
-                                *pCurrOutput++ = aCol.GetRed();
-
-                                // out notion of alpha is
-                                // different from the rest
-                                // of the world's
-                                *pCurrOutput++ = 255 - (BYTE)*pAScan++;
-                            }
-                        }
-                        break;
-
-                        case BMP_FORMAT_1BIT_LSB_PAL:
-                            // FALLTHROUGH intended
-                        case BMP_FORMAT_4BIT_LSN_PAL:
-                            // FALLTHROUGH intended
-                        case BMP_FORMAT_8BIT_TC_MASK:
-                            // FALLTHROUGH intended
-                        case BMP_FORMAT_24BIT_TC_RGB:
-                            // FALLTHROUGH intended
-                        case BMP_FORMAT_24BIT_TC_MASK:
-                            // FALLTHROUGH intended
-                        case BMP_FORMAT_16BIT_TC_MSB_MASK:
-                            // FALLTHROUGH intended
-                        case BMP_FORMAT_32BIT_TC_ABGR:
-                            // FALLTHROUGH intended
-                        case BMP_FORMAT_32BIT_TC_ARGB:
-                            // FALLTHROUGH intended
-                        case BMP_FORMAT_32BIT_TC_BGRA:
-                            // FALLTHROUGH intended
-                        case BMP_FORMAT_32BIT_TC_RGBA:
-                            // FALLTHROUGH intended
-                        default:
-                            ENSURE_OR_THROW( false,
-                                              "vclBitmapEx2Raw(): "
-                                              "Unexpected scanline format - has "
-                                              "WinSalBitmap::AcquireBuffer() changed?" );
-                    }
-                }
-            }
-            else
-            {
-                // 1bit alpha mask
-                Bitmap aMask( rBmpEx.GetMask() );
-
-                ScopedBitmapReadAccess pMaskReadAccess( aMask.AcquireReadAccess(),
-                                                        aMask );
-
-                // By convention, the access buffer always has
-                // one of the following formats:
-                //
-                //    BMP_FORMAT_1BIT_MSB_PAL
-                //	  BMP_FORMAT_4BIT_MSN_PAL
-                //	  BMP_FORMAT_8BIT_PAL
-                //	  BMP_FORMAT_16BIT_TC_LSB_MASK
-                //	  BMP_FORMAT_24BIT_TC_BGR
-                //	  BMP_FORMAT_32BIT_TC_MASK
-                //
-                // and is always BMP_FORMAT_BOTTOM_UP
-                //
-                // This is the way
-                // WinSalBitmap::AcquireBuffer() sets up the
-                // buffer
-
-                ENSURE_OR_THROW( pMaskReadAccess.get() != NULL,
-                                  "vclBitmapEx2Raw(): "
-                                  "Unable to acquire read acces to mask" );
-
-                ENSURE_OR_THROW( pMaskReadAccess->GetScanlineFormat() == BMP_FORMAT_1BIT_MSB_PAL,
-                                  "vclBitmapEx2Raw(): "
-                                  "Unsupported mask scanline format" );
-
-                BitmapColor		aCol;
-                int 			nCurrBit;
-                const int		nMask( 1L );
-                const int 		nInitialBit(7);
-                sal_uInt32 *pBuffer = reinterpret_cast<sal_uInt32 *>(rBmpData.mpBitmapData);
-                int 			x, y;
-
-                // mapping table, to get from mask index color to
-                // alpha value (which depends on the mask's palette)
-                sal_uInt8 aColorMap[2];
-
-                const BitmapColor& rCol0( pMaskReadAccess->GetPaletteColor( 0 ) );
-                const BitmapColor& rCol1( pMaskReadAccess->GetPaletteColor( 1 ) );
-
-                // shortcut for true luminance calculation
-                // (assumes that palette is grey-level). Note the
-                // swapped the indices here, to account for the
-                // fact that VCL's notion of alpha is inverted to
-                // the rest of the world's.
-                aColorMap[0] = rCol1.GetRed();
-                aColorMap[1] = rCol0.GetRed();
-
-                for( y=0; y<nHeight; ++y )
-                {
-                    switch( pReadAccess->GetScanlineFormat() )
-                    {
-                        case BMP_FORMAT_8BIT_PAL:
-                        {
-                            Scanline pScan  = pReadAccess->GetScanline( y );
-                            Scanline pMScan = pMaskReadAccess->GetScanline( y );
-
-                            for( x=0, nCurrBit=nInitialBit; x<nWidth; ++x )
-                            {
-                                aCol = pReadAccess->GetPaletteColor( *pScan++ );
-
-                                // RGB -> ABGR
-                                unsigned int color = aCol.GetRed();
-                                color |= aCol.GetGreen()<<8;
-                                color |= aCol.GetBlue()<<16;
-                                color |= aColorMap[ (pMScan[ (x & ~7L) >> 3L ] >> nCurrBit ) & nMask ]<<24;
-                                *pBuffer++ = color;
-                                nCurrBit = ((nCurrBit - 1) % 8L) & 7L;
-                            }
-                        }
-                        break;
-
-                        case BMP_FORMAT_24BIT_TC_BGR:
-                        {
-                            Scanline pScan  = pReadAccess->GetScanline( y );
-                            Scanline pMScan = pMaskReadAccess->GetScanline( y );
-
-                            for( x=0, nCurrBit=nInitialBit; x<nWidth; ++x )
-                            {
-                                // BGR -> ABGR
-                                unsigned int color = (*pScan++)<<16;
-                                color |= (*pScan++)<<8;
-                                color |= (*pScan++);
-                                color |= (aColorMap[ (pMScan[ (x & ~7L) >> 3L ] >> nCurrBit ) & nMask ])<<24;
-                                *pBuffer++ = color;
-                                nCurrBit = ((nCurrBit - 1) % 8L) & 7L;
-                            }
-                        }
-                        break;
-
-                        // TODO(P2): Might be advantageous
-                        // to hand-formulate the following
-                        // formats, too.
-                        case BMP_FORMAT_1BIT_MSB_PAL:
-                            // FALLTHROUGH intended
-                        case BMP_FORMAT_4BIT_MSN_PAL:
-                            // FALLTHROUGH intended
-                        case BMP_FORMAT_16BIT_TC_LSB_MASK:
-                            // FALLTHROUGH intended
-                        case BMP_FORMAT_32BIT_TC_MASK:
-                        {
-                            Scanline pMScan = pMaskReadAccess->GetScanline( y );
-
-                            // using fallback for those
-                            // seldom formats
-                            for( x=0, nCurrBit=nInitialBit; x<nWidth; ++x )
-                            {
-                                // yes. x and y are swapped on Get/SetPixel
-                                aCol = pReadAccess->GetColor(y,x);
-
-                                // -> ABGR
-                                unsigned int color = aCol.GetBlue()<<16;
-                                color |= aCol.GetGreen()<<8;
-                                color |= aCol.GetRed();
-                                color |= (aColorMap[ (pMScan[ (x & ~7L) >> 3L ] >> nCurrBit ) & nMask ])<<24;
-                                *pBuffer++ = color;
-                                nCurrBit = ((nCurrBit - 1) % 8L) & 7L;
-                            }
-                        }
-                        break;
-
-                        case BMP_FORMAT_1BIT_LSB_PAL:
-                            // FALLTHROUGH intended
-                        case BMP_FORMAT_4BIT_LSN_PAL:
-                            // FALLTHROUGH intended
-                        case BMP_FORMAT_8BIT_TC_MASK:
-                            // FALLTHROUGH intended
-                        case BMP_FORMAT_24BIT_TC_RGB:
-                            // FALLTHROUGH intended
-                        case BMP_FORMAT_24BIT_TC_MASK:
-                            // FALLTHROUGH intended
-                        case BMP_FORMAT_16BIT_TC_MSB_MASK:
-                            // FALLTHROUGH intended
-                        case BMP_FORMAT_32BIT_TC_ABGR:
-                            // FALLTHROUGH intended
-                        case BMP_FORMAT_32BIT_TC_ARGB:
-                            // FALLTHROUGH intended
-                        case BMP_FORMAT_32BIT_TC_BGRA:
-                            // FALLTHROUGH intended
-                        case BMP_FORMAT_32BIT_TC_RGBA:
-                            // FALLTHROUGH intended
-                        default:
-                            ENSURE_OR_THROW( false,
-                                              "vclBitmapEx2Raw(): "
-                                              "Unexpected scanline format - has "
-                                              "WinSalBitmap::AcquireBuffer() changed?" );
-                    }
-                }
-            }
-        }
-        else
-        {
-            // *no* alpha mask
-            ULONG nFormat = pReadAccess->GetScanlineFormat();
-            BYTE *pBuffer = reinterpret_cast<BYTE *>(rBmpData.mpBitmapData);
-
-            switch(nFormat)
-            {
-                case BMP_FORMAT_24BIT_TC_BGR:
-
-                    {
-                        sal_Int32 height = pReadAccess->Height();
-                        for(sal_Int32 y=0; y<height; ++y)
-                        {
-                            BYTE *pScanline=pReadAccess->GetScanline(y);
-                            sal_Int32 width = pReadAccess->Width();
-                            for(sal_Int32 x=0; x<width; ++x)
-                            {
-                                // BGR -> RGB
-                                BYTE b(*pScanline++);
-                                BYTE g(*pScanline++);
-                                BYTE r(*pScanline++);
-                                *pBuffer++ = r;
-                                *pBuffer++ = g;
-                                *pBuffer++ = b;
-                            }
-                        }
-                    }
-                    break;
-
-                case BMP_FORMAT_24BIT_TC_RGB:
-
-                    {
-                        sal_Int32 height = pReadAccess->Height();
-                        for(sal_Int32 y=0; y<height; ++y)
-                        {
-                            BYTE *pScanline=pReadAccess->GetScanline(y);
-                            sal_Int32 width = pReadAccess->Width();
-                            for(sal_Int32 x=0; x<width; ++x)
-                            {
-                                // RGB -> RGB
-                                BYTE r(*pScanline++);
-                                BYTE g(*pScanline++);
-                                BYTE b(*pScanline++);
-                                *pBuffer++ = r;
-                                *pBuffer++ = g;
-                                *pBuffer++ = b;
-                            }
-                        }
-                    }
-                    break;
-
-                case BMP_FORMAT_1BIT_MSB_PAL:
-                case BMP_FORMAT_1BIT_LSB_PAL:
-                case BMP_FORMAT_4BIT_MSN_PAL:
-                case BMP_FORMAT_4BIT_LSN_PAL:
-                case BMP_FORMAT_8BIT_PAL:
-
-                    {
-                        sal_Int32 height = pReadAccess->Height();
-                        for(sal_Int32 y=0; y<height; ++y)
-                        {
-                            BYTE *pScanline=pReadAccess->GetScanline(y);
-                            sal_Int32 width = pReadAccess->Width();
-                            for(sal_Int32 x=0; x<width; ++x)
-                            {
-                                BitmapColor aCol(pReadAccess->GetPaletteColor(*pScanline++));
-
-                                *pBuffer++ = aCol.GetRed();
-                                *pBuffer++ = aCol.GetGreen();
-                                *pBuffer++ = aCol.GetBlue();
-                            }
-                        }
-                    }
-                    break;
-            }
-        }
-    }
-
-    //////////////////////////////////////////////////////////////////////////////////
-    // color_generator_linear
-    //////////////////////////////////////////////////////////////////////////////////
-
-    template<typename T> struct color_generator_linear
-    {
-        typedef typename T::value_type value_type;
-
-        color_generator_linear( const T &c1,
-                                const T &c2,
-                                unsigned int aSteps ) : maSteps(aSteps),
-                                                        maColor1(c1),
-                                                        maColor2(c2)
-        {
-        }
-
-        unsigned size() const { return maSteps; }
-        const T operator [] (unsigned v) const
-        {
-            const double w = double(v)/maSteps;
-            return T( static_cast<value_type>(maColor1.r+(maColor2.r-maColor1.r)*w),
-                      static_cast<value_type>(maColor1.g+(maColor2.g-maColor1.g)*w),
-                      static_cast<value_type>(maColor1.b+(maColor2.b-maColor1.b)*w),
-                      static_cast<value_type>(maColor1.a+(maColor2.a-maColor1.a)*w));
-        }
-
-        unsigned int maSteps;
-        const T      maColor1;
-        const T      maColor2;
-    };
-
-    //////////////////////////////////////////////////////////////////////////////////
-    // color_generator_axial
-    //////////////////////////////////////////////////////////////////////////////////
-
-    template<typename T> struct color_generator_axial
-    {
-        typedef typename T::value_type value_type;
-
-        color_generator_axial( const T &c1,
-                               const T &c2,
-                               unsigned int aSteps ) : maSteps(aSteps),
-                                                       maColor1(c1),
-                                                       maColor2(c2)
-        {
-        }
-
-        unsigned size() const { return maSteps; }
-        const T operator [] (unsigned v) const
-        {
-            const double aHalfSteps = maSteps/2.0;
-            const double w = (v >= aHalfSteps) ?
-                1.0-((double(v)-aHalfSteps)/aHalfSteps) :
-                (double(v)*2.0)/maSteps;
-            return T( static_cast<value_type>(maColor1.r+(maColor2.r-maColor1.r)*w),
-                      static_cast<value_type>(maColor1.g+(maColor2.g-maColor1.g)*w),
-                      static_cast<value_type>(maColor1.b+(maColor2.b-maColor1.b)*w),
-                      static_cast<value_type>(maColor1.a+(maColor2.a-maColor1.a)*w));
-        }
-
-        unsigned int maSteps;
-        const T      maColor1;
-        const T      maColor2;
-    };
-
-    //////////////////////////////////////////////////////////////////////////////////
-    // color_generator_adaptor
-    //////////////////////////////////////////////////////////////////////////////////
-
-    template<typename T> struct color_generator_adaptor
-    {
-        color_generator_adaptor( const T &c1,
-                                 const T &c2,
-                                 unsigned int aSteps ) : linear_generator(c1,c2,aSteps),
-                                                         axial_generator(c1,c2,aSteps),
-                                                         mbLinear(true) {}
-        void set_linear( bool bLinear ) { mbLinear=bLinear; }
-        unsigned size() const { return mbLinear ? linear_generator.size() : axial_generator.size(); }
-        const T operator [] (unsigned v) const
-        {
-            return mbLinear ?
-                linear_generator.operator [] (v) :
-                axial_generator.operator [] (v);
-        }
-
-        color_generator_linear<T> linear_generator;
-        color_generator_axial<T>  axial_generator;
-        bool                      mbLinear;
-    };
-
-    //////////////////////////////////////////////////////////////////////////////////
-    // gradient_polymorphic_wrapper_base
-    //////////////////////////////////////////////////////////////////////////////////
-
-    struct gradient_polymorphic_wrapper_base
-    {
-        virtual int calculate(int x, int y, int) const = 0;
-    };
-
-    //////////////////////////////////////////////////////////////////////////////////
-    // gradient_polymorphic_wrapper
-    //////////////////////////////////////////////////////////////////////////////////
-
-    template<class GradientF> struct gradient_polymorphic_wrapper :
-        public gradient_polymorphic_wrapper_base
-    {
-        virtual int calculate(int x, int y, int d) const
-        {
-            return m_gradient.calculate(x, y, d);
-        }
-        GradientF m_gradient;
-    };
-
-    //////////////////////////////////////////////////////////////////////////////////
-    // gradient_rect
-    //////////////////////////////////////////////////////////////////////////////////
-
-    class gradient_rect
-    {
-    public:
-
-        int width;
-        int height;
-
-        inline int calculate(int x, int y, int d) const
-        {
-            int ax = abs(x);
-            int ay = abs(y);
-            int clamp_x = height>width ? 0 : (width-height);
-            int clamp_y = height>width ? (height-width) : 0;
-            int value_x = (ax-clamp_x)*d/(width-clamp_x);
-            int value_y = (ay-clamp_y)*d/(height-clamp_y);
-            if(ax < (clamp_x))
-                value_x = 0;
-            if(ay < (clamp_y))
-                value_y = 0;
-            return value_x > value_y ? value_x : value_y;
-        }
-    };
-
-    sal_uInt32 getBytesPerPixel( IColorBuffer::Format eFormat )
-    {
-        switch(eFormat)
-        {
-            default:
-                OSL_ENSURE(false, "Unexpected pixel format");
-                // FALLTHROUGH intended
-            case IColorBuffer::FMT_R8G8B8:
-                return 3L;
-            case IColorBuffer::FMT_A8R8G8B8:
-                return 4L;
-        }
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////////////
-// Image::drawLinePolyPolygon
-//////////////////////////////////////////////////////////////////////////////////
-
-template<class pixel_format>
-void Image::drawLinePolyPolygonImpl( const ::basegfx::B2DPolyPolygon&   rPolyPolygon,
-                                     double                             fStrokeWidth,
-                                     const rendering::ViewState&        viewState, 
-                                     const rendering::RenderState&      renderState )
-{
-    ::basegfx::B2DPolyPolygon aPolyPolygon( rPolyPolygon );
-    ARGB                      aRenderColor;
-
-    setupPolyPolygon( aPolyPolygon, false, aRenderColor, viewState, renderState );
-
-    if( !aPolyPolygon.count() )
-        return;
-
-    // Class template pixel_formats_rgb24 has full knowledge about this
-    // particular pixel format in memory. The only template parameter
-    // can be order_rgb24 or order_bgr24 that determines the order of color channels.
-    //typedef agg::pixfmt_rgba32 pixel_format;
-    pixel_format pixf(maRenderingBuffer);
-
-    // There are two basic renderers with almost the same functionality:
-    // renderer_base and renderer_mclip. The first one is used most often
-    // and it performs low level clipping.
-    // This simply adds clipping to the graphics buffer, the clip rect
-    // will be initialized to the area of the framebuffer.
-    typedef agg::renderer_base<pixel_format> renderer_base;
-    agg::renderer_base<pixel_format> renb(pixf);
-
-    // To draw Anti-Aliased primitives one shoud *rasterize* them first.
-    // The primary rasterization technique in AGG is scanline based.
-    // That is, a polygon is converted into a number of horizontal
-    // scanlines and then the scanlines are being rendered one by one.
-    // To transfer information from a rasterizer to the scanline renderer
-    // there scanline containers are used. A scanline consists of a
-    // number of horizontal, non-intersecting spans. All spans must be ordered by X.
-    // --> *packed* scanline container
-    agg::scanline_p8 sl;
-
-    typedef agg::renderer_outline_aa<renderer_base> renderer_type;
-    typedef agg::rasterizer_outline_aa<renderer_type> rasterizer_type;
-    agg::line_profile_aa profile;
-    profile.width(fStrokeWidth);
-    renderer_type ren(renb, profile);
-    rasterizer_type ras(ren);
-
-    const agg::rgba8 fillcolor(aRenderColor.Color.r,
-                               aRenderColor.Color.g,
-                               aRenderColor.Color.b,
-                               aRenderColor.Color.a);
-    ren.color(fillcolor);
-
-    agg::path_storage path;
-    agg::conv_curve<agg::path_storage> curve(path);
-
-    for(sal_uInt32 nPolygon=0; nPolygon<aPolyPolygon.count(); ++nPolygon)
-    {
-        const basegfx::B2DPolygon aPolygon(aPolyPolygon.getB2DPolygon(nPolygon));
-        const sal_uInt32 nPointCount(aPolygon.count());
-
-        if(nPointCount)
-        {
-            if(aPolygon.areControlPointsUsed())
-            {
-                // prepare edge-based loop
-                basegfx::B2DPoint aCurrentPoint(aPolygon.getB2DPoint(0));
-                const sal_uInt32 nEdgeCount(aPolygon.isClosed() ? nPointCount - 1 : nPointCount);
-
-                // first vertex
-                path.move_to(aCurrentPoint.getX(), aCurrentPoint.getY());
-
-                for(sal_uInt32 a(0); a < nEdgeCount; a++)
-                {
-                    // access next point
-                    const sal_uInt32 nNextIndex((a + 1) % nPointCount);
-                    const basegfx::B2DPoint aNextPoint(aPolygon.getB2DPoint(nNextIndex));
-
-                    // get control points
-                    const basegfx::B2DPoint aControlNext(aPolygon.getNextControlPoint(a));
-                    const basegfx::B2DPoint aControlPrev(aPolygon.getPrevControlPoint(nNextIndex));
-
-                    // specify first cp, second cp, next vertex
-                    path.curve4(
-                        aControlNext.getX(), aControlNext.getY(),
-                        aControlPrev.getX(), aControlPrev.getY(),
-                        aNextPoint.getX(), aNextPoint.getY());
-
-                    // prepare next step
-                    aCurrentPoint = aNextPoint;
-                }
-            }
-            else
-            {
-                const basegfx::B2DPoint aStartPoint(aPolygon.getB2DPoint(0));
-                ras.move_to_d(aStartPoint.getX(), aStartPoint.getY());
-
-                for(sal_uInt32 a(1); a < nPointCount; a++)
-                {
-                    const basegfx::B2DPoint aVertexPoint(aPolygon.getB2DPoint(a));
-                    ras.line_to_d(aVertexPoint.getX(), aVertexPoint.getY());
-                }
-
-                ras.render(aPolygon.isClosed());
-            }
-        }
-    }
-
-    ras.add_path(curve);
-    ras.render(false);
-}
-
-//////////////////////////////////////////////////////////////////////////////////
-// Image::drawLinePolyPolygon
-//////////////////////////////////////////////////////////////////////////////////
-
-void Image::drawLinePolyPolygon( const ::basegfx::B2DPolyPolygon&   rPoly,
-                                 double                             fStrokeWidth,
-                                 const rendering::ViewState&        viewState,
-                                 const rendering::RenderState&      renderState )
-{
-    switch(maDesc.eFormat)
-    {
-        case FMT_R8G8B8:
-            drawLinePolyPolygonImpl<agg::pixfmt_rgb24>(rPoly,fStrokeWidth,viewState,renderState);
-            break;
-        case FMT_A8R8G8B8:
-            drawLinePolyPolygonImpl<agg::pixfmt_rgba32>(rPoly,fStrokeWidth,viewState,renderState);
-            break;
-        default:
-            OSL_ENSURE(false, "Unexpected pixel format");
-            break;
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////////////
-// Image::implDrawBitmap
-//////////////////////////////////////////////////////////////////////////////////
-
-/** internal utility function to draw one image into another one.
-    the source image will be drawn with respect to the given
-    transform and clip settings.
- */
-ImageCachedPrimitiveSharedPtr Image::implDrawBitmap(
-    const Image&                     rBitmap,
-    const rendering::ViewState& 	 viewState,
-    const rendering::RenderState&    renderState )
-{
-    ::basegfx::B2DPolyPolygon aPoly(
-        ::basegfx::tools::createPolygonFromRect(
-            ::basegfx::B2DRange(0.0, 0.0,
-                                rBitmap.maDesc.nWidth,
-                                rBitmap.maDesc.nHeight ) ) );
-    ARGB aFillColor;
-
-    setupPolyPolygon( aPoly, true, aFillColor, viewState, renderState );
-
-    if( !aPoly.count() )
-        return ImageCachedPrimitiveSharedPtr();
-
-    ::basegfx::B2DHomMatrix aViewTransform;
-    ::basegfx::B2DHomMatrix aRenderTransform;
-    ::basegfx::B2DHomMatrix aTextureTransform;
-
-    ::basegfx::unotools::homMatrixFromAffineMatrix(aRenderTransform,
-                                                   renderState.AffineTransform);
-    ::basegfx::unotools::homMatrixFromAffineMatrix(aViewTransform,
-                                                   viewState.AffineTransform);
-    aTextureTransform *= aRenderTransform;
-
-    // TODO(F2): Fill in texture
-    rendering::Texture aTexture;
-
-    return fillTexturedPolyPolygon( rBitmap,
-                             aPoly,
-                             aTextureTransform,
-                             aViewTransform,
-                             aTexture );
-}
-
-//////////////////////////////////////////////////////////////////////////////////
-// cachedPrimitiveFTPP [cachedPrimitive for [F]ill[T]extured[P]oly[P]olygon]
-//////////////////////////////////////////////////////////////////////////////////
-
-#if AGG_VERSION >= 2400
-template<class pixel_format_dst,class span_gen_type>
-#else
-template<class pixel_format,class span_gen_type>
-#endif
-class cachedPrimitiveFTPP : public ImageCachedPrimitive
-{
-    public:
-
-        cachedPrimitiveFTPP( const ::basegfx::B2DHomMatrix &rTransform,
-                            const ::basegfx::B2DHomMatrix &rViewTransform,
-                            agg::rendering_buffer &dst,
-                            const agg::rendering_buffer& src ) :
-            aTransform(rTransform),
-            inter(tm),
-            filter(filter_kernel),
-#if AGG_VERSION >= 2400
-                        pixs(const_cast<agg::rendering_buffer&>(src)),
-                        source(pixs),
-                        sg(source,inter,filter),
-                        pixd(dst),
-                        rb(pixd),
-                        ren(rb,sa,sg)
-#else
-            sg(sa,src,inter,filter),
-            pixf(dst),
-            rb(pixf),
-            ren(rb,sg)
-#endif
-        {
-            ::basegfx::B2DHomMatrix aFinalTransform(aTransform);
-            aFinalTransform *= rViewTransform;
-            tm = transAffineFromB2DHomMatrix(aFinalTransform);
-            tm.invert();
-        }
-
-        virtual void setImage( const ::boost::shared_ptr< class Image >& rTargetImage )
-        {
-            pImage=rTargetImage;
-        }
-
-        virtual sal_Int8 redraw( const ::com::sun::star::rendering::ViewState& aState ) const
-        {
-            ::basegfx::B2DHomMatrix aViewTransform;
-            ::basegfx::unotools::homMatrixFromAffineMatrix(aViewTransform,aState.AffineTransform);
-            ::basegfx::B2DHomMatrix aFinalTransform(aTransform);
-            aFinalTransform *= aViewTransform;
-            tm = transAffineFromB2DHomMatrix(aFinalTransform);
-            tm.invert();
-            redraw();
-            return ::com::sun::star::rendering::RepaintResult::REDRAWN;
-        }
-
-        inline void redraw() const { agg::render_scanlines(ras, sl, ren); }
-
-        mutable agg::rasterizer_scanline_aa<> ras;
-
-    private:
-
-        typedef agg::span_interpolator_linear<> interpolator_type;
-#if AGG_VERSION >= 2400
-                typedef agg::renderer_base<pixel_format_dst> renderer_base;
-                typedef agg::span_allocator< typename span_gen_type::color_type > span_alloc_type;
-                typedef agg::renderer_scanline_aa<renderer_base, span_alloc_type, span_gen_type> renderer_type;
-                typedef typename span_gen_type::source_type source_type;
-                typedef typename span_gen_type::source_type::pixfmt_type pixel_format_src;
-#else
-        typedef agg::renderer_base<pixel_format> renderer_base;
-        typedef agg::renderer_scanline_aa<renderer_base, span_gen_type> renderer_type;
-#endif
-
-        ::basegfx::B2DHomMatrix aTransform;
-        interpolator_type inter;
-        agg::image_filter_bilinear filter_kernel;
-        agg::image_filter_lut filter;
-#if AGG_VERSION >= 2400
-                span_alloc_type sa;
-                pixel_format_src pixs;
-                source_type source;
-#else
-        agg::span_allocator< typename span_gen_type::color_type > sa;
-#endif
-        span_gen_type sg;
-#if AGG_VERSION >= 2400
-        pixel_format_dst pixd;
-#else
-        pixel_format pixf;
-#endif
-        renderer_base rb;
-        mutable renderer_type ren;
-        mutable agg::scanline_p8 sl;
-        mutable agg::trans_affine tm;
-        ImageSharedPtr pImage;
-};
-
-//////////////////////////////////////////////////////////////////////////////////
-// Image::fillTexturedPolyPolygon
-//////////////////////////////////////////////////////////////////////////////////
-
-template<class pixel_format,class span_gen_type>
-ImageCachedPrimitiveSharedPtr Image::fillTexturedPolyPolygonImpl(
-                                     const Image&					  rTexture,
-                                     const ::basegfx::B2DPolyPolygon& rPolyPolygon,
-                                     const ::basegfx::B2DHomMatrix&   rOverallTransform,
-                                     const ::basegfx::B2DHomMatrix&   rViewTransform,
-                                     const rendering::Texture&         )
-{
-    // calculate final overall transform.
-    ::basegfx::B2DHomMatrix aOverallTransform(rOverallTransform);
-    aOverallTransform *= rViewTransform;
-
-    // instead of always using the full-blown solution we
-    // first check to see if this is a simple rectangular
-    // 1-to-1 copy from source to destination image.
-    ::basegfx::B2DTuple aTranslate(aOverallTransform.get(0,2),aOverallTransform.get(1,2));
-    ::basegfx::B2DTuple aSize(rTexture.maDesc.nWidth,rTexture.maDesc.nHeight);
-    ::basegfx::B2DRange aRange(aTranslate,aTranslate+aSize);
-    ::basegfx::B2DPolyPolygon aPolyPolygon(rPolyPolygon);
-    aPolyPolygon.transform(aOverallTransform);
-    if(::basegfx::tools::isPolyPolygonEqualRectangle(aPolyPolygon,aRange))
-    {
-        // yes, we can take the shortcut.
-        // but we need to clip the destination rectangle
-        // against the boundary of the destination image.
-        sal_Int32 dwSrcX(0);
-        sal_Int32 dwSrcY(0);
-        sal_Int32 dwDstX(static_cast<sal_Int32>(aTranslate.getX()));
-        sal_Int32 dwDstY(static_cast<sal_Int32>(aTranslate.getY()));
-        sal_Int32 dwWidth(rTexture.maDesc.nWidth);
-        sal_Int32 dwHeight(rTexture.maDesc.nHeight);
-
-        // prevent fast copy if destination position is not an
-        // integer coordinate. otherwise we would most probably
-        // introduce visual glitches while combining this with
-        // high-accuracy rendering stuff.
-        if( ::basegfx::fTools::equalZero(aTranslate.getX()-dwDstX) &&
-            ::basegfx::fTools::equalZero(aTranslate.getY()-dwDstY))
-        {
-            // clip against destination boundary. shrink size if
-            // necessary, modify destination position if we need to.
-            if(dwDstX < 0) { dwWidth-=dwDstX; dwSrcX=-dwDstX; dwDstX=0; }
-            if(dwDstY < 0) { dwHeight-=dwDstY; dwSrcY=-dwDstY; dwDstY=0; }
-            const sal_Int32 dwRight(dwDstX+dwWidth);
-            const sal_Int32 dwBottom(dwDstY+dwHeight);
-            if(dwRight > dwWidth)
-                dwWidth -= dwRight-dwWidth;
-            if(dwBottom > dwHeight)
-                dwHeight -= dwBottom-dwHeight;
-
-            // calculate source buffer
-            const Description &srcDesc = rTexture.maDesc;
-            const sal_uInt32 dwSrcBytesPerPixel(getBytesPerPixel(srcDesc.eFormat));
-            const sal_uInt32 dwSrcPitch(srcDesc.nWidth*dwSrcBytesPerPixel+srcDesc.nStride);
-            sal_uInt8 *pSrcBuffer = rTexture.maDesc.pBuffer+(dwSrcPitch*dwSrcX)+(dwSrcBytesPerPixel*dwSrcY);
-
-            // calculate destination buffer
-            const Description &dstDesc = maDesc;
-            const sal_uInt32 dwDstBytesPerPixel(getBytesPerPixel(dstDesc.eFormat));
-            const sal_uInt32 dwDstPitch(dstDesc.nWidth*dwDstBytesPerPixel+dstDesc.nStride);
-            sal_uInt8 *pDstBuffer = maDesc.pBuffer+(dwDstPitch*dwDstY)+(dwDstBytesPerPixel*dwDstX);
-
-            // if source and destination format match, we can simply
-            // copy whole scanlines.
-            if(srcDesc.eFormat == dstDesc.eFormat)
-            {
-                const sal_Size dwNumBytesPerScanline(dwSrcBytesPerPixel*dwWidth);
-                for(sal_Int32 y=0; y<dwHeight; ++y)
-                {
-                    rtl_copyMemory(pDstBuffer,pSrcBuffer,dwNumBytesPerScanline);
-                    pSrcBuffer += dwSrcPitch;
-                    pDstBuffer += dwDstPitch;
-                }
-            }
-            else
-            {
-                // otherwise [formats do not match], we need to copy
-                // each pixel one by one and convert from source to destination format.
-                if(srcDesc.eFormat == FMT_A8R8G8B8 && dstDesc.eFormat == FMT_R8G8B8)
-                {
-                    for(sal_Int32 y=0; y<dwHeight; ++y)
-                    {
-                        sal_uInt8 *pSrc=pSrcBuffer;
-                        sal_uInt8 *pDst=pDstBuffer;
-                        for(sal_Int32 x=0; x<dwWidth; ++x)
-                        {
-                            BYTE r(*pSrc++);
-                            BYTE g(*pSrc++);
-                            BYTE b(*pSrc++);
-                            BYTE Alpha(*pSrc++);
-                            BYTE OneMinusAlpha(0xFF-Alpha);
-                            *pDst=(((r*Alpha)+((*pDst)*OneMinusAlpha))/0xFF);
-                            ++pDst;
-                            *pDst=(((g*Alpha)+((*pDst)*OneMinusAlpha))/0xFF);
-                            ++pDst;
-                            *pDst=(((b*Alpha)+((*pDst)*OneMinusAlpha))/0xFF);
-                            ++pDst;
-                        }
-                        pSrcBuffer += dwSrcPitch;
-                        pDstBuffer += dwDstPitch;
-                    }
-                }
-                else if(srcDesc.eFormat == FMT_R8G8B8 && dstDesc.eFormat == FMT_A8R8G8B8)
-                {
-                    for(sal_Int32 y=0; y<dwHeight; ++y)
-                    {
-                        sal_uInt8 *pSrc=pSrcBuffer;
-                        sal_uInt8 *pDst=pDstBuffer;
-                        for(sal_Int32 x=0; x<dwWidth; ++x)
-                        {
-                            BYTE r(*pSrc++);
-                            BYTE g(*pSrc++);
-                            BYTE b(*pSrc++);
-                            *pDst++=r;
-                            *pDst++=g;
-                            *pDst++=b;
-                            *pDst++=0xFF;
-                        }
-                        pSrcBuffer += dwSrcPitch;
-                        pDstBuffer += dwDstPitch;
-                    }
-                }
-            }
-
-            return ImageCachedPrimitiveSharedPtr();
-        }
-    }
-
-    typedef cachedPrimitiveFTPP<pixel_format,span_gen_type> cachedPrimitive_t;
-    cachedPrimitive_t *pPrimitive = new cachedPrimitive_t( rOverallTransform,
-                                                           rViewTransform,
-                                                           maRenderingBuffer,
-                                                           rTexture.maRenderingBuffer);
-
-    agg::path_storage path;
-    agg::conv_curve<agg::path_storage> curve(path);
-
-    for(sal_uInt32 nPolygon(0); nPolygon < rPolyPolygon.count(); nPolygon++)
-    {
-        const basegfx::B2DPolygon aPolygon(rPolyPolygon.getB2DPolygon(nPolygon));
-        const sal_uInt32 nPointCount(aPolygon.count());
-
-        if(nPointCount)
-        {
-            if(aPolygon.areControlPointsUsed())
-            {
-                // prepare edge-based loop
-                basegfx::B2DPoint aCurrentPoint(aPolygon.getB2DPoint(0));
-                const sal_uInt32 nEdgeCount(aPolygon.isClosed() ? nPointCount - 1 : nPointCount);
-
-                // first vertex
-                path.move_to(aCurrentPoint.getX(), aCurrentPoint.getY());
-
-                for(sal_uInt32 a(0); a < nEdgeCount; a++)
-                {
-                    // access next point
-                    const sal_uInt32 nNextIndex((a + 1) % nPointCount);
-                    const basegfx::B2DPoint aNextPoint(aPolygon.getB2DPoint(nNextIndex));
-
-                    // get control points
-                    const basegfx::B2DPoint aControlNext(aPolygon.getNextControlPoint(a));
-                    const basegfx::B2DPoint aControlPrev(aPolygon.getPrevControlPoint(nNextIndex));
-
-                    // specify first cp, second cp, next vertex
-                    path.curve4(
-                        aControlNext.getX(), aControlNext.getY(),
-                        aControlPrev.getX(), aControlPrev.getY(),
-                        aNextPoint.getX(), aNextPoint.getY());
-
-                    // prepare next step
-                    aCurrentPoint = aNextPoint;
-                }
-            }
-            else
-            {
-                const basegfx::B2DPoint aPoint(aPolygon.getB2DPoint(0));
-                pPrimitive->ras.move_to_d(aPoint.getX(), aPoint.getY());
-
-                for(sal_uInt32 a(1); a < nPointCount; a++)
-                {
-                    const basegfx::B2DPoint aVertexPoint(aPolygon.getB2DPoint(a));
-                    pPrimitive->ras.line_to_d(aVertexPoint.getX(), aVertexPoint.getY());
-                }
-
-                if(aPolygon.isClosed())
-                {
-                    pPrimitive->ras.close_polygon();
-                }
-            }
-        }
-    }
-
-    pPrimitive->ras.add_path(curve);
-    pPrimitive->redraw();
-
-    return ImageCachedPrimitiveSharedPtr(pPrimitive);
-}
-
-//////////////////////////////////////////////////////////////////////////////////
-// Image::fillTexturedPolyPolygon
-//////////////////////////////////////////////////////////////////////////////////
-
-ImageCachedPrimitiveSharedPtr Image::fillTexturedPolyPolygon(
-                                     const Image&                     rTexture,
-                                     const ::basegfx::B2DPolyPolygon& rPolyPolygon,
-                                     const ::basegfx::B2DHomMatrix&   rOverallTransform,
-                                     const ::basegfx::B2DHomMatrix&   rViewTransform,
-                                     const rendering::Texture&        texture )
-{
-    typedef agg::wrap_mode_repeat wrap_x_type;
-    typedef agg::wrap_mode_repeat wrap_y_type;
-    typedef agg::pixfmt_rgb24 pixfmt_rgb24;
-    typedef agg::pixfmt_rgba32 pixfmt_rgba32;
-#if AGG_VERSION >= 2400
-        typedef agg::image_accessor_wrap< pixfmt_rgba32, wrap_x_type, wrap_y_type > img_source_type_rgba;
-        typedef agg::image_accessor_wrap< pixfmt_rgb24, wrap_x_type, wrap_y_type > img_source_type_rgb;
- 
-        typedef agg::span_image_resample_rgba_affine< img_source_type_rgba > span_gen_type_rgba;
-        typedef agg::span_image_resample_rgb_affine< img_source_type_rgb > span_gen_type_rgb;
-#else
-    typedef agg::span_pattern_resample_rgba_affine<	pixfmt_rgba32::color_type,
-                                                    pixfmt_rgba32::order_type,
-                                                    wrap_x_type,
-                                                    wrap_y_type> span_gen_type_rgba;
-    typedef agg::span_pattern_resample_rgb_affine< pixfmt_rgb24::color_type,
-                                                    pixfmt_rgb24::order_type,
-                                                    wrap_x_type,
-                                                    wrap_y_type> span_gen_type_rgb;
-#endif
-
-    const Format nDest = maDesc.eFormat;
-    const Format nSource = rTexture.maDesc.eFormat;
-
-    if(nDest == FMT_R8G8B8 && nSource == FMT_R8G8B8)
-    {
-        return fillTexturedPolyPolygonImpl< agg::pixfmt_rgb24,
-                                            span_gen_type_rgb >( 
-                                                rTexture,
-                                                rPolyPolygon,
-                                                rOverallTransform,
-                                                rViewTransform,
-                                                texture );
-    }
-    else if(nDest == FMT_R8G8B8 && nSource == FMT_A8R8G8B8)
-    {
-        return fillTexturedPolyPolygonImpl< agg::pixfmt_rgb24,
-                                            span_gen_type_rgba >( 
-                                                rTexture,
-                                                rPolyPolygon,
-                                                rOverallTransform,
-                                                rViewTransform,
-                                                texture );
-    }
-    else if(nDest == FMT_A8R8G8B8 && nSource == FMT_R8G8B8)
-    {
-        return fillTexturedPolyPolygonImpl< agg::pixfmt_rgba32,
-                                            span_gen_type_rgb >( 
-                                                rTexture,
-                                                rPolyPolygon,
-                                                rOverallTransform,
-                                                rViewTransform,
-                                                texture );
-    }
-    else if(nDest == FMT_A8R8G8B8 && nSource == FMT_A8R8G8B8)
-    {
-        return fillTexturedPolyPolygonImpl< agg::pixfmt_rgba32,
-                                            span_gen_type_rgba >( 
-                                                rTexture,
-                                                rPolyPolygon,
-                                                rOverallTransform,
-                                                rViewTransform,
-                                                texture );
-    }
-    else
-    {
-        OSL_ENSURE(false, "Unexpected pixel format");
-    }
-
-    return ImageCachedPrimitiveSharedPtr();
-}
-
-//////////////////////////////////////////////////////////////////////////////////
-// Image::fillGradient
-//////////////////////////////////////////////////////////////////////////////////
-
-template<class pixel_format>
-void Image::fillGradientImpl( const ParametricPolyPolygon::Values& rValues,
-                              const uno::Sequence< double >&       rUnoColor1,
-                              const uno::Sequence< double >&       rUnoColor2,
-                              const ::basegfx::B2DPolyPolygon&     rPolyPolygon,
-                              const ::basegfx::B2DHomMatrix&       rOverallTransform,
-                              const rendering::Texture&             )
-{
-    const ARGB aColor1(0xFFFFFFFF,
-                       rUnoColor1);
-    const ARGB aColor2(0xFFFFFFFF,
-                       rUnoColor2);
-
-    // first of all we need to provide the framebuffer we want to render to.
-    // the properties of the framebuffer are
-    // 1) memory & layout [width, height, stride]
-    // 2) pixelformat
-    // 3) clipping
-
-    // Class template pixel_formats_rgb24 has full knowledge about this
-    // particular pixel format in memory. The only template parameter
-    // can be order_rgb24 or order_bgr24 that determines the order of color channels.
-    pixel_format pixf(maRenderingBuffer);
-
-    // There are two basic renderers with almost the same functionality:
-    // renderer_base and renderer_mclip. The first one is used most often
-    // and it performs low level clipping.
-    // This simply adds clipping to the graphics buffer, the clip rect
-    // will be initialized to the area of the framebuffer.
-    typedef agg::renderer_base<pixel_format> renderer_base;
-    renderer_base rb(pixf);
-
-    // bounding rectangle of untransformed polypolygon
-    const ::basegfx::B2DRange& rBounds(::basegfx::tools::getRange(rPolyPolygon));
-

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list