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