1*b1cdbd2cSJim Jagielski /************************************************************** 2*b1cdbd2cSJim Jagielski * 3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one 4*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file 5*b1cdbd2cSJim Jagielski * distributed with this work for additional information 6*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file 7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the 8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance 9*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at 10*b1cdbd2cSJim Jagielski * 11*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0 12*b1cdbd2cSJim Jagielski * 13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing, 14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an 15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the 17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations 18*b1cdbd2cSJim Jagielski * under the License. 19*b1cdbd2cSJim Jagielski * 20*b1cdbd2cSJim Jagielski *************************************************************/ 21*b1cdbd2cSJim Jagielski 22*b1cdbd2cSJim Jagielski 23*b1cdbd2cSJim Jagielski 24*b1cdbd2cSJim Jagielski #ifndef _CAIROCANVAS_DEVICEHELPER_HXX 25*b1cdbd2cSJim Jagielski #define _CAIROCANVAS_DEVICEHELPER_HXX 26*b1cdbd2cSJim Jagielski 27*b1cdbd2cSJim Jagielski #include <com/sun/star/awt/Rectangle.hpp> 28*b1cdbd2cSJim Jagielski #include <com/sun/star/rendering/XGraphicDevice.hpp> 29*b1cdbd2cSJim Jagielski #include <com/sun/star/rendering/XBufferController.hpp> 30*b1cdbd2cSJim Jagielski 31*b1cdbd2cSJim Jagielski #include <boost/utility.hpp> 32*b1cdbd2cSJim Jagielski 33*b1cdbd2cSJim Jagielski #include <vcl/window.hxx> 34*b1cdbd2cSJim Jagielski #include <vcl/bitmap.hxx> 35*b1cdbd2cSJim Jagielski 36*b1cdbd2cSJim Jagielski #include "cairo_cairo.hxx" 37*b1cdbd2cSJim Jagielski #include "cairo_surfaceprovider.hxx" 38*b1cdbd2cSJim Jagielski 39*b1cdbd2cSJim Jagielski /* Definition of DeviceHelper class */ 40*b1cdbd2cSJim Jagielski 41*b1cdbd2cSJim Jagielski struct SystemEnvData; 42*b1cdbd2cSJim Jagielski class Window; 43*b1cdbd2cSJim Jagielski 44*b1cdbd2cSJim Jagielski namespace cairocanvas 45*b1cdbd2cSJim Jagielski { 46*b1cdbd2cSJim Jagielski class Canvas; 47*b1cdbd2cSJim Jagielski class CanvasHelper; 48*b1cdbd2cSJim Jagielski 49*b1cdbd2cSJim Jagielski class DeviceHelper : private ::boost::noncopyable 50*b1cdbd2cSJim Jagielski { 51*b1cdbd2cSJim Jagielski public: 52*b1cdbd2cSJim Jagielski DeviceHelper(); 53*b1cdbd2cSJim Jagielski 54*b1cdbd2cSJim Jagielski /** init helper 55*b1cdbd2cSJim Jagielski 56*b1cdbd2cSJim Jagielski @param rCanvas 57*b1cdbd2cSJim Jagielski Owning canvas. 58*b1cdbd2cSJim Jagielski 59*b1cdbd2cSJim Jagielski @param rRefDevice 60*b1cdbd2cSJim Jagielski Reference output device. Needed for resolution 61*b1cdbd2cSJim Jagielski calculations etc. 62*b1cdbd2cSJim Jagielski */ 63*b1cdbd2cSJim Jagielski void init( SurfaceProvider& rSurfaceProvider, 64*b1cdbd2cSJim Jagielski OutputDevice& rRefDevice ); 65*b1cdbd2cSJim Jagielski 66*b1cdbd2cSJim Jagielski /// Dispose all internal references 67*b1cdbd2cSJim Jagielski void disposing(); 68*b1cdbd2cSJim Jagielski 69*b1cdbd2cSJim Jagielski // XWindowGraphicDevice 70*b1cdbd2cSJim Jagielski ::com::sun::star::geometry::RealSize2D getPhysicalResolution(); 71*b1cdbd2cSJim Jagielski ::com::sun::star::geometry::RealSize2D getPhysicalSize(); 72*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XLinePolyPolygon2D > createCompatibleLinePolyPolygon( 73*b1cdbd2cSJim Jagielski const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, 74*b1cdbd2cSJim Jagielski const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > >& points ); 75*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBezierPolyPolygon2D > createCompatibleBezierPolyPolygon( 76*b1cdbd2cSJim Jagielski const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, 77*b1cdbd2cSJim Jagielski const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealBezierSegment2D > >& points ); 78*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > createCompatibleBitmap( 79*b1cdbd2cSJim Jagielski const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, 80*b1cdbd2cSJim Jagielski const ::com::sun::star::geometry::IntegerSize2D& size ); 81*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XVolatileBitmap > createVolatileBitmap( 82*b1cdbd2cSJim Jagielski const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, 83*b1cdbd2cSJim Jagielski const ::com::sun::star::geometry::IntegerSize2D& size ); 84*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > createCompatibleAlphaBitmap( 85*b1cdbd2cSJim Jagielski const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, 86*b1cdbd2cSJim Jagielski const ::com::sun::star::geometry::IntegerSize2D& size ); 87*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XVolatileBitmap > createVolatileAlphaBitmap( 88*b1cdbd2cSJim Jagielski const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, 89*b1cdbd2cSJim Jagielski const ::com::sun::star::geometry::IntegerSize2D& size ); 90*b1cdbd2cSJim Jagielski sal_Bool hasFullScreenMode( ); 91*b1cdbd2cSJim Jagielski sal_Bool enterFullScreenMode( sal_Bool bEnter ); 92*b1cdbd2cSJim Jagielski 93*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Any isAccelerated() const; 94*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Any getDeviceHandle() const; 95*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Any getSurfaceHandle() const; 96*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< 97*b1cdbd2cSJim Jagielski ::com::sun::star::rendering::XColorSpace > getColorSpace() const; 98*b1cdbd2cSJim Jagielski 99*b1cdbd2cSJim Jagielski /** called when DumpScreenContent property is enabled on 100*b1cdbd2cSJim Jagielski XGraphicDevice, and writes out bitmaps of current screen. 101*b1cdbd2cSJim Jagielski */ 102*b1cdbd2cSJim Jagielski void dumpScreenContent() const; 103*b1cdbd2cSJim Jagielski getOutputDevice() const104*b1cdbd2cSJim Jagielski OutputDevice* getOutputDevice() const { return mpRefDevice; } getSysData()105*b1cdbd2cSJim Jagielski const void* getSysData() { return mpSysData; } 106*b1cdbd2cSJim Jagielski ::cairo::SurfaceSharedPtr getSurface(); 107*b1cdbd2cSJim Jagielski ::cairo::SurfaceSharedPtr createSurface( const ::basegfx::B2ISize& rSize, ::cairo::Content aContent = CAIRO_CONTENT_COLOR_ALPHA ); 108*b1cdbd2cSJim Jagielski ::cairo::SurfaceSharedPtr createSurface( BitmapSystemData& rData, const Size& rSize ); 109*b1cdbd2cSJim Jagielski 110*b1cdbd2cSJim Jagielski protected: 111*b1cdbd2cSJim Jagielski /** init helper 112*b1cdbd2cSJim Jagielski 113*b1cdbd2cSJim Jagielski @param rCanvas 114*b1cdbd2cSJim Jagielski Owning canvas. 115*b1cdbd2cSJim Jagielski 116*b1cdbd2cSJim Jagielski @param rRefDevice 117*b1cdbd2cSJim Jagielski Reference output device. Needed for resolution 118*b1cdbd2cSJim Jagielski calculations etc. 119*b1cdbd2cSJim Jagielski */ 120*b1cdbd2cSJim Jagielski void implInit( SurfaceProvider& rSurfaceProvider, 121*b1cdbd2cSJim Jagielski OutputDevice& rRefDevice ); 122*b1cdbd2cSJim Jagielski void setSize( const ::basegfx::B2ISize& rSize ); 123*b1cdbd2cSJim Jagielski 124*b1cdbd2cSJim Jagielski private: 125*b1cdbd2cSJim Jagielski /** Surface provider 126*b1cdbd2cSJim Jagielski 127*b1cdbd2cSJim Jagielski Deliberately not a refcounted reference, because of 128*b1cdbd2cSJim Jagielski potential circular references for canvas. Provides us with 129*b1cdbd2cSJim Jagielski our output surface and associated functionality. 130*b1cdbd2cSJim Jagielski */ 131*b1cdbd2cSJim Jagielski SurfaceProvider* mpSurfaceProvider; 132*b1cdbd2cSJim Jagielski 133*b1cdbd2cSJim Jagielski OutputDevice* mpRefDevice; 134*b1cdbd2cSJim Jagielski const void* mpSysData; 135*b1cdbd2cSJim Jagielski ::cairo::SurfaceSharedPtr mpSurface; 136*b1cdbd2cSJim Jagielski }; 137*b1cdbd2cSJim Jagielski } 138*b1cdbd2cSJim Jagielski 139*b1cdbd2cSJim Jagielski #endif 140