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 _CPPCANVAS_BASEGFXFACTORY_HXX
25 #define _CPPCANVAS_BASEGFXFACTORY_HXX
26 
27 #include <cppcanvas/canvas.hxx>
28 #include <cppcanvas/bitmapcanvas.hxx>
29 #include <cppcanvas/spritecanvas.hxx>
30 #include <cppcanvas/polypolygon.hxx>
31 #include <cppcanvas/bitmap.hxx>
32 #include <cppcanvas/renderer.hxx>
33 #include <cppcanvas/text.hxx>
34 #include <cppcanvas/sprite.hxx>
35 #include <basegfx/vector/b2isize.hxx>
36 
37 
38 namespace basegfx
39 {
40     class B2DPolygon;
41     class B2DPolyPolygon;
42 }
43 
44 namespace rtl
45 {
46     class OUString;
47 }
48 
49 /* Definition of BaseGfxFactory class */
50 
51 namespace cppcanvas
52 {
53     /** The BaseGfxFactory creates Canvas objects for various basegfx
54         primitives, such as polygons and bitmaps (not yet
55         implemented).
56 
57         Please note that the objects created for a specific Canvas can
58         only be drawn on exactly that canvas. You have to regenerate
59         them for different canvases.
60      */
61     class BaseGfxFactory
62     {
63     public:
64         static BaseGfxFactory& getInstance();
65 
66         /** Create a polygon from a ::basegfx::B2DPolygon
67 
68 			The created polygon initially has the same size in user
69 			coordinate space as the source polygon
70          */
71         PolyPolygonSharedPtr 	createPolyPolygon( const CanvasSharedPtr&, const ::basegfx::B2DPolygon& rPoly ) const;
72         PolyPolygonSharedPtr 	createPolyPolygon( const CanvasSharedPtr&, const ::basegfx::B2DPolyPolygon& rPoly ) const;
73 
74         /** Create an uninitialized bitmap with the given size
75          */
76         BitmapSharedPtr 		createBitmap( const CanvasSharedPtr&, const ::basegfx::B2ISize& rSize ) const;
77 
78         /** Create an uninitialized alpha bitmap with the given size
79          */
80         BitmapSharedPtr 		createAlphaBitmap( const CanvasSharedPtr&, const ::basegfx::B2ISize& rSize ) const;
81 
82         /** Create a text portion with the given content string
83          */
84         TextSharedPtr 			createText( const CanvasSharedPtr&, const ::rtl::OUString& ) const;
85 
86     private:
87         friend struct InitInstance2;
88 
89         // singleton
90         BaseGfxFactory();
91         ~BaseGfxFactory();
92 
93         // default: disabled copy/assignment
94         BaseGfxFactory(const BaseGfxFactory&);
95         BaseGfxFactory& operator=( const BaseGfxFactory& );
96     };
97 
98 }
99 
100 #endif /* _CPPCANVAS_BASEGFXFACTORY_HXX */
101