1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef _CAIROCANVAS_DEVICEHELPER_HXX
21 #define _CAIROCANVAS_DEVICEHELPER_HXX
23 #include <com/sun/star/awt/Rectangle.hpp>
24 #include <com/sun/star/rendering/XGraphicDevice.hpp>
25 #include <com/sun/star/rendering/XBufferController.hpp>
27 #include <boost/utility.hpp>
29 #include <vcl/window.hxx>
30 #include <vcl/bitmap.hxx>
32 #include "cairo_cairo.hxx"
33 #include "cairo_surfaceprovider.hxx"
35 /* Definition of DeviceHelper class */
39 class DeviceHelper
: private ::boost::noncopyable
50 Reference output device. Needed for resolution
53 void init( SurfaceProvider
& rSurfaceProvider
,
54 OutputDevice
& rRefDevice
);
56 /// Dispose all internal references
59 // XWindowGraphicDevice
60 ::com::sun::star::geometry::RealSize2D
getPhysicalResolution();
61 ::com::sun::star::geometry::RealSize2D
getPhysicalSize();
62 ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XLinePolyPolygon2D
> createCompatibleLinePolyPolygon(
63 const ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XGraphicDevice
>& rDevice
,
64 const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Sequence
< ::com::sun::star::geometry::RealPoint2D
> >& points
);
65 ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XBezierPolyPolygon2D
> createCompatibleBezierPolyPolygon(
66 const ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XGraphicDevice
>& rDevice
,
67 const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Sequence
< ::com::sun::star::geometry::RealBezierSegment2D
> >& points
);
68 ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XBitmap
> createCompatibleBitmap(
69 const ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XGraphicDevice
>& rDevice
,
70 const ::com::sun::star::geometry::IntegerSize2D
& size
);
71 ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XVolatileBitmap
> createVolatileBitmap(
72 const ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XGraphicDevice
>& rDevice
,
73 const ::com::sun::star::geometry::IntegerSize2D
& size
);
74 ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XBitmap
> createCompatibleAlphaBitmap(
75 const ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XGraphicDevice
>& rDevice
,
76 const ::com::sun::star::geometry::IntegerSize2D
& size
);
77 ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XVolatileBitmap
> createVolatileAlphaBitmap(
78 const ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XGraphicDevice
>& rDevice
,
79 const ::com::sun::star::geometry::IntegerSize2D
& size
);
80 sal_Bool
hasFullScreenMode( );
81 sal_Bool
enterFullScreenMode( sal_Bool bEnter
);
83 ::com::sun::star::uno::Any
isAccelerated() const;
84 ::com::sun::star::uno::Any
getDeviceHandle() const;
85 ::com::sun::star::uno::Any
getSurfaceHandle() const;
86 ::com::sun::star::uno::Reference
<
87 ::com::sun::star::rendering::XColorSpace
> getColorSpace() const;
89 /** called when DumpScreenContent property is enabled on
90 XGraphicDevice, and writes out bitmaps of current screen.
92 void dumpScreenContent() const;
94 OutputDevice
* getOutputDevice() const { return mpRefDevice
; }
95 const void* getSysData() { return mpSysData
; }
96 ::cairo::SurfaceSharedPtr
getSurface();
97 ::cairo::SurfaceSharedPtr
createSurface( const ::basegfx::B2ISize
& rSize
, ::cairo::Content aContent
= CAIRO_CONTENT_COLOR_ALPHA
);
98 ::cairo::SurfaceSharedPtr
createSurface( BitmapSystemData
& rData
, const Size
& rSize
);
107 Reference output device. Needed for resolution
110 void implInit( SurfaceProvider
& rSurfaceProvider
,
111 OutputDevice
& rRefDevice
);
112 void setSize( const ::basegfx::B2ISize
& rSize
);
117 Deliberately not a refcounted reference, because of
118 potential circular references for canvas. Provides us with
119 our output surface and associated functionality.
121 SurfaceProvider
* mpSurfaceProvider
;
123 OutputDevice
* mpRefDevice
;
124 const void* mpSysData
;
125 ::cairo::SurfaceSharedPtr mpSurface
;
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */