191c99ff4SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
391c99ff4SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
491c99ff4SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
591c99ff4SAndrew Rist  * distributed with this work for additional information
691c99ff4SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
791c99ff4SAndrew Rist  * to you under the Apache License, Version 2.0 (the
891c99ff4SAndrew Rist  * "License"); you may not use this file except in compliance
991c99ff4SAndrew Rist  * with the License.  You may obtain a copy of the License at
1091c99ff4SAndrew Rist  *
1191c99ff4SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
1291c99ff4SAndrew Rist  *
1391c99ff4SAndrew Rist  * Unless required by applicable law or agreed to in writing,
1491c99ff4SAndrew Rist  * software distributed under the License is distributed on an
1591c99ff4SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1691c99ff4SAndrew Rist  * KIND, either express or implied.  See the License for the
1791c99ff4SAndrew Rist  * specific language governing permissions and limitations
1891c99ff4SAndrew Rist  * under the License.
1991c99ff4SAndrew Rist  *
2091c99ff4SAndrew Rist  *************************************************************/
2191c99ff4SAndrew Rist 
2291c99ff4SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef INCLUDED_CANVAS_ISURFACEPROXYMANAGER_HXX
25cdf0e10cSrcweir #define INCLUDED_CANVAS_ISURFACEPROXYMANAGER_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <canvas/rendering/irendermodule.hxx>
28cdf0e10cSrcweir #include <canvas/rendering/icolorbuffer.hxx>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #include <boost/shared_ptr.hpp>
31cdf0e10cSrcweir 
32*b63233d8Sdamjan #include <canvas/canvastoolsdllapi.h>
33cdf0e10cSrcweir 
34cdf0e10cSrcweir namespace canvas
35cdf0e10cSrcweir {
36cdf0e10cSrcweir     struct ISurfaceProxy;
37cdf0e10cSrcweir 
38cdf0e10cSrcweir     /** Manager interface, which handles surface proxy objects.
39cdf0e10cSrcweir 
40cdf0e10cSrcweir         Typically, each canvas instantiation has one
41cdf0e10cSrcweir         SurfaceProxyManager object, to handle their surfaces. Surfaces
42cdf0e10cSrcweir         itself are opaque objects, which encapsulate a framebuffer to
43cdf0e10cSrcweir         render upon, plus an optional (possibly accelerated) texture.
44cdf0e10cSrcweir      */
45cdf0e10cSrcweir     struct ISurfaceProxyManager
46cdf0e10cSrcweir     {
~ISurfaceProxyManagercanvas::ISurfaceProxyManager47cdf0e10cSrcweir         virtual ~ISurfaceProxyManager() {}
48cdf0e10cSrcweir 
49cdf0e10cSrcweir         /** Create a surface proxy for a color buffer.
50cdf0e10cSrcweir 
51cdf0e10cSrcweir             The whole idea is build around the concept that you create
52cdf0e10cSrcweir             some arbitrary buffer which contains the image data and
53cdf0e10cSrcweir             tell the texture manager about it.  From there on you can
54cdf0e10cSrcweir             draw into this image using any kind of graphics api you
55cdf0e10cSrcweir             want.  In the technical sense we allocate some space in
56cdf0e10cSrcweir             local videomemory or AGP memory which will be filled on
57cdf0e10cSrcweir             demand, which means if there exists any rendering
58cdf0e10cSrcweir             operation that needs to read from this memory location.
59cdf0e10cSrcweir             This method creates a logical hardware surface object
60cdf0e10cSrcweir             which uses the given color buffer as the image source.
61cdf0e10cSrcweir             Internally this texture may even be distributed to several
62cdf0e10cSrcweir             real hardware surfaces.
63cdf0e10cSrcweir         */
64cdf0e10cSrcweir         virtual ::boost::shared_ptr< ISurfaceProxy > createSurfaceProxy(
65cdf0e10cSrcweir             const IColorBufferSharedPtr& pBuffer ) const = 0;
66cdf0e10cSrcweir     };
67cdf0e10cSrcweir 
68cdf0e10cSrcweir     typedef ::boost::shared_ptr< ISurfaceProxyManager > ISurfaceProxyManagerSharedPtr;
69cdf0e10cSrcweir 
70cdf0e10cSrcweir 
71cdf0e10cSrcweir     /** Create a surface proxy for the given render module.
72cdf0e10cSrcweir      */
73*b63233d8Sdamjan 	CANVASTOOLS_DLLPUBLIC ISurfaceProxyManagerSharedPtr createSurfaceProxyManager( const IRenderModuleSharedPtr& rRenderModule );
74cdf0e10cSrcweir }
75cdf0e10cSrcweir 
76cdf0e10cSrcweir #endif /* INCLUDED_CANVAS_ISURFACEPROXYMANAGER_HXX */
77