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_CAIRO_HXX
21 #define _CAIROCANVAS_CAIRO_HXX
23 #include <sal/config.h>
24 #include <boost/shared_ptr.hpp>
27 struct BitmapSystemData
;
28 struct SystemGraphicsData
;
34 #include <cairo.h> //cannot be inside a namespace, otherwise Quartz fails to compile.
37 typedef cairo_t Cairo
;
38 typedef cairo_matrix_t Matrix
;
39 typedef cairo_format_t Format
;
40 typedef cairo_content_t Content
;
41 typedef cairo_pattern_t Pattern
;
43 typedef boost::shared_ptr
<cairo_surface_t
> CairoSurfaceSharedPtr
;
44 typedef boost::shared_ptr
<Cairo
> CairoSharedPtr
;
46 const SystemEnvData
* GetSysData(const Window
*pOutputWindow
);
48 /** Cairo surface interface
50 For each cairo-supported platform, there's an implementation of
59 virtual CairoSharedPtr
getCairo() const = 0;
60 virtual CairoSurfaceSharedPtr
getCairoSurface() const = 0;
61 virtual boost::shared_ptr
<Surface
> getSimilar( Content aContent
, int width
, int height
) const = 0;
63 /// factory for VirDev on this surface
64 virtual boost::shared_ptr
<VirtualDevice
> createVirtualDevice() const = 0;
66 /// Resize the surface (possibly destroying content)
67 virtual void Resize( int width
, int height
) = 0;
69 /// Flush all pending output to surface
70 virtual void flush() const = 0;
73 typedef boost::shared_ptr
<Surface
> SurfaceSharedPtr
;
75 /// Create Surface from given cairo surface
76 SurfaceSharedPtr
createSurface( const CairoSurfaceSharedPtr
& rSurface
);
77 /// Create surface with given dimensions
78 SurfaceSharedPtr
createSurface( const OutputDevice
& rRefDevice
,
79 int x
, int y
, int width
, int height
);
80 /// Create Surface for given bitmap data
81 SurfaceSharedPtr
createBitmapSurface( const OutputDevice
& rRefDevice
,
82 const BitmapSystemData
& rData
,
85 /// Check whether cairo will work on given window
86 bool IsCairoWorking( OutputDevice
* );
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */