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