summaryrefslogtreecommitdiff
path: root/canvas/inc/canvas
diff options
context:
space:
mode:
authorthb <thb@openoffice.org>2009-10-16 00:43:16 +0200
committerthb <thb@openoffice.org>2009-10-16 00:43:16 +0200
commit1837a267a2cf82b0152631e416d8be66c2adef25 (patch)
treee9df5704754fc1ed559cdc01d7d5c41207af5374 /canvas/inc/canvas
parent9b9d44ee50a38180c2451ca527bf7b9f6f46f0fe (diff)
#i105937# Much improved gradient support for canvas/basegfx/drawinglayer.
See http://blog.thebehrens.net/2009/07/28/hackweek-iv-canvas-convwatch/ for more background information
Diffstat (limited to 'canvas/inc/canvas')
-rw-r--r--canvas/inc/canvas/base/graphicdevicebase.hxx82
-rw-r--r--canvas/inc/canvas/canvastools.hxx22
-rw-r--r--canvas/inc/canvas/parametricpolypolygon.hxx40
3 files changed, 34 insertions, 110 deletions
diff --git a/canvas/inc/canvas/base/graphicdevicebase.hxx b/canvas/inc/canvas/base/graphicdevicebase.hxx
index d0cd621f65a2..1105fea55eab 100644
--- a/canvas/inc/canvas/base/graphicdevicebase.hxx
+++ b/canvas/inc/canvas/base/graphicdevicebase.hxx
@@ -33,11 +33,11 @@
#include <rtl/ref.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/util/XUpdatable.hpp>
#include <com/sun/star/rendering/XGraphicDevice.hpp>
#include <com/sun/star/rendering/XColorSpace.hpp>
-#include <com/sun/star/rendering/XParametricPolyPolygon2DFactory.hpp>
#include <canvas/parametricpolypolygon.hxx>
#include <canvas/propertysethelper.hxx>
@@ -50,8 +50,7 @@ namespace canvas
/** Helper template base class for XGraphicDevice implementations.
This base class provides partial implementations of the
- XGraphicDevice-related interface, such as
- XParametricPolyPolygon2DFactory and XColorSpace.
+ XGraphicDevice-related interface, such as XColorSpace.
This template basically interposes itself between the full
interface you implement (i.e. not restricted to XGraphicDevice
@@ -249,7 +248,7 @@ namespace canvas
return maDeviceHelper.createVolatileAlphaBitmap( this, size );
}
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2DFactory > SAL_CALL getParametricPolyPolygonFactory( ) throw (::com::sun::star::uno::RuntimeException)
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > SAL_CALL getParametricPolyPolygonFactory( ) throw (::com::sun::star::uno::RuntimeException)
{
return this;
}
@@ -268,79 +267,26 @@ namespace canvas
return maDeviceHelper.enterFullScreenMode( bEnter );
}
- // XParametricPolyPolygon2DFactory
- 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)
+ // XMultiServiceFactory
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& aServiceSpecifier ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
{
return ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D >(
- ParametricPolyPolygon::createLinearHorizontalGradient( this,
- colors,
- stops ) );
+ ParametricPolyPolygon::create(this,
+ aServiceSpecifier,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >()));
}
- 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)
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::rtl::OUString& aServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
{
return ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D >(
- ParametricPolyPolygon::createAxialHorizontalGradient( this,
- colors,
- stops ) );
+ ParametricPolyPolygon::create(this,
+ aServiceSpecifier,
+ Arguments));
}
- 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)
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames( ) throw (::com::sun::star::uno::RuntimeException)
{
- return ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D >(
- ParametricPolyPolygon::createEllipticalGradient( this,
- colors,
- stops,
- boundRect ) );
- }
-
- 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,
- colors,
- stops,
- boundRect ) );
- }
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createVerticalLinesHatch( const ::com::sun::star::uno::Sequence< double >& /*leftColor*/,
- const ::com::sun::star::uno::Sequence< double >& /*rightColor*/ ) throw (::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::uno::RuntimeException)
- {
- // TODO(F1): hatch factory NYI
- return ::com::sun::star::uno::Reference<
- ::com::sun::star::rendering::XParametricPolyPolygon2D >();
- }
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createOrthogonalLinesHatch( const ::com::sun::star::uno::Sequence< double >& /*leftTopColor*/,
- const ::com::sun::star::uno::Sequence< double >& /*rightBottomColor*/ ) throw (::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::uno::RuntimeException)
- {
- // TODO(F1): hatch factory NYI
- return ::com::sun::star::uno::Reference<
- ::com::sun::star::rendering::XParametricPolyPolygon2D >();
- }
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createThreeCrossingLinesHatch( const ::com::sun::star::uno::Sequence< double >& /*startColor*/,
- const ::com::sun::star::uno::Sequence< double >& /*endColor*/ ) throw (::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::uno::RuntimeException)
- {
- // TODO(F1): hatch factory NYI
- return ::com::sun::star::uno::Reference<
- ::com::sun::star::rendering::XParametricPolyPolygon2D >();
- }
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createFourCrossingLinesHatch( const ::com::sun::star::uno::Sequence< double >& /*startColor*/,
- const ::com::sun::star::uno::Sequence< double >& /*endColor*/ ) throw (::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::uno::RuntimeException)
- {
- // TODO(F1): hatch factory NYI
- return ::com::sun::star::uno::Reference<
- ::com::sun::star::rendering::XParametricPolyPolygon2D >();
+ return ParametricPolyPolygon::getAvailableServiceNames();
}
diff --git a/canvas/inc/canvas/canvastools.hxx b/canvas/inc/canvas/canvastools.hxx
index 3942ab2726ef..345bcd9187ae 100644
--- a/canvas/inc/canvas/canvastools.hxx
+++ b/canvas/inc/canvas/canvastools.hxx
@@ -417,28 +417,6 @@ namespace canvas
*/
::basegfx::B2IRange spritePixelAreaFromB2DRange( const ::basegfx::B2DRange& rRange );
- /** This method clamps the given value to the specified range
-
- @param val
- The value to clamp
-
- @param minVal
- The minimal value val is allowed to attain
-
- @param maxVal
- The maximal value val is allowed to attain
-
- @return the clamped value
- */
- template< typename T > T clamp( T val,
- T minVal,
- T maxVal )
- {
- return ::std::max( minVal,
- ::std::min( maxVal,
- val ) );
- }
-
/** Retrieve various internal properties of the actual canvas implementation.
This method retrieves a bunch of internal, implementation-
diff --git a/canvas/inc/canvas/parametricpolypolygon.hxx b/canvas/inc/canvas/parametricpolypolygon.hxx
index 9d0883192094..b93f1c27a682 100644
--- a/canvas/inc/canvas/parametricpolypolygon.hxx
+++ b/canvas/inc/canvas/parametricpolypolygon.hxx
@@ -33,7 +33,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/rendering/XGraphicDevice.hpp>
-#include <com/sun/star/rendering/XParametricPolyPolygon2DFactory.hpp>
+#include <com/sun/star/rendering/XParametricPolyPolygon2D.hpp>
#include <cppuhelper/compbase2.hxx>
#include <comphelper/broadcasthelper.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
@@ -62,7 +62,6 @@ namespace canvas
enum GradientType
{
GRADIENT_LINEAR,
- GRADIENT_AXIAL,
GRADIENT_ELLIPTICAL,
GRADIENT_RECTANGULAR
};
@@ -103,24 +102,11 @@ namespace canvas
const GradientType meType;
};
- static ParametricPolyPolygon* createLinearHorizontalGradient( const ::com::sun::star::uno::Reference<
- ::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 );
- static ParametricPolyPolygon* createAxialHorizontalGradient( const ::com::sun::star::uno::Reference<
- ::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 );
- static ParametricPolyPolygon* createEllipticalGradient( const ::com::sun::star::uno::Reference<
- ::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< ::com::sun::star::uno::Sequence< double > >& colors,
- const ::com::sun::star::uno::Sequence< double >& stops,
- const ::com::sun::star::geometry::RealRectangle2D& boundRect );
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > getAvailableServiceNames();
+ static ParametricPolyPolygon* create(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice,
+ const ::rtl::OUString& rServiceName,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rArgs );
/// Dispose all internal references
virtual void SAL_CALL disposing();
@@ -143,6 +129,20 @@ namespace canvas
~ParametricPolyPolygon(); // we're a ref-counted UNO class. _We_ destroy ourselves.
private:
+ static ParametricPolyPolygon* createLinearHorizontalGradient( const ::com::sun::star::uno::Reference<
+ ::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 );
+ static ParametricPolyPolygon* createEllipticalGradient( const ::com::sun::star::uno::Reference<
+ ::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,
+ double fAspect );
+ static ParametricPolyPolygon* createRectangularGradient( const ::com::sun::star::uno::Reference<
+ ::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,
+ double fAspect );
/// Private, because objects can only be created from the static factories
ParametricPolyPolygon( const ::com::sun::star::uno::Reference<