1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: cairo_devicehelper.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _CAIROCANVAS_DEVICEHELPER_HXX
32 #define _CAIROCANVAS_DEVICEHELPER_HXX
34 #include <com/sun/star/awt/Rectangle.hpp>
35 #include <com/sun/star/rendering/XGraphicDevice.hpp>
36 #include <com/sun/star/rendering/XBufferController.hpp>
38 #include <boost/utility.hpp>
40 #include <vcl/window.hxx>
41 #include <vcl/bitmap.hxx>
43 #include "cairo_cairo.hxx"
44 #include "cairo_surfaceprovider.hxx"
46 /* Definition of DeviceHelper class */
56 class DeviceHelper
: private ::boost::noncopyable
67 Reference output device. Needed for resolution
70 void init( SurfaceProvider
& rSurfaceProvider
,
71 OutputDevice
& rRefDevice
);
73 /// Dispose all internal references
76 // XWindowGraphicDevice
77 ::com::sun::star::geometry::RealSize2D
getPhysicalResolution();
78 ::com::sun::star::geometry::RealSize2D
getPhysicalSize();
79 ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XLinePolyPolygon2D
> createCompatibleLinePolyPolygon(
80 const ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XGraphicDevice
>& rDevice
,
81 const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Sequence
< ::com::sun::star::geometry::RealPoint2D
> >& points
);
82 ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XBezierPolyPolygon2D
> createCompatibleBezierPolyPolygon(
83 const ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XGraphicDevice
>& rDevice
,
84 const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Sequence
< ::com::sun::star::geometry::RealBezierSegment2D
> >& points
);
85 ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XBitmap
> createCompatibleBitmap(
86 const ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XGraphicDevice
>& rDevice
,
87 const ::com::sun::star::geometry::IntegerSize2D
& size
);
88 ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XVolatileBitmap
> createVolatileBitmap(
89 const ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XGraphicDevice
>& rDevice
,
90 const ::com::sun::star::geometry::IntegerSize2D
& size
);
91 ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XBitmap
> createCompatibleAlphaBitmap(
92 const ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XGraphicDevice
>& rDevice
,
93 const ::com::sun::star::geometry::IntegerSize2D
& size
);
94 ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XVolatileBitmap
> createVolatileAlphaBitmap(
95 const ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XGraphicDevice
>& rDevice
,
96 const ::com::sun::star::geometry::IntegerSize2D
& size
);
97 sal_Bool
hasFullScreenMode( );
98 sal_Bool
enterFullScreenMode( sal_Bool bEnter
);
100 ::com::sun::star::uno::Any
isAccelerated() const;
101 ::com::sun::star::uno::Any
getDeviceHandle() const;
102 ::com::sun::star::uno::Any
getSurfaceHandle() const;
103 ::com::sun::star::uno::Reference
<
104 ::com::sun::star::rendering::XColorSpace
> getColorSpace() const;
106 /** called when DumpScreenContent property is enabled on
107 XGraphicDevice, and writes out bitmaps of current screen.
109 void dumpScreenContent() const;
111 OutputDevice
* getOutputDevice() const { return mpRefDevice
; }
112 const void* getSysData() { return mpSysData
; }
113 ::cairo::SurfaceSharedPtr
getSurface();
114 ::cairo::SurfaceSharedPtr
createSurface( const ::basegfx::B2ISize
& rSize
, ::cairo::Content aContent
= CAIRO_CONTENT_COLOR_ALPHA
);
115 ::cairo::SurfaceSharedPtr
createSurface( BitmapSystemData
& rData
, const Size
& rSize
);
124 Reference output device. Needed for resolution
127 void implInit( SurfaceProvider
& rSurfaceProvider
,
128 OutputDevice
& rRefDevice
);
129 void setSize( const ::basegfx::B2ISize
& rSize
);
134 Deliberately not a refcounted reference, because of
135 potential circular references for canvas. Provides us with
136 our output surface and associated functionality.
138 SurfaceProvider
* mpSurfaceProvider
;
140 OutputDevice
* mpRefDevice
;
141 const void* mpSysData
;
142 ::cairo::SurfaceSharedPtr mpSurface
;