1*91c99ff4SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*91c99ff4SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*91c99ff4SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*91c99ff4SAndrew Rist  * distributed with this work for additional information
6*91c99ff4SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*91c99ff4SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*91c99ff4SAndrew Rist  * "License"); you may not use this file except in compliance
9*91c99ff4SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*91c99ff4SAndrew Rist  *
11*91c99ff4SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*91c99ff4SAndrew Rist  *
13*91c99ff4SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*91c99ff4SAndrew Rist  * software distributed under the License is distributed on an
15*91c99ff4SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*91c99ff4SAndrew Rist  * KIND, either express or implied.  See the License for the
17*91c99ff4SAndrew Rist  * specific language governing permissions and limitations
18*91c99ff4SAndrew Rist  * under the License.
19*91c99ff4SAndrew Rist  *
20*91c99ff4SAndrew Rist  *************************************************************/
21*91c99ff4SAndrew Rist 
22*91c99ff4SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _DXCANVAS_IMPLTOOLS_HXX
25cdf0e10cSrcweir #define _DXCANVAS_IMPLTOOLS_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <com/sun/star/uno/Reference.hxx>
28cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx>
29cdf0e10cSrcweir #include <com/sun/star/util/TriState.hpp>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygon.hxx>
32cdf0e10cSrcweir #include <basegfx/polygon/b2dpolypolygon.hxx>
33cdf0e10cSrcweir #include <basegfx/numeric/ftools.hxx>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir #include <boost/shared_ptr.hpp>
36cdf0e10cSrcweir #include "dx_canvasfont.hxx"
37cdf0e10cSrcweir 
38cdf0e10cSrcweir namespace basegfx
39cdf0e10cSrcweir {
40cdf0e10cSrcweir     class B2DPoint;
41cdf0e10cSrcweir     class B2DRange;
42cdf0e10cSrcweir     class B2DHomMatrix;
43cdf0e10cSrcweir     class B2IPoint;
44cdf0e10cSrcweir     class B2IRange;
45cdf0e10cSrcweir 	class B2DPolyPolygon;
46cdf0e10cSrcweir };
47cdf0e10cSrcweir 
48cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace geometry
49cdf0e10cSrcweir {
50cdf0e10cSrcweir     struct IntegerRectangle2D;
51cdf0e10cSrcweir     struct RealPoint2D;
52cdf0e10cSrcweir } } } }
53cdf0e10cSrcweir 
54cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace rendering
55cdf0e10cSrcweir {
56cdf0e10cSrcweir     class  XCanvas;
57cdf0e10cSrcweir     class  XGraphicDevice;
58cdf0e10cSrcweir     class  XBitmap;
59cdf0e10cSrcweir     class  XPolyPolygon2D;
60cdf0e10cSrcweir     class  XCanvasFont;
61cdf0e10cSrcweir } } } }
62cdf0e10cSrcweir 
63cdf0e10cSrcweir 
64cdf0e10cSrcweir namespace dxcanvas
65cdf0e10cSrcweir {
66cdf0e10cSrcweir     namespace tools
67cdf0e10cSrcweir     {
68cdf0e10cSrcweir         struct RawRGBABitmap;
69cdf0e10cSrcweir 
70cdf0e10cSrcweir         ::basegfx::B2DPolyPolygon
71cdf0e10cSrcweir         polyPolygonFromXPolyPolygon2D( const ::com::sun::star::uno::Reference<
72cdf0e10cSrcweir                                        ::com::sun::star::rendering::XPolyPolygon2D >& );
73cdf0e10cSrcweir 
74cdf0e10cSrcweir         Gdiplus::Graphics* createGraphicsFromHDC(HDC);
75cdf0e10cSrcweir         Gdiplus::Graphics* createGraphicsFromBitmap(const BitmapSharedPtr&);
76cdf0e10cSrcweir 
77cdf0e10cSrcweir         void setupGraphics( Gdiplus::Graphics& rGraphics );
78cdf0e10cSrcweir 
79cdf0e10cSrcweir         void gdiPlusMatrixFromB2DHomMatrix( Gdiplus::Matrix& 		rGdiplusMatrix,
80cdf0e10cSrcweir                                             const ::basegfx::B2DHomMatrix&	rMatrix );
81cdf0e10cSrcweir         void gdiPlusMatrixFromAffineMatrix2D( Gdiplus::Matrix& 							rGdiplusMatrix,
82cdf0e10cSrcweir                                               const ::com::sun::star::geometry::AffineMatrix2D& rMatrix );
83cdf0e10cSrcweir 
84cdf0e10cSrcweir         Gdiplus::PointF gdiPlusPointFFromRealPoint2D( const ::com::sun::star::geometry::RealPoint2D& );
85cdf0e10cSrcweir         Gdiplus::RectF 	gdiPlusRectFFromRectangle2D( const ::com::sun::star::geometry::RealRectangle2D& );
86cdf0e10cSrcweir         Gdiplus::Rect 	gdiPlusRectFromIntegerRectangle2D( const ::com::sun::star::geometry::IntegerRectangle2D& );
87cdf0e10cSrcweir         RECT 			gdiRectFromB2IRect( const ::basegfx::B2IRange& );
88cdf0e10cSrcweir 
89cdf0e10cSrcweir         ::com::sun::star::geometry::RealPoint2D		realPoint2DFromGdiPlusPointF( const Gdiplus::PointF& );
90cdf0e10cSrcweir         ::com::sun::star::geometry::RealRectangle2D	realRectangle2DFromGdiPlusRectF( const Gdiplus::RectF& );
91cdf0e10cSrcweir 
92cdf0e10cSrcweir         ::basegfx::B2DPoint	b2dPointFromGdiPlusPointF( const Gdiplus::PointF& );
93cdf0e10cSrcweir         ::basegfx::B2DRange	b2dRangeFromGdiPlusRectF( const Gdiplus::RectF& );
94cdf0e10cSrcweir 
95cdf0e10cSrcweir         ::com::sun::star::uno::Sequence< double > argbToDoubleSequence( const Gdiplus::ARGB& rColor );
96cdf0e10cSrcweir         ::com::sun::star::uno::Sequence< sal_Int8 > argbToIntSequence( const Gdiplus::ARGB& rColor );
97cdf0e10cSrcweir         Gdiplus::ARGB sequenceToArgb( const ::com::sun::star::uno::Sequence< sal_Int8 >& rColor );
98cdf0e10cSrcweir         Gdiplus::ARGB sequenceToArgb( const ::com::sun::star::uno::Sequence< double >&  rColor );
99cdf0e10cSrcweir 
100cdf0e10cSrcweir         GraphicsPathSharedPtr graphicsPathFromRealPoint2DSequence( const ::com::sun::star::uno::Sequence<
101cdf0e10cSrcweir                                                                  ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > >& );
102cdf0e10cSrcweir 
103cdf0e10cSrcweir         GraphicsPathSharedPtr graphicsPathFromB2DPolygon(
104cdf0e10cSrcweir             const ::basegfx::B2DPolygon& rPoly,
105cdf0e10cSrcweir             bool bNoLineJoin = false);
106cdf0e10cSrcweir 
107cdf0e10cSrcweir         GraphicsPathSharedPtr graphicsPathFromB2DPolyPolygon(
108cdf0e10cSrcweir             const ::basegfx::B2DPolyPolygon& rPoly,
109cdf0e10cSrcweir             bool bNoLineJoin = false);
110cdf0e10cSrcweir 
111cdf0e10cSrcweir         GraphicsPathSharedPtr graphicsPathFromXPolyPolygon2D(
112cdf0e10cSrcweir             const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >&,
113cdf0e10cSrcweir             bool bNoLineJoin = false );
114cdf0e10cSrcweir 
115cdf0e10cSrcweir         bool drawGdiPlusBitmap( const GraphicsSharedPtr& rGraphics,
116cdf0e10cSrcweir                                 const BitmapSharedPtr&	 rBitmap );
117cdf0e10cSrcweir         bool drawDIBits( const ::boost::shared_ptr< Gdiplus::Graphics >& rGraphics,
118cdf0e10cSrcweir                          const BITMAPINFO&                               rBI,
119cdf0e10cSrcweir                          const void*                                     pBits );
120cdf0e10cSrcweir 
121cdf0e10cSrcweir         bool drawRGBABits( const ::boost::shared_ptr< Gdiplus::Graphics >& rGraphics,
122cdf0e10cSrcweir                            const RawRGBABitmap&							   rRawRGBAData );
123cdf0e10cSrcweir 
124cdf0e10cSrcweir         BitmapSharedPtr bitmapFromXBitmap( const ::com::sun::star::uno::Reference<
125cdf0e10cSrcweir                                            		::com::sun::star::rendering::XBitmap >&	xBitmap );
126cdf0e10cSrcweir 
127cdf0e10cSrcweir         CanvasFont::ImplRef	canvasFontFromXFont( const ::com::sun::star::uno::Reference<
128cdf0e10cSrcweir                                                  	::com::sun::star::rendering::XCanvasFont >& xFont );
129cdf0e10cSrcweir 
130cdf0e10cSrcweir         void setModulateImageAttributes( Gdiplus::ImageAttributes& o_rAttr,
131cdf0e10cSrcweir                                          double                           nRedModulation,
132cdf0e10cSrcweir                                          double                           nGreenModulation,
133cdf0e10cSrcweir                                          double                           nBlueModulation,
134cdf0e10cSrcweir                                          double                           nAlphaModulation );
135cdf0e10cSrcweir     }
136cdf0e10cSrcweir }
137cdf0e10cSrcweir 
138cdf0e10cSrcweir #endif /* _DXCANVAS_IMPLTOOLS_HXX */
139