27#include <com/sun/star/rendering/XGraphicDevice.hpp>
29#include <parametricpolypolygon.hxx>
38 return {
"LinearGradient",
40 "RectangularGradient"};
44 const uno::Reference< rendering::XGraphicDevice >& rDevice,
45 std::u16string_view rServiceName,
46 const uno::Sequence< uno::Any >& rArgs )
48 double fAspectRatio=1.0;
51 uno::Sequence< uno::Sequence< double > > colorSequence{
52 rDevice->getDeviceColorSpace()->convertFromRGB({ rendering::RGBColor(0,0,0) }),
53 rDevice->getDeviceColorSpace()->convertFromRGB({ rendering::RGBColor(1,1,1) })
55 uno::Sequence< double > colorStops{ 0, 1 };
60 beans::PropertyValue aProp;
63 if ( aProp.Name ==
"Colors" )
65 aProp.Value >>= colorSequence;
67 else if ( aProp.Name ==
"Stops" )
69 aProp.Value >>= colorStops;
71 else if ( aProp.Name ==
"AspectRatio" )
73 aProp.Value >>= fAspectRatio;
78 if ( rServiceName ==
u"LinearGradient" )
82 else if ( rServiceName ==
u"EllipticalGradient" )
86 else if ( rServiceName ==
u"RectangularGradient" )
90 else if ( rServiceName ==
u"VerticalLineHatch" )
94 else if ( rServiceName ==
u"OrthogonalLinesHatch" )
98 else if ( rServiceName ==
u"ThreeCrossingLinesHatch" )
102 else if ( rServiceName ==
u"FourCrossingLinesHatch" )
111 const uno::Reference< rendering::XGraphicDevice >& rDevice,
112 const uno::Sequence< uno::Sequence< double > >& colors,
113 const uno::Sequence< double >& stops )
121 const uno::Reference< rendering::XGraphicDevice >& rDevice,
122 const uno::Sequence< uno::Sequence< double > >& colors,
123 const uno::Sequence< double >& stops,
124 double fAspectRatio )
130 ::basegfx::utils::createPolygonFromCircle(
133 colors, stops, fAspectRatio );
137 const uno::Sequence< uno::Sequence< double > >& colors,
138 const uno::Sequence< double >& stops,
139 double fAspectRatio )
145 ::basegfx::utils::createPolygonFromRect(
148 colors, stops, fAspectRatio );
159 return uno::Reference< rendering::XPolyPolygon2D >();
165 return uno::Sequence< double >();
171 return uno::Sequence< double >();
176 std::unique_lock aGuard(
m_aMutex );
178 return mxDevice.is() ?
mxDevice->getDeviceColorSpace() : uno::Reference< rendering::XColorSpace >();
184 return "Canvas::ParametricPolyPolygon";
194 return {
"com.sun.star.rendering.ParametricPolyPolygon" };
202 const ::basegfx::B2DPolygon& rGradientPoly,
204 const uno::Sequence< uno::Sequence< double > >& rColors,
205 const uno::Sequence< double >& rStops,
206 double nAspectRatio ) :
207 mxDevice(
std::move( xDevice )),
218 const uno::Sequence< uno::Sequence< double > >& rColors,
219 const uno::Sequence< double >& rStops ) :
220 mxDevice(
std::move( xDevice )),
231 std::unique_lock aGuard(
m_aMutex );
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual css::uno::Reference< css::rendering::XPolyPolygon2D > SAL_CALL getOutline(double t) override
Values getValues() const
Query all defining values of this object atomically.
static rtl::Reference< ParametricPolyPolygon > create(const css::uno::Reference< css::rendering::XGraphicDevice > &rDevice, std::u16string_view rServiceName, const css::uno::Sequence< css::uno::Any > &rArgs)
virtual OUString SAL_CALL getImplementationName() override
css::uno::Reference< css::rendering::XGraphicDevice > mxDevice
virtual css::uno::Sequence< double > SAL_CALL getPointColor(const css::geometry::RealPoint2D &point) override
static rtl::Reference< ParametricPolyPolygon > createEllipticalGradient(const css::uno::Reference< css::rendering::XGraphicDevice > &rDevice, const css::uno::Sequence< css::uno::Sequence< double > > &colors, const css::uno::Sequence< double > &stops, double fAspect)
virtual css::uno::Sequence< double > SAL_CALL getColor(double t) override
virtual void disposing(std::unique_lock< std::mutex > &) override
Dispose all internal references.
static rtl::Reference< ParametricPolyPolygon > createLinearHorizontalGradient(const css::uno::Reference< css::rendering::XGraphicDevice > &rDevice, const css::uno::Sequence< css::uno::Sequence< double > > &colors, const css::uno::Sequence< double > &stops)
virtual css::uno::Reference< css::rendering::XColorSpace > SAL_CALL getColorSpace() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
static css::uno::Sequence< OUString > getAvailableServiceNames()
static rtl::Reference< ParametricPolyPolygon > createRectangularGradient(const css::uno::Reference< css::rendering::XGraphicDevice > &rDevice, const css::uno::Sequence< css::uno::Sequence< double > > &colors, const css::uno::Sequence< double > &stops, double fAspect)
virtual ~ParametricPolyPolygon() override
const Values maValues
All defining values of this object.
ParametricPolyPolygon(const ParametricPolyPolygon &)=delete
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
Structure of defining values for the ParametricPolyPolygon.