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_cairo.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_CAIRO_HXX
32 #define _CAIROCANVAS_CAIRO_HXX
34 #include <sal/config.h>
35 #include <boost/shared_ptr.hpp>
38 struct BitmapSystemData
;
39 struct SystemGraphicsData
;
45 #include <cairo.h> //cannot be inside a namespace, otherwise Quartz fails to compile.
48 typedef cairo_t Cairo
;
49 typedef cairo_matrix_t Matrix
;
50 typedef cairo_format_t Format
;
51 typedef cairo_content_t Content
;
52 typedef cairo_pattern_t Pattern
;
54 typedef boost::shared_ptr
<cairo_surface_t
> CairoSurfaceSharedPtr
;
55 typedef boost::shared_ptr
<Cairo
> CairoSharedPtr
;
57 const SystemEnvData
* GetSysData(const Window
*pOutputWindow
);
59 /** Cairo surface interface
61 For each cairo-supported platform, there's an implementation of
70 virtual CairoSharedPtr
getCairo() const = 0;
71 virtual CairoSurfaceSharedPtr
getCairoSurface() const = 0;
72 virtual boost::shared_ptr
<Surface
> getSimilar( Content aContent
, int width
, int height
) const = 0;
74 /// factory for VirDev on this surface
75 virtual boost::shared_ptr
<VirtualDevice
> createVirtualDevice() const = 0;
77 /// Resize the surface (possibly destroying content)
78 virtual void Resize( int width
, int height
) = 0;
80 /// Flush all pending output to surface
81 virtual void flush() const = 0;
84 typedef boost::shared_ptr
<Surface
> SurfaceSharedPtr
;
86 /// Create Surface from given cairo surface
87 SurfaceSharedPtr
createSurface( const CairoSurfaceSharedPtr
& rSurface
);
88 /// Create surface with given dimensions
89 SurfaceSharedPtr
createSurface( const OutputDevice
& rRefDevice
,
90 int x
, int y
, int width
, int height
);
91 /// Create Surface for given bitmap data
92 SurfaceSharedPtr
createBitmapSurface( const OutputDevice
& rRefDevice
,
93 const BitmapSystemData
& rData
,
96 /// Check whether cairo will work on given window
97 bool IsCairoWorking( OutputDevice
* );