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_CANVAS_HXX
25 #define _CPPCANVAS_CANVAS_HXX
26 
27 #include <com/sun/star/uno/Reference.hxx>
28 
29 #include <boost/shared_ptr.hpp>
30 #include <cppcanvas/font.hxx>
31 #include <cppcanvas/color.hxx>
32 
33 namespace rtl
34 {
35     class OUString;
36 }
37 
38 namespace basegfx
39 {
40     class B2DHomMatrix;
41     class B2DPolyPolygon;
42 }
43 
44 namespace com { namespace sun { namespace star { namespace rendering
45 {
46     class  XCanvas;
47     struct ViewState;
48 } } } }
49 
50 
51 /* Definition of BitmapCanvas */
52 
53 namespace cppcanvas
54 {
55     class PolyPolygon;
56     class Canvas;
57 
58     // forward declaration, since PolyPolygon also references Canvas
59     typedef ::boost::shared_ptr< PolyPolygon > PolyPolygonSharedPtr;
60 
61     // forward declaration, since cloneCanvas() also references Canvas
62     typedef ::boost::shared_ptr< Canvas > CanvasSharedPtr;
63 
64     /** Canvas interface
65      */
66     class Canvas
67     {
68     public:
69         enum
70         {
71             /** Extra pixel used when canvas anti-aliases.
72 
73             	Enlarge the bounding box of drawing primitives by this
74             	amount in both dimensions, and on both sides of the
75             	bounds, to account for extra pixel touched outside the
76             	actual primitive bounding box, when the canvas
77             	performs anti-aliasing.
78              */
79             ANTIALIASING_EXTRA_SIZE=2
80     	};
81 
~Canvas()82         virtual ~Canvas() {}
83 
84         virtual void 						     setTransformation( const ::basegfx::B2DHomMatrix& rMatrix ) = 0;
85         virtual ::basegfx::B2DHomMatrix          getTransformation() const = 0;
86 
87         virtual void                             setClip( const ::basegfx::B2DPolyPolygon& rClipPoly ) = 0;
88         virtual void                             setClip() = 0;
89 
90         /** Get current clip
91 
92             @return NULL, if no clip is set, otherwise the current clip poly-polygon
93          */
94         virtual ::basegfx::B2DPolyPolygon const* getClip() const = 0;
95 
96         virtual FontSharedPtr                    createFont( const ::rtl::OUString& rFontName, const double& rCellSize ) const = 0;
97 
98         virtual ColorSharedPtr                   createColor() const = 0;
99 
100         virtual CanvasSharedPtr                  clone() const = 0;
101         virtual void                             clear() const = 0;
102 
103         // this should be considered private. if RTTI gets enabled
104         // someday, remove that to a separate interface
105         virtual ::com::sun::star::uno::Reference<
106             ::com::sun::star::rendering::XCanvas > 			getUNOCanvas() const = 0;
107         virtual ::com::sun::star::rendering::ViewState	 	getViewState() const = 0;
108     };
109 
110 }
111 
112 #endif /* _CPPCANVAS_CANVAS_HXX */
113