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_WIN32_CAIRO_HXX
25 #define _CAIROCANVAS_WIN32_CAIRO_HXX
26 
27 #ifdef WNT
28 # include <tools/prewin.h>
29 # include <windows.h>
30 # include <tools/postwin.h>
31 #endif
32 
33 #include "cairo_cairo.hxx"
34 
35 namespace cairo {
36 
37 	class Win32Surface : public Surface
38     {
39 		CairoSurfaceSharedPtr mpSurface;
40 
41 	public:
42         /// takes over ownership of passed cairo_surface
43 		explicit Win32Surface( const CairoSurfaceSharedPtr& pSurface );
44         /// create surface on subarea of given drawable
45 		Win32Surface( HDC hDC, int x, int y );
46         /// create surface for given bitmap data
47 		Win32Surface( const BitmapSystemData& rBmpData );
48 
49         // Surface interface
50 		virtual CairoSharedPtr getCairo() const;
getCairoSurface() const51 		virtual CairoSurfaceSharedPtr getCairoSurface() const { return mpSurface; }
52 		virtual SurfaceSharedPtr getSimilar( Content aContent, int width, int height ) const;
53 
54         virtual boost::shared_ptr<VirtualDevice> createVirtualDevice() const;
55 
56 		virtual void Resize( int width, int height );
57 
58         virtual void flush() const;
59 
60 		int getDepth() const;
61 	};
62 
63     unsigned long ucs4toindex(unsigned int ucs4, HFONT hfont);
64 }
65 
66 #endif
67