1*91c99ff4SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*91c99ff4SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*91c99ff4SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*91c99ff4SAndrew Rist  * distributed with this work for additional information
6*91c99ff4SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*91c99ff4SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*91c99ff4SAndrew Rist  * "License"); you may not use this file except in compliance
9*91c99ff4SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*91c99ff4SAndrew Rist  *
11*91c99ff4SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*91c99ff4SAndrew Rist  *
13*91c99ff4SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*91c99ff4SAndrew Rist  * software distributed under the License is distributed on an
15*91c99ff4SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*91c99ff4SAndrew Rist  * KIND, either express or implied.  See the License for the
17*91c99ff4SAndrew Rist  * specific language governing permissions and limitations
18*91c99ff4SAndrew Rist  * under the License.
19*91c99ff4SAndrew Rist  *
20*91c99ff4SAndrew Rist  *************************************************************/
21*91c99ff4SAndrew Rist 
22*91c99ff4SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _CAIROCANVAS_SURFACEPROVIDER_HXX
25cdf0e10cSrcweir #define _CAIROCANVAS_SURFACEPROVIDER_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <rtl/ref.hxx>
28cdf0e10cSrcweir #include <com/sun/star/uno/XInterface.hpp>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #include "cairo_cairo.hxx"
31cdf0e10cSrcweir 
32cdf0e10cSrcweir using namespace ::cairo;
33cdf0e10cSrcweir 
34cdf0e10cSrcweir class OutputDevice;
35cdf0e10cSrcweir class Bitmap;
36cdf0e10cSrcweir 
37cdf0e10cSrcweir namespace cairocanvas
38cdf0e10cSrcweir {
39cdf0e10cSrcweir     class Bitmap;
40cdf0e10cSrcweir 
41cdf0e10cSrcweir 	/* Definition of RepaintTarget interface */
42cdf0e10cSrcweir 
43cdf0e10cSrcweir     /** Target interface for XCachedPrimitive implementations
44cdf0e10cSrcweir 
45cdf0e10cSrcweir     	This interface must be implemented on all canvas
46cdf0e10cSrcweir     	implementations that hand out XCachedPrimitives
47cdf0e10cSrcweir      */
48cdf0e10cSrcweir     class SurfaceProvider : public ::com::sun::star::uno::XInterface
49cdf0e10cSrcweir     {
50cdf0e10cSrcweir     public:
~SurfaceProvider()51cdf0e10cSrcweir         virtual ~SurfaceProvider() {}
52cdf0e10cSrcweir 
53cdf0e10cSrcweir         /** Query surface from this provider
54cdf0e10cSrcweir 
55cdf0e10cSrcweir             This should return the default surface to render on.
56cdf0e10cSrcweir          */
57cdf0e10cSrcweir 		virtual SurfaceSharedPtr getSurface() = 0;
58cdf0e10cSrcweir 
59cdf0e10cSrcweir         /// create new surface in given size
60cdf0e10cSrcweir 		virtual SurfaceSharedPtr createSurface( const ::basegfx::B2ISize& rSize,
61cdf0e10cSrcweir                                                 Content aContent = CAIRO_CONTENT_COLOR_ALPHA ) = 0;
62cdf0e10cSrcweir         /// create new surface from given bitmap
63cdf0e10cSrcweir         virtual SurfaceSharedPtr createSurface( ::Bitmap& rBitmap ) = 0;
64cdf0e10cSrcweir 
65cdf0e10cSrcweir         /** convert surface between alpha and non-alpha
66cdf0e10cSrcweir             channel. returns new surface on success, NULL otherwise
67cdf0e10cSrcweir         */
68cdf0e10cSrcweir 		virtual SurfaceSharedPtr changeSurface( bool bHasAlpha, bool bCopyContent ) = 0;
69cdf0e10cSrcweir 
70cdf0e10cSrcweir         /** Provides the underlying vcl outputdevice this surface renders on
71cdf0e10cSrcweir          */
72cdf0e10cSrcweir 		virtual OutputDevice* getOutputDevice() = 0;
73cdf0e10cSrcweir     };
74cdf0e10cSrcweir 
75cdf0e10cSrcweir     typedef ::rtl::Reference< SurfaceProvider > SurfaceProviderRef;
76cdf0e10cSrcweir }
77cdf0e10cSrcweir 
78cdf0e10cSrcweir #endif
79