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 INCLUDED_CANVAS_ISURFACEPROXYMANAGER_HXX
25 #define INCLUDED_CANVAS_ISURFACEPROXYMANAGER_HXX
26 
27 #include <canvas/rendering/irendermodule.hxx>
28 #include <canvas/rendering/icolorbuffer.hxx>
29 
30 #include <boost/shared_ptr.hpp>
31 
32 
33 namespace canvas
34 {
35     struct ISurfaceProxy;
36 
37     /** Manager interface, which handles surface proxy objects.
38 
39         Typically, each canvas instantiation has one
40         SurfaceProxyManager object, to handle their surfaces. Surfaces
41         itself are opaque objects, which encapsulate a framebuffer to
42         render upon, plus an optional (possibly accelerated) texture.
43      */
44     struct ISurfaceProxyManager
45     {
~ISurfaceProxyManagercanvas::ISurfaceProxyManager46         virtual ~ISurfaceProxyManager() {}
47 
48         /** Create a surface proxy for a color buffer.
49 
50             The whole idea is build around the concept that you create
51             some arbitrary buffer which contains the image data and
52             tell the texture manager about it.  From there on you can
53             draw into this image using any kind of graphics api you
54             want.  In the technical sense we allocate some space in
55             local videomemory or AGP memory which will be filled on
56             demand, which means if there exists any rendering
57             operation that needs to read from this memory location.
58             This method creates a logical hardware surface object
59             which uses the given color buffer as the image source.
60             Internally this texture may even be distributed to several
61             real hardware surfaces.
62         */
63         virtual ::boost::shared_ptr< ISurfaceProxy > createSurfaceProxy(
64             const IColorBufferSharedPtr& pBuffer ) const = 0;
65     };
66 
67     typedef ::boost::shared_ptr< ISurfaceProxyManager > ISurfaceProxyManagerSharedPtr;
68 
69 
70     /** Create a surface proxy for the given render module.
71      */
72 	ISurfaceProxyManagerSharedPtr createSurfaceProxyManager( const IRenderModuleSharedPtr& rRenderModule );
73 }
74 
75 #endif /* INCLUDED_CANVAS_ISURFACEPROXYMANAGER_HXX */
76