23#include <com/sun/star/awt/Rectangle.hpp>
24#include <com/sun/star/lang/NoSupportException.hpp>
25#include <osl/mutex.hxx>
33using namespace ::
cairo;
39 const uno::Reference< uno::XComponentContext >& ) :
44 void Canvas::initialize()
47 if( !maArguments.hasElements() )
59 SAL_INFO(
"canvas.cairo",
"Canvas created " <<
this);
62 maArguments[0].getValueTypeClass() == uno::TypeClass_HYPER &&
63 maArguments[4].getValueTypeClass() == uno::TypeClass_SEQUENCE,
64 "Canvas::initialize: wrong number of arguments, or wrong types" );
69 maArguments[0] >>= nPtr;
72 "Canvas::initialize: invalid OutDev pointer" );
74 awt::Rectangle aBounds;
75 maArguments[1] >>= aBounds;
77 uno::Sequence<sal_Int8>
aSeq;
78 maArguments[4] >>=
aSeq;
81 if( !pSysData || !pSysData->
nSize )
82 throw lang::NoSupportException(
"Passed SystemGraphicsData invalid!" );
88 maDeviceHelper.init( *
this, *pOutDev );
90 maCanvasHelper.init(
basegfx::B2ISize(aBounds.Width, aBounds.Height), *
this,
this );
93 maCanvasHelper.setSurface( maDeviceHelper.getSurface(),
false );
95 maArguments.realloc(0);
100 SAL_INFO(
"canvas.cairo",
"CairoCanvas destroyed" );
103 void Canvas::disposeThis()
105 ::osl::MutexGuard aGuard(
m_aMutex );
108 CanvasBaseT::disposeThis();
111 OUString SAL_CALL Canvas::getServiceName( )
113 return "com.sun.star.rendering.Canvas.Cairo";
117 sal_Bool Canvas::supportsService(
const OUString& sServiceName)
122 OUString Canvas::getImplementationName()
124 return "com.sun.star.comp.rendering.Canvas.Cairo";
126 css::uno::Sequence< OUString > Canvas::getSupportedServiceNames()
128 return { getServiceName() };
132 const rendering::ViewState& viewState,
133 const rendering::RenderState& renderState )
135 return maCanvasHelper.repaint( pSurface, viewState, renderState );
140 return maDeviceHelper.getSurface();
145 return maDeviceHelper.createSurface( rSize, aContent );
156 pSurface = maDeviceHelper.createSurface(
aData, rSize );
170 return maDeviceHelper.getOutputDevice();
174extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
176 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any>
const& args)
181 }
catch (css::uno::Exception&) {
185 return cppu::acquire(
p.get());
constexpr OUStringLiteral sServiceName
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_rendering_Canvas_Cairo_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &args)
Size GetSizePixel() const
bool GetSystemData(BitmapSystemData &rData) const
bool SupportsCairo() const
Product of this component's factory.
Canvas(const css::uno::Sequence< css::uno::Any > &aArguments, const css::uno::Reference< css::uno::XComponentContext > &rxContext)
#define ENSURE_ARG_OR_THROW(c, m)
Sequence< PropertyValue > aArguments
Sequence< sal_Int8 > aSeq
#define SAL_INFO(area, stream)
constexpr OUStringLiteral aData
VCL_DLLPUBLIC bool isVCLSkiaEnabled()
std::shared_ptr< Surface > SurfaceSharedPtr
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)