xref: /AOO41X/main/canvas/source/directx/dx_impltools.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef _DXCANVAS_IMPLTOOLS_HXX
29*cdf0e10cSrcweir #define _DXCANVAS_IMPLTOOLS_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <com/sun/star/uno/Reference.hxx>
32*cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx>
33*cdf0e10cSrcweir #include <com/sun/star/util/TriState.hpp>
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygon.hxx>
36*cdf0e10cSrcweir #include <basegfx/polygon/b2dpolypolygon.hxx>
37*cdf0e10cSrcweir #include <basegfx/numeric/ftools.hxx>
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir #include <boost/shared_ptr.hpp>
40*cdf0e10cSrcweir #include "dx_canvasfont.hxx"
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir namespace basegfx
43*cdf0e10cSrcweir {
44*cdf0e10cSrcweir     class B2DPoint;
45*cdf0e10cSrcweir     class B2DRange;
46*cdf0e10cSrcweir     class B2DHomMatrix;
47*cdf0e10cSrcweir     class B2IPoint;
48*cdf0e10cSrcweir     class B2IRange;
49*cdf0e10cSrcweir 	class B2DPolyPolygon;
50*cdf0e10cSrcweir };
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace geometry
53*cdf0e10cSrcweir {
54*cdf0e10cSrcweir     struct IntegerRectangle2D;
55*cdf0e10cSrcweir     struct RealPoint2D;
56*cdf0e10cSrcweir } } } }
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace rendering
59*cdf0e10cSrcweir {
60*cdf0e10cSrcweir     class  XCanvas;
61*cdf0e10cSrcweir     class  XGraphicDevice;
62*cdf0e10cSrcweir     class  XBitmap;
63*cdf0e10cSrcweir     class  XPolyPolygon2D;
64*cdf0e10cSrcweir     class  XCanvasFont;
65*cdf0e10cSrcweir } } } }
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir namespace dxcanvas
69*cdf0e10cSrcweir {
70*cdf0e10cSrcweir     namespace tools
71*cdf0e10cSrcweir     {
72*cdf0e10cSrcweir         struct RawRGBABitmap;
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir         ::basegfx::B2DPolyPolygon
75*cdf0e10cSrcweir         polyPolygonFromXPolyPolygon2D( const ::com::sun::star::uno::Reference<
76*cdf0e10cSrcweir                                        ::com::sun::star::rendering::XPolyPolygon2D >& );
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir         Gdiplus::Graphics* createGraphicsFromHDC(HDC);
79*cdf0e10cSrcweir         Gdiplus::Graphics* createGraphicsFromBitmap(const BitmapSharedPtr&);
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir         void setupGraphics( Gdiplus::Graphics& rGraphics );
82*cdf0e10cSrcweir 
83*cdf0e10cSrcweir         void gdiPlusMatrixFromB2DHomMatrix( Gdiplus::Matrix& 		rGdiplusMatrix,
84*cdf0e10cSrcweir                                             const ::basegfx::B2DHomMatrix&	rMatrix );
85*cdf0e10cSrcweir         void gdiPlusMatrixFromAffineMatrix2D( Gdiplus::Matrix& 							rGdiplusMatrix,
86*cdf0e10cSrcweir                                               const ::com::sun::star::geometry::AffineMatrix2D& rMatrix );
87*cdf0e10cSrcweir 
88*cdf0e10cSrcweir         Gdiplus::PointF gdiPlusPointFFromRealPoint2D( const ::com::sun::star::geometry::RealPoint2D& );
89*cdf0e10cSrcweir         Gdiplus::RectF 	gdiPlusRectFFromRectangle2D( const ::com::sun::star::geometry::RealRectangle2D& );
90*cdf0e10cSrcweir         Gdiplus::Rect 	gdiPlusRectFromIntegerRectangle2D( const ::com::sun::star::geometry::IntegerRectangle2D& );
91*cdf0e10cSrcweir         RECT 			gdiRectFromB2IRect( const ::basegfx::B2IRange& );
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir         ::com::sun::star::geometry::RealPoint2D		realPoint2DFromGdiPlusPointF( const Gdiplus::PointF& );
94*cdf0e10cSrcweir         ::com::sun::star::geometry::RealRectangle2D	realRectangle2DFromGdiPlusRectF( const Gdiplus::RectF& );
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir         ::basegfx::B2DPoint	b2dPointFromGdiPlusPointF( const Gdiplus::PointF& );
97*cdf0e10cSrcweir         ::basegfx::B2DRange	b2dRangeFromGdiPlusRectF( const Gdiplus::RectF& );
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir         ::com::sun::star::uno::Sequence< double > argbToDoubleSequence( const Gdiplus::ARGB& rColor );
100*cdf0e10cSrcweir         ::com::sun::star::uno::Sequence< sal_Int8 > argbToIntSequence( const Gdiplus::ARGB& rColor );
101*cdf0e10cSrcweir         Gdiplus::ARGB sequenceToArgb( const ::com::sun::star::uno::Sequence< sal_Int8 >& rColor );
102*cdf0e10cSrcweir         Gdiplus::ARGB sequenceToArgb( const ::com::sun::star::uno::Sequence< double >&  rColor );
103*cdf0e10cSrcweir 
104*cdf0e10cSrcweir         GraphicsPathSharedPtr graphicsPathFromRealPoint2DSequence( const ::com::sun::star::uno::Sequence<
105*cdf0e10cSrcweir                                                                  ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > >& );
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir         GraphicsPathSharedPtr graphicsPathFromB2DPolygon(
108*cdf0e10cSrcweir             const ::basegfx::B2DPolygon& rPoly,
109*cdf0e10cSrcweir             bool bNoLineJoin = false);
110*cdf0e10cSrcweir 
111*cdf0e10cSrcweir         GraphicsPathSharedPtr graphicsPathFromB2DPolyPolygon(
112*cdf0e10cSrcweir             const ::basegfx::B2DPolyPolygon& rPoly,
113*cdf0e10cSrcweir             bool bNoLineJoin = false);
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir         GraphicsPathSharedPtr graphicsPathFromXPolyPolygon2D(
116*cdf0e10cSrcweir             const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >&,
117*cdf0e10cSrcweir             bool bNoLineJoin = false );
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir         bool drawGdiPlusBitmap( const GraphicsSharedPtr& rGraphics,
120*cdf0e10cSrcweir                                 const BitmapSharedPtr&	 rBitmap );
121*cdf0e10cSrcweir         bool drawDIBits( const ::boost::shared_ptr< Gdiplus::Graphics >& rGraphics,
122*cdf0e10cSrcweir                          const BITMAPINFO&                               rBI,
123*cdf0e10cSrcweir                          const void*                                     pBits );
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir         bool drawRGBABits( const ::boost::shared_ptr< Gdiplus::Graphics >& rGraphics,
126*cdf0e10cSrcweir                            const RawRGBABitmap&							   rRawRGBAData );
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir         BitmapSharedPtr bitmapFromXBitmap( const ::com::sun::star::uno::Reference<
129*cdf0e10cSrcweir                                            		::com::sun::star::rendering::XBitmap >&	xBitmap );
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir         CanvasFont::ImplRef	canvasFontFromXFont( const ::com::sun::star::uno::Reference<
132*cdf0e10cSrcweir                                                  	::com::sun::star::rendering::XCanvasFont >& xFont );
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir         void setModulateImageAttributes( Gdiplus::ImageAttributes& o_rAttr,
135*cdf0e10cSrcweir                                          double                           nRedModulation,
136*cdf0e10cSrcweir                                          double                           nGreenModulation,
137*cdf0e10cSrcweir                                          double                           nBlueModulation,
138*cdf0e10cSrcweir                                          double                           nAlphaModulation );
139*cdf0e10cSrcweir     }
140*cdf0e10cSrcweir }
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir #endif /* _DXCANVAS_IMPLTOOLS_HXX */
143