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