33using namespace ::
cairo;
40 rendering::XGraphicDevice* pDevice,
42 mpSurfaceProvider(
std::move( rSurfaceProvider )),
47 "CanvasBitmap::CanvasBitmap(): Invalid surface or device" );
51 "bitmap size: " << rSize.getWidth() <<
"x" << rSize.getHeight());
53 mpBufferSurface = mpSurfaceProvider->createSurface( rSize, bHasAlpha ? CAIRO_CONTENT_COLOR_ALPHA : CAIRO_CONTENT_COLOR );
54 mpBufferCairo = mpBufferSurface->getCairo();
56 maCanvasHelper.init( rSize, *mpSurfaceProvider, pDevice );
57 maCanvasHelper.setSurface( mpBufferSurface, bHasAlpha );
60 maCanvasHelper.clear();
63 void CanvasBitmap::disposeThis()
65 mpSurfaceProvider.clear();
67 mpBufferCairo.reset();
68 mpBufferSurface.reset();
71 CanvasBitmap_Base::disposeThis();
76 return mpBufferSurface;
79 SurfaceSharedPtr CanvasBitmap::createSurface( const ::basegfx::B2ISize& rSize,
int aContent )
81 return mpSurfaceProvider->createSurface(rSize,aContent);
86 return mpSurfaceProvider->createSurface(rBitmap);
97 return mpSurfaceProvider->getOutputDevice();
101 const rendering::ViewState& viewState,
102 const rendering::RenderState& renderState )
104 return maCanvasHelper.repaint( pSurface, viewState, renderState );
107 uno::Any SAL_CALL CanvasBitmap::getFastPropertyValue( sal_Int32 nHandle )
117 aRV <<= reinterpret_cast<sal_Int64>(
nullptr );
121 BitmapEx* pBitmapEx = vcl::bitmap::CreateFromCairoSurface(
123 getSurface()->getCairoSurface().
get());
125 aRV <<= reinterpret_cast<sal_Int64>( pBitmapEx );
131 aRV = getOutputDevice()->GetNativeSurfaceHandle(mpBufferSurface,
maSize);
146 OUString SAL_CALL CanvasBitmap::getImplementationName( )
148 return "CairoCanvas.CanvasBitmap";
151 sal_Bool SAL_CALL CanvasBitmap::supportsService(
const OUString& ServiceName )
156 uno::Sequence< OUString > SAL_CALL CanvasBitmap::getSupportedServiceNames( )
158 return {
"com.sun.star.rendering.CanvasBitmap" };
CanvasBitmap(const ::basegfx::B2ISize &rSize, SurfaceProviderRef rDevice, css::rendering::XGraphicDevice *pDevice, bool bHasAlpha)
Create a canvas bitmap for the given surface.
#define ENSURE_OR_THROW(c, m)
::basegfx::B2ISize maSize
#define SAL_INFO(area, stream)
std::shared_ptr< Surface > SurfaceSharedPtr
class SAL_LOPLUGIN_ANNOTATE("crosscast") SurfaceProvider typedef ::rtl::Reference< SurfaceProvider > SurfaceProviderRef
Target interface for XCachedPrimitive implementations.
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)