Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef _CAIROCANVAS_CAIRO_HXX
21 : #define _CAIROCANVAS_CAIRO_HXX
22 :
23 : #include <sal/config.h>
24 : #include <boost/shared_ptr.hpp>
25 :
26 : struct SystemEnvData;
27 : struct BitmapSystemData;
28 : struct SystemGraphicsData;
29 : class VirtualDevice;
30 : class OutputDevice;
31 : class Window;
32 : class Size;
33 :
34 : #include <cairo.h> //cannot be inside a namespace, otherwise Quartz fails to compile.
35 :
36 : namespace cairo {
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;
42 :
43 : typedef boost::shared_ptr<cairo_surface_t> CairoSurfaceSharedPtr;
44 : typedef boost::shared_ptr<Cairo> CairoSharedPtr;
45 :
46 : const SystemEnvData* GetSysData(const Window *pOutputWindow);
47 :
48 : /** Cairo surface interface
49 :
50 : For each cairo-supported platform, there's an implementation of
51 : this interface
52 : */
53 0 : struct Surface
54 : {
55 : public:
56 0 : virtual ~Surface() {}
57 :
58 : // Query methods
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;
62 :
63 : /// factory for VirDev on this surface
64 : virtual boost::shared_ptr<VirtualDevice> createVirtualDevice() const = 0;
65 :
66 : /// Resize the surface (possibly destroying content)
67 : virtual void Resize( int width, int height ) = 0;
68 :
69 : /// Flush all pending output to surface
70 : virtual void flush() const = 0;
71 : };
72 :
73 : typedef boost::shared_ptr<Surface> SurfaceSharedPtr;
74 :
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,
83 : const Size& rSize );
84 :
85 : /// Check whether cairo will work on given window
86 : bool IsCairoWorking( OutputDevice* );
87 : }
88 :
89 : #endif
90 :
91 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|