diff -rup canvas-orig/inc/canvas/base/graphicdevicebase.hxx canvas/inc/canvas/base/graphicdevicebase.hxx
--- canvas-orig/inc/canvas/base/graphicdevicebase.hxx	2007-08-21 13:19:17.000000000 +0200
+++ canvas/inc/canvas/base/graphicdevicebase.hxx	2007-09-06 17:02:14.000000000 +0200
@@ -357,41 +357,41 @@ namespace canvas
 
         
         // XParametricPolyPolygon2DFactory
-        virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createLinearHorizontalGradient( const ::com::sun::star::uno::Sequence< double >& leftColor, const ::com::sun::star::uno::Sequence< double >& rightColor ) throw (::com::sun::star::lang::IllegalArgumentException, 
+        virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createLinearHorizontalGradient( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors, const ::com::sun::star::uno::Sequence< double >& stops ) throw (::com::sun::star::lang::IllegalArgumentException, 
                                                                                                                                                                                                                                                                                     ::com::sun::star::uno::RuntimeException)
         {
             return ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D >( 
                 ParametricPolyPolygon::createLinearHorizontalGradient( this, 
-                                                                       leftColor, 
-                                                                       rightColor ) );
+                                                                       colors, 
+                                                                       stops ) );
         }
 
-        virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createAxialHorizontalGradient( const ::com::sun::star::uno::Sequence< double >& middleColor, const ::com::sun::star::uno::Sequence< double >& endColor ) throw (::com::sun::star::lang::IllegalArgumentException, 
+        virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createAxialHorizontalGradient( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors, const ::com::sun::star::uno::Sequence< double >& stops ) throw (::com::sun::star::lang::IllegalArgumentException, 
                                                                                                                                                                                                                                                                                    ::com::sun::star::uno::RuntimeException)
         {
             return ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D >( 
                 ParametricPolyPolygon::createAxialHorizontalGradient( this,
-                                                                      middleColor, 
-                                                                      endColor ) );
+                                                                      colors,
+                                                                      stops ) );
         }
 
-        virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createEllipticalGradient( const ::com::sun::star::uno::Sequence< double >& centerColor, const ::com::sun::star::uno::Sequence< double >& endColor, const ::com::sun::star::geometry::RealRectangle2D& boundRect ) throw (::com::sun::star::lang::IllegalArgumentException, 
+        virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createEllipticalGradient( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors, const ::com::sun::star::uno::Sequence< double >& stops, const ::com::sun::star::geometry::RealRectangle2D& boundRect ) throw (::com::sun::star::lang::IllegalArgumentException, 
                                                                                                                                                                                                                                                                                                                                             ::com::sun::star::uno::RuntimeException)
         {
             return ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D >( 
                 ParametricPolyPolygon::createEllipticalGradient( this, 
-                                                                 centerColor, 
-                                                                 endColor,
+                                                                 colors,
+                                                                 stops,
                                                                  boundRect ) );
         }
 
-        virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createRectangularGradient( const ::com::sun::star::uno::Sequence< double >& centerColor, const ::com::sun::star::uno::Sequence< double >& endColor, const ::com::sun::star::geometry::RealRectangle2D& boundRect ) throw (::com::sun::star::lang::IllegalArgumentException, 
+        virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createRectangularGradient( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors, const ::com::sun::star::uno::Sequence< double >& stops, const ::com::sun::star::geometry::RealRectangle2D& boundRect ) throw (::com::sun::star::lang::IllegalArgumentException, 
                                                                                                                                                                                                                                                                                                                                              ::com::sun::star::uno::RuntimeException)
         {
             return ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D >( 
                 ParametricPolyPolygon::createRectangularGradient( this,
-                                                                  centerColor, 
-                                                                  endColor, 
+                                                                  colors,
+                                                                  stops,
                                                                   boundRect ) );
         }
 
diff -rup canvas-orig/inc/canvas/parametricpolypolygon.hxx canvas/inc/canvas/parametricpolypolygon.hxx
--- canvas-orig/inc/canvas/parametricpolypolygon.hxx	2007-08-21 13:19:17.000000000 +0200
+++ canvas/inc/canvas/parametricpolypolygon.hxx	2007-09-06 16:24:13.000000000 +0200
@@ -94,14 +94,14 @@ namespace canvas
         struct Values
         {
             Values( const ::basegfx::B2DPolygon&                        rGradientPoly,
-                    const ::com::sun::star::uno::Sequence< double >&	rColor1,
-                    const ::com::sun::star::uno::Sequence< double >&	rColor2,
+                    const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >&	rColors,
+                    const ::com::sun::star::uno::Sequence< double >&	rStops,
                     double                                              nAspectRatio,
                     GradientType                                        eType ) :
                 maGradientPoly( rGradientPoly ),
                 mnAspectRatio( nAspectRatio ),
-                maColor1( rColor1 ),
-                maColor2( rColor2 ),
+                maColors( rColors ),
+                maStops( rStops ),
                 meType( eType )
             {
             }
@@ -112,11 +112,11 @@ namespace canvas
             /// Aspect ratio of gradient, affects scaling of innermost gradient polygon
             const double										mnAspectRatio;
 
-            /// First gradient color 
-            const ::com::sun::star::uno::Sequence< double >		maColor1;
+            /// Gradient colors
+            const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >		maColors;
 
-            /// Second gradient color
-            const ::com::sun::star::uno::Sequence< double >		maColor2;
+            /// Gradient color stops
+            const ::com::sun::star::uno::Sequence< double >		maStops;
 
             /// Type of gradient to render (as e.g. linear grads are not represented by maGradientPoly)
             const GradientType									meType;
@@ -124,21 +124,21 @@ namespace canvas
 
         static ParametricPolyPolygon* createLinearHorizontalGradient( const ::com::sun::star::uno::Reference< 
                                                                       	::com::sun::star::rendering::XGraphicDevice >& 	rDevice,  
-                                                                      const ::com::sun::star::uno::Sequence< double >& 	leftColor, 
-                                                                      const ::com::sun::star::uno::Sequence< double >& 	rightColor );
+                                                                      const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& 	colors, 
+                                                                      const ::com::sun::star::uno::Sequence< double >& 	stops );
         static ParametricPolyPolygon* createAxialHorizontalGradient( const ::com::sun::star::uno::Reference< 
                                                                       	::com::sun::star::rendering::XGraphicDevice >& 	rDevice,  
-                                                                     const ::com::sun::star::uno::Sequence< double >& 	middleColor, 
-                                                                     const ::com::sun::star::uno::Sequence< double >& 	endColor );
+                                                                      const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& 	colors, 
+                                                                      const ::com::sun::star::uno::Sequence< double >& 	stops );
         static ParametricPolyPolygon* createEllipticalGradient( const ::com::sun::star::uno::Reference< 
-                                                                      	::com::sun::star::rendering::XGraphicDevice >& 	rDevice,  
-                                                                const ::com::sun::star::uno::Sequence< double >& 		centerColor, 
-                                                                const ::com::sun::star::uno::Sequence< double >& 		endColor,
+                                                                ::com::sun::star::rendering::XGraphicDevice >& 	rDevice,  
+                                                                const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& 	colors, 
+                                                                const ::com::sun::star::uno::Sequence< double >& 	stops,
                                                                 const ::com::sun::star::geometry::RealRectangle2D&		boundRect );
         static ParametricPolyPolygon* createRectangularGradient( const ::com::sun::star::uno::Reference< 
-                                                                      	::com::sun::star::rendering::XGraphicDevice >& 	rDevice,  
-                                                                 const ::com::sun::star::uno::Sequence< double >& 		centerColor, 
-                                                                 const ::com::sun::star::uno::Sequence< double >& 		endColor,
+                                                                 ::com::sun::star::rendering::XGraphicDevice >& 	rDevice,  
+                                                                 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& 	colors, 
+                                                                 const ::com::sun::star::uno::Sequence< double >& 	stops,
                                                                  const ::com::sun::star::geometry::RealRectangle2D&		boundRect );
 
         /// Dispose all internal references
@@ -168,20 +168,20 @@ namespace canvas
                                	::com::sun::star::rendering::XGraphicDevice >& 	rDevice,  
                                const ::basegfx::B2DPolygon& 					rGradientPoly,
                                GradientType	  									eType,
-                               const ::com::sun::star::uno::Sequence< double >&	rColor1,
-                               const ::com::sun::star::uno::Sequence< double >&	rColor2 );
+                               const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& 	colors,
+                               const ::com::sun::star::uno::Sequence< double >& 	stops );
         ParametricPolyPolygon( const ::com::sun::star::uno::Reference< 
                                	::com::sun::star::rendering::XGraphicDevice >& 	rDevice,  
                                const ::basegfx::B2DPolygon& 					rGradientPoly,
                                GradientType	  									eType,
-                               const ::com::sun::star::uno::Sequence< double >&	rColor1,
-                               const ::com::sun::star::uno::Sequence< double >&	rColor2,
+                               const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& 	colors,
+                               const ::com::sun::star::uno::Sequence< double >& 	stops,
                                double											nAspectRatio );
         ParametricPolyPolygon( const ::com::sun::star::uno::Reference< 
-                               	::com::sun::star::rendering::XGraphicDevice >& 	rDevice,  
+                               	::com::sun::star::rendering::XGraphicDevice >& 	rDevice,
                                GradientType	  									eType,
-                               const ::com::sun::star::uno::Sequence< double >&	rColor1,
-                               const ::com::sun::star::uno::Sequence< double >&	rColor2 );
+                               const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& 	colors,
+                               const ::com::sun::star::uno::Sequence< double >& 	stops );
 
     	::com::sun::star::uno::Reference< 
 	        ::com::sun::star::rendering::XGraphicDevice > 	 mxDevice;
diff -rup canvas-orig/source/cairo/cairo_cairo.hxx canvas/source/cairo/cairo_cairo.hxx
--- canvas-orig/source/cairo/cairo_cairo.hxx	2007-08-21 13:19:18.000000000 +0200
+++ canvas/source/cairo/cairo_cairo.hxx	2007-10-10 17:35:34.000000000 +0200
@@ -67,6 +67,11 @@ namespace cairo {
 		{
 			return mpRenderFormat;
 		}
+
+        inline void doNotFreePixmap ()
+        {
+            mbFreePixmap = false;
+        }
 #endif
 
 		// use only for surfaces made on X Drawables
diff -rup canvas-orig/source/cairo/cairo_canvasbitmap.hxx canvas/source/cairo/cairo_canvasbitmap.hxx
--- canvas-orig/source/cairo/cairo_canvasbitmap.hxx	2007-08-21 13:19:18.000000000 +0200
+++ canvas/source/cairo/cairo_canvasbitmap.hxx	2007-10-24 13:07:12.000000000 +0200
@@ -36,11 +36,12 @@
 #ifndef _CAIROCANVAS_CANVASBITMAP_HXX
 #define _CAIROCANVAS_CANVASBITMAP_HXX
 
-#include <cppuhelper/compbase3.hxx>
+#include <cppuhelper/compbase4.hxx>
 
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/rendering/XBitmapCanvas.hpp>
 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
+#include <com/sun/star/beans/XFastPropertySet.hpp>
 
 #include <basegfx/vector/b2isize.hxx>
 
@@ -58,9 +59,10 @@
 
 namespace cairocanvas
 {
-    typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::rendering::XBitmapCanvas,
-																		   ::com::sun::star::rendering::XIntegerBitmap,
-																										::com::sun::star::lang::XServiceInfo >  	CanvasBitmapBase_Base;
+    typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::rendering::XBitmapCanvas,
+											  ::com::sun::star::rendering::XIntegerBitmap,
+                                              ::com::sun::star::lang::XServiceInfo,
+                                              ::com::sun::star::beans::XFastPropertySet >  	CanvasBitmapBase_Base;
     typedef ::canvas::IntegerBitmapBase< ::canvas::BaseMutexHelper< CanvasBitmapBase_Base >, 
 		CanvasHelper, 
 		::osl::MutexGuard,
@@ -97,6 +99,19 @@ namespace cairocanvas
                                                          const ::com::sun::star::rendering::ViewState& viewState,
                                                          const ::com::sun::star::rendering::RenderState&       renderState );

+        // XFastPropertySet
+        // used to retrieve BitmapEx pointer or X Pixmap handles for this bitmap
+        // handle values have these meanings:
+        // 0 ... get pointer to BitmapEx
+        // 1 ... get X pixmap handle to rgb content
+        // 2 ... get X pitmap handle to alpha mask
+        // returned any contains either BitmapEx pointer or array of three Any value
+        //     1st a bool value: true - free the pixmap after used by XFreePixmap, false do nothing, the pixmap is used internally in the canvas
+        //     2nd the pixmap handle
+        //     3rd the pixmap depth
+        virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue(sal_Int32 nHandle)  throw (::com::sun::star::uno::RuntimeException);
+        virtual void SAL_CALL setFastPropertyValue(sal_Int32 nHandle, const ::com::sun::star::uno::Any&)  throw (::com::sun::star::uno::RuntimeException) {}
+
     private:
         /** MUST hold here, too, since CanvasHelper only contains a
             raw pointer (without refcounting)
diff -rup canvas-orig/source/cairo/cairo_canvashelper.cxx canvas/source/cairo/cairo_canvashelper.cxx
--- canvas-orig/source/cairo/cairo_canvashelper.cxx     2007-08-21 13:19:18.000000000 +0200
+++ canvas/source/cairo/cairo_canvashelper.cxx  2007-10-24 13:30:52.000000000 +0200
@@ -668,15 +673,28 @@ namespace cairocanvas
 		return pSurface;
     }
 
-    static void addColorStop( Pattern* pPattern, double nOffset, const uno::Sequence< double >& rColor )
+    static void addColorStops( Pattern* pPattern, const uno::Sequence< uno::Sequence< double > >& rColors, const uno::Sequence< double >& rStops, bool bReverseStops = false )
     {
-	if( rColor.getLength() == 3 )
-	    cairo_pattern_add_color_stop_rgb( pPattern, nOffset, rColor[0], rColor[1], rColor[2] );
-	else if( rColor.getLength() == 4 )
-	    cairo_pattern_add_color_stop_rgba( pPattern, nOffset, rColor[0], rColor[1], rColor[2], rColor[3] );
+        float stop;
+        int i;
+
+        OSL_ASSERT( rColors.getLength() == rStops.getLength() );
+
+        for( i = 0; i < rColors.getLength(); i++ ) {
+            const uno::Sequence< double >& rColor( rColors[i] );
+            stop = bReverseStops ? 1 - rStops[i] : rStops[i];
+            if( rColor.getLength() == 3 )
+                cairo_pattern_add_color_stop_rgb( pPattern, stop, rColor[0], rColor[1], rColor[2] );
+            else if( rColor.getLength() == 4 ) {
+                double alpha = rColor[3];
+                // cairo expects premultiplied alpha
+                cairo_pattern_add_color_stop_rgba( pPattern, stop, rColor[0]*alpha, rColor[1]*alpha, rColor[2]*alpha, alpha );
+                //cairo_pattern_add_color_stop_rgba( pPattern, stop, rColor[0], rColor[1], rColor[2], alpha );
+            }
+        }
     }
 
-    static Pattern* patternFromParametricPolyPolygon( ::canvas::ParametricPolyPolygon& rPolygon, Matrix& rMatrix )
+    static Pattern* patternFromParametricPolyPolygon( ::canvas::ParametricPolyPolygon& rPolygon )
     {
 	Pattern* pPattern = NULL;
 	const ::canvas::ParametricPolyPolygon::Values aValues = rPolygon.getValues();
@@ -693,11 +711,8 @@ namespace cairocanvas
 	    y0 = 0;
 	    x1 = 1;
 	    y1 = 0;
-	    cairo_matrix_transform_point( &rMatrix, &x0, &y0 );
-	    cairo_matrix_transform_point( &rMatrix, &x1, &y1 );
 	    pPattern = cairo_pattern_create_linear( x0, y0, x1, y1 );
-	    addColorStop( pPattern, 0, aValues.maColor1 );
-	    addColorStop( pPattern, 1, aValues.maColor2 );
+	    addColorStops( pPattern, aValues.maColors, aValues.maStops );
 	    break;
 
 	// FIXME: NYI
@@ -707,12 +722,8 @@ namespace cairocanvas
 	    y0 = 0;
 	    x1 = 1;
 	    y1 = 0;
-	    cairo_matrix_transform_point( &rMatrix, &x0, &y0 );
-	    cairo_matrix_transform_point( &rMatrix, &x1, &y1 );
 	    pPattern = cairo_pattern_create_linear( x0, y0, x1, y1 );
-	    addColorStop( pPattern, 0, aValues.maColor1 );
-	    addColorStop( pPattern, 0.5, aValues.maColor2 );
-	    addColorStop( pPattern, 1, aValues.maColor1 );
+	    addColorStops( pPattern, aValues.maColors, aValues.maStops );
 	    break;
 
 	case ::canvas::ParametricPolyPolygon::GRADIENT_ELLIPTICAL:
@@ -722,16 +733,21 @@ namespace cairocanvas
 	    r1 = 0.5;
 	    Matrix aScaleMatrix;
 
-	    cairo_matrix_transform_point( &rMatrix, &cx, &cy );
-	    cairo_matrix_transform_distance( &rMatrix, &r0, &r1 );
 	    pPattern = cairo_pattern_create_radial( cx, cy, r0, cx, cy, r1 );
-	    addColorStop( pPattern, 0, aValues.maColor1 );
-	    addColorStop( pPattern, 1, aValues.maColor2 );
+	    addColorStops( pPattern, aValues.maColors, aValues.maStops, true );
 
-	    if( ! ::rtl::math::approxEqual( aValues.mnAspectRatio, 1 ) ) {
-		cairo_matrix_init_scale( &aScaleMatrix, 1, aValues.mnAspectRatio );
-		cairo_pattern_set_matrix( pPattern, &aScaleMatrix );
-	    }
+        // looks like aspect ratio is already handled in the texture matrix
+// 	    if( ! ::rtl::math::approxEqual( aValues.mnAspectRatio, 1 ) ) {
+// 			OSL_TRACE( "elliptical gradient aspect ratio: %f", aValues.mnAspectRatio );
+//             cairo_matrix_init_translate ( &aScaleMatrix, -0.5, -0.5 );
+//             if (aValues.mnAspectRatio > 1)
+//                 cairo_matrix_scale( &aScaleMatrix, 1,
+//             1/aValues.mnAspectRatio ); else
+//                 cairo_matrix_scale( &aScaleMatrix, aValues.mnAspectRatio, 1 );
+//             cairo_matrix_translate ( &aScaleMatrix, 0.5, 0.5 );
+
+//             cairo_pattern_set_matrix( pPattern, &aScaleMatrix );
+// 	    }
 	    break;
 	}
 
@@ -831,13 +847,14 @@ namespace cairocanvas
 			cairo_matrix_init( &aTextureMatrix,
 					   aTransform.m00, aTransform.m10, aTransform.m01,
 					   aTransform.m11, aTransform.m02, aTransform.m12);
-			Pattern* pPattern = patternFromParametricPolyPolygon( *pPolyImpl, aTextureMatrix );
+			Pattern* pPattern = patternFromParametricPolyPolygon( *pPolyImpl );
 
 			if( pPattern ) {
 			    OSL_TRACE( "filling with pattern\n" );
 
 			    cairo_save( pCairo );
 
+                cairo_transform( pCairo, &aTextureMatrix );
 			    cairo_set_source( pCairo, pPattern );
 			    cairo_fill( pCairo );
 			    cairo_restore( pCairo );
diff -rup canvas-orig/source/tools/parametricpolypolygon.cxx canvas/source/tools/parametricpolypolygon.cxx
--- canvas-orig/source/tools/parametricpolypolygon.cxx	2007-08-21 13:19:19.000000000 +0200
+++ canvas/source/tools/parametricpolypolygon.cxx	2007-09-06 16:12:37.000000000 +0200
@@ -60,22 +60,22 @@ namespace canvas
 {
     ParametricPolyPolygon* ParametricPolyPolygon::createLinearHorizontalGradient( 
         const uno::Reference< rendering::XGraphicDevice >& 	rDevice,
-        const uno::Sequence< double >& 						leftColor, 
-        const uno::Sequence< double >& 						rightColor )
+        const uno::Sequence< uno::Sequence< double > >&		colors, 
+        const uno::Sequence< double >& 						stops )
     {
         // TODO(P2): hold gradient brush statically, and only setup
         // the colors
-        return new ParametricPolyPolygon( rDevice, GRADIENT_LINEAR, leftColor, rightColor );
+        return new ParametricPolyPolygon( rDevice, GRADIENT_LINEAR, colors, stops );
     }
 
     ParametricPolyPolygon* ParametricPolyPolygon::createAxialHorizontalGradient( 
         const uno::Reference< rendering::XGraphicDevice >& 	rDevice,
-        const uno::Sequence< double >& 						middleColor, 
-        const uno::Sequence< double >& 						endColor )
+        const uno::Sequence< uno::Sequence< double > >&		colors, 
+        const uno::Sequence< double >& 						stops )
     {
         // TODO(P2): hold gradient brush statically, and only setup
         // the colors
-        return new ParametricPolyPolygon( rDevice, GRADIENT_AXIAL, endColor, middleColor );
+        return new ParametricPolyPolygon( rDevice, GRADIENT_AXIAL, colors, stops );
     }
 
     namespace
@@ -91,8 +91,8 @@ namespace canvas
 
     ParametricPolyPolygon* ParametricPolyPolygon::createEllipticalGradient( 
         const uno::Reference< rendering::XGraphicDevice >& 	rDevice,
-        const uno::Sequence< double >& 						centerColor, 
-        const uno::Sequence< double >& 						endColor,
+        const uno::Sequence< uno::Sequence< double > >&		colors, 
+        const uno::Sequence< double >& 						stops,
         const geometry::RealRectangle2D&					boundRect )
     {
         // TODO(P2): hold gradient polygon statically, and only setup
@@ -102,13 +102,13 @@ namespace canvas
             ::basegfx::tools::createPolygonFromCircle( 
                 ::basegfx::B2DPoint( 0.5, 0.5), 0.5 ),
             GRADIENT_ELLIPTICAL,
-            endColor, centerColor,
+            colors, stops,
             calcAspectRatio( boundRect ) );
     }
 
     ParametricPolyPolygon* ParametricPolyPolygon::createRectangularGradient( const uno::Reference< rendering::XGraphicDevice >& rDevice,
-                                                                             const uno::Sequence< double >& 					centerColor, 
-                                                                             const uno::Sequence< double >& 					endColor,
+                                                                             const uno::Sequence< uno::Sequence< double > >&	colors, 
+                                                                             const uno::Sequence< double >& 					stops,
                                                                              const geometry::RealRectangle2D&					boundRect )
     {
         // TODO(P2): hold gradient polygon statically, and only setup
@@ -118,7 +118,7 @@ namespace canvas
             ::basegfx::tools::createPolygonFromRect( 
                 ::basegfx::B2DRectangle( 0.0, 0.0, 1.0, 1.0 ) ),
             GRADIENT_RECTANGULAR,
-            endColor, centerColor,
+            colors, stops,
             calcAspectRatio( boundRect ) );
     }
 
@@ -188,13 +188,13 @@ namespace canvas
     ParametricPolyPolygon::ParametricPolyPolygon( const uno::Reference< rendering::XGraphicDevice >& 	rDevice,
                                                   const ::basegfx::B2DPolygon&							rGradientPoly,
                                                   GradientType                                          eType,
-                                                  const ::com::sun::star::uno::Sequence< double >&		rColor1,
-                                                  const ::com::sun::star::uno::Sequence< double >&		rColor2 ) :
+                                                  const uno::Sequence< uno::Sequence< double > >&		rColors, 
+                                                  const uno::Sequence< double >& 						rStops ) :
         ParametricPolyPolygon_Base( m_aMutex ),
         mxDevice( rDevice ),
         maValues( rGradientPoly,
-                  rColor1,
-                  rColor2,
+                  rColors,
+                  rStops,
                   1.0,
                   eType )
     {
@@ -203,14 +203,14 @@ namespace canvas
     ParametricPolyPolygon::ParametricPolyPolygon( const uno::Reference< rendering::XGraphicDevice >& 	rDevice,
                                                   const ::basegfx::B2DPolygon&							rGradientPoly,
                                                   GradientType                                          eType,
-                                                  const ::com::sun::star::uno::Sequence< double >&		rColor1,
-                                                  const ::com::sun::star::uno::Sequence< double >&		rColor2,
+                                                  const uno::Sequence< uno::Sequence< double > >&		rColors, 
+                                                  const uno::Sequence< double >& 						rStops,
                                                   double												nAspectRatio ) :
         ParametricPolyPolygon_Base( m_aMutex ),        
         mxDevice( rDevice ),
         maValues( rGradientPoly,
-                  rColor1,
-                  rColor2,
+                  rColors,
+                  rStops,
                   nAspectRatio,
                   eType )
     {
@@ -218,13 +218,13 @@ namespace canvas
 
     ParametricPolyPolygon::ParametricPolyPolygon( const uno::Reference< rendering::XGraphicDevice >& 	rDevice,
                                                   GradientType	 										eType,
-                                                  const ::com::sun::star::uno::Sequence< double >&		rColor1,
-                                                  const ::com::sun::star::uno::Sequence< double >&		rColor2 ) :
+                                                  const uno::Sequence< uno::Sequence< double > >&		rColors, 
+                                                  const uno::Sequence< double >& 						rStops ) :
         ParametricPolyPolygon_Base( m_aMutex ),        
         mxDevice( rDevice ),
         maValues( ::basegfx::B2DPolygon(),
-                  rColor1,
-                  rColor2, 
+                  rColors,
+                  rStops, 
                   1.0,
                   eType )
     {
diff -rup canvas-orig/source/vcl/canvasbitmap.cxx canvas/source/vcl/canvasbitmap.cxx
--- canvas-orig/source/vcl/canvasbitmap.cxx	2007-08-21 13:19:20.000000000 +0200
+++ canvas/source/vcl/canvasbitmap.cxx	2007-10-24 12:55:39.000000000 +0200
@@ -145,4 +145,15 @@ namespace vclcanvas
 
         return maCanvasHelper.repaint( rGrf, rPt, rSz, rAttr );
     }
+
+    ::com::sun::star::uno::Any CanvasBitmap::getFastPropertyValue( sal_Int32 nHandle )  throw (::com::sun::star::uno::RuntimeException)
+    {
+        if( nHandle == 0 ) {
+            BitmapEx* pBitmapEx = new BitmapEx( getBitmap() );
+
+            return ::com::sun::star::uno::Any( reinterpret_cast<sal_Int64>( pBitmapEx ) );
+        }
+
+        return ::com::sun::star::uno::Any( sal_Int32( 0 ) );
+    }
 }
Only in canvas/source/vcl: canvasbitmap.cxx.~1.8.~
diff -rup canvas-orig/source/vcl/canvasbitmap.hxx canvas/source/vcl/canvasbitmap.hxx
--- canvas-orig/source/vcl/canvasbitmap.hxx	2007-08-21 13:19:20.000000000 +0200
+++ canvas/source/vcl/canvasbitmap.hxx	2007-10-24 13:07:32.000000000 +0200
@@ -36,11 +36,12 @@
 #ifndef _VCLCANVAS_CANVASBITMAP_HXX
 #define _VCLCANVAS_CANVASBITMAP_HXX
 
-#include <cppuhelper/compbase3.hxx>
+#include <cppuhelper/compbase4.hxx>
 
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/rendering/XBitmapCanvas.hpp>
 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
+#include <com/sun/star/beans/XFastPropertySet.hpp>
 
 #include <vcl/virdev.hxx>
 #include <vcl/bitmapex.hxx>
@@ -59,9 +60,10 @@
 
 namespace vclcanvas
 {
-    typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::rendering::XBitmapCanvas,
+    typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::rendering::XBitmapCanvas,
 			                         		  ::com::sun::star::rendering::XIntegerBitmap,
-                         			 		  ::com::sun::star::lang::XServiceInfo >  	CanvasBitmapBase_Base;
+                         			 		  ::com::sun::star::lang::XServiceInfo,
+                                              ::com::sun::star::beans::XFastPropertySet >  	CanvasBitmapBase_Base;
     typedef ::canvas::IntegerBitmapBase< ::canvas::BaseMutexHelper< CanvasBitmapBase_Base >, 
                                          CanvasBitmapHelper, 
                                          tools::LocalGuard,
@@ -107,6 +109,19 @@ namespace vclcanvas
         /// Not threadsafe! Returned object is shared!
         BitmapEx getBitmap() const;

+        // XFastPropertySet
+        // used to retrieve BitmapEx pointer or X Pixmap handles for this bitmap
+        // handle values have these meanings:
+        // 0 ... get pointer to BitmapEx
+        // 1 ... get X pixmap handle to rgb content
+        // 2 ... get X pitmap handle to alpha mask
+        // returned any contains either BitmapEx pointer or array of three Any value
+        //     1st a bool value: true - free the pixmap after used by XFreePixmap, false do nothing, the pixmap is used internally in the canvas
+        //     2nd the pixmap handle
+        //     3rd the pixmap depth
+        virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue(sal_Int32 nHandle)  throw (::com::sun::star::uno::RuntimeException);
+        virtual void SAL_CALL setFastPropertyValue(sal_Int32 nHandle, const ::com::sun::star::uno::Any&)  throw (::com::sun::star::uno::RuntimeException) {}
+
     private:
         /** MUST hold here, too, since CanvasHelper only contains a
             raw pointer (without refcounting)
diff -rup canvas-orig/source/vcl/canvashelper_texturefill.cxx canvas/source/vcl/canvashelper_texturefill.cxx
--- canvas-orig/source/vcl/canvashelper_texturefill.cxx	2007-08-21 13:19:20.000000000 +0200
+++ canvas/source/vcl/canvashelper_texturefill.cxx	2007-09-14 16:28:32.000000000 +0200
@@ -832,12 +832,13 @@ namespace vclcanvas
                     const ::canvas::ParametricPolyPolygon::Values& rValues(
                         pGradient->getValues() );
 
+                    // TODO: use all the colors and place them on given positions/stops
                     const ::Color aColor1( 
                         ::vcl::unotools::sequenceToColor( mpDevice,
-                                                          rValues.maColor1 ) );
+                                                          rValues.maColors [0] ) );
                     const ::Color aColor2( 
                         ::vcl::unotools::sequenceToColor( mpDevice,
-                                                          rValues.maColor2 ) );
+                                                          rValues.maColors [rValues.maColors.getLength () - 1] ) );
 
                     // TODO(E1): Return value
                     // TODO(F1): FillRule
--- canvas-bak/source/cairo/cairo_canvashelper.hxx      2007-10-29 20:07:45.000000000 +0100
+++ canvas/source/cairo/cairo_canvashelper.hxx  2007-10-30 10:12:33.000000000 +0100
@@ -324,6 +324,7 @@
                ::cairo::Cairo* mpCairo;
                ::cairo::Surface* mpSurface;
                SurfaceProvider* mpSurfaceProvider;
+    public:
         ::basegfx::B2ISize maSize;
     };

--- canvas-orig/source/cairo/cairo_canvasbitmap.cxx	2007-08-21 13:19:18.000000000 +0200
+++ canvas/source/cairo/cairo_canvasbitmap.cxx	2007-11-01 13:57:20.000000000 +0100
@@ -96,6 +96,67 @@
 		return maCanvasHelper.repaint( pSurface, viewState, renderState );
     }
 
+    ::com::sun::star::uno::Any CanvasBitmap::getFastPropertyValue( sal_Int32 nHandle )  throw (::com::sun::star::uno::RuntimeException)
+    {
+        ::com::sun::star::uno::Any aRV( sal_Int32(0) );
+        // 0 ... get BitmapEx
+        // 1 ... get Pixbuf with bitmap RGB content
+        // 2 ... get Pixbuf with bitmap alpha mask
+        switch( nHandle ) {
+        case 0:
+            aRV = ::com::sun::star::uno::Any( reinterpret_cast<sal_Int64>( (BitmapEx*) NULL ) );
+            break;
+        case 1: {
+#ifdef CAIRO_HAS_XLIB_SURFACE
+        ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > args( 3 );
+        args[0] = ::com::sun::star::uno::Any( false );  // do not call XFreePixmap on it
+        args[1] = ::com::sun::star::uno::Any( mpBufferSurface->getPixmap () );
+        args[2] = ::com::sun::star::uno::Any( sal_Int32( mpBufferSurface->getDepth () ) );
+
+        aRV = ::com::sun::star::uno::Any( args );
+#endif
+        }
+        break;
+        case 2: {
+#ifdef CAIRO_HAS_XLIB_SURFACE
+        ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > args( 3 );
+        Surface* pSurface = mpDevice->getSurface( maCanvasHelper.maSize, CAIRO_CONTENT_COLOR_ALPHA );
+        Surface* pAlphaSurface = mpDevice->getSurface( maCanvasHelper.maSize, CAIRO_CONTENT_ALPHA );
+        Cairo* pCairo = pSurface->getCairo();
+        Cairo* pAlphaCairo = pAlphaSurface->getCairo();
+
+        // create RGB image (levels of gray) of alpha channel of original picture
+        cairo_set_source_surface( pAlphaCairo, mpBufferSurface->mpSurface, 0, 0 );
+        cairo_set_operator( pAlphaCairo, CAIRO_OPERATOR_SOURCE );
+        cairo_paint( pAlphaCairo );
+        cairo_destroy( pAlphaCairo );
+
+        cairo_set_source_rgba(pCairo, 1, 1, 1, 1 );
+        cairo_set_operator( pCairo, CAIRO_OPERATOR_SOURCE );
+        cairo_paint( pCairo );
+        cairo_set_source_surface( pCairo, pAlphaSurface->mpSurface, 0, 0 );
+        cairo_set_operator( pCairo, CAIRO_OPERATOR_OVER );
+        cairo_paint( pCairo );
+
+        delete pAlphaSurface;
+        cairo_destroy( pCairo );
+        pSurface->doNotFreePixmap();
+        args[0] = ::com::sun::star::uno::Any( true );
+        args[1] = ::com::sun::star::uno::Any( pSurface->getPixmap () );
+        args[2] = ::com::sun::star::uno::Any( sal_Int32( pSurface->getDepth () ) );
+        delete pSurface;
+
+        // return pixmap and alphachannel pixmap - it will be used in BitmapEx
+        aRV = ::com::sun::star::uno::Any( args );
+#endif
+        }
+        break;
+        }
+
+        return aRV;
+
+    }
+
 #define IMPLEMENTATION_NAME "CairoCanvas.CanvasBitmap"
 #define SERVICE_NAME "com.sun.star.rendering.CanvasBitmap"
 
