1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_CANVAS_SOURCE_DIRECTX_DX_IMPLTOOLS_HXX
21 #define INCLUDED_CANVAS_SOURCE_DIRECTX_DX_IMPLTOOLS_HXX
23 #include <com/sun/star/uno/Reference.hxx>
24 #include <com/sun/star/uno/Sequence.hxx>
25 #include <com/sun/star/util/TriState.hpp>
27 #include <basegfx/polygon/b2dpolygon.hxx>
28 #include <basegfx/polygon/b2dpolypolygon.hxx>
29 #include <basegfx/numeric/ftools.hxx>
31 #include <boost/shared_ptr.hpp>
32 #include "dx_canvasfont.hxx"
43 namespace com
{ namespace sun
{ namespace star
{ namespace geometry
45 struct IntegerRectangle2D
;
49 namespace com
{ namespace sun
{ namespace star
{ namespace rendering
63 ::basegfx::B2DPolyPolygon
64 polyPolygonFromXPolyPolygon2D( const ::com::sun::star::uno::Reference
<
65 ::com::sun::star::rendering::XPolyPolygon2D
>& );
67 Gdiplus::Graphics
* createGraphicsFromHDC(HDC
);
68 Gdiplus::Graphics
* createGraphicsFromBitmap(const BitmapSharedPtr
&);
70 void setupGraphics( Gdiplus::Graphics
& rGraphics
);
72 void gdiPlusMatrixFromB2DHomMatrix( Gdiplus::Matrix
& rGdiplusMatrix
,
73 const ::basegfx::B2DHomMatrix
& rMatrix
);
74 void gdiPlusMatrixFromAffineMatrix2D( Gdiplus::Matrix
& rGdiplusMatrix
,
75 const ::com::sun::star::geometry::AffineMatrix2D
& rMatrix
);
77 Gdiplus::PointF
gdiPlusPointFFromRealPoint2D( const ::com::sun::star::geometry::RealPoint2D
& );
78 Gdiplus::RectF
gdiPlusRectFFromRectangle2D( const ::com::sun::star::geometry::RealRectangle2D
& );
79 Gdiplus::Rect
gdiPlusRectFromIntegerRectangle2D( const ::com::sun::star::geometry::IntegerRectangle2D
& );
80 RECT
gdiRectFromB2IRect( const ::basegfx::B2IRange
& );
82 ::com::sun::star::geometry::RealPoint2D
realPoint2DFromGdiPlusPointF( const Gdiplus::PointF
& );
83 ::com::sun::star::geometry::RealRectangle2D
realRectangle2DFromGdiPlusRectF( const Gdiplus::RectF
& );
85 ::basegfx::B2DPoint
b2dPointFromGdiPlusPointF( const Gdiplus::PointF
& );
86 ::basegfx::B2DRange
b2dRangeFromGdiPlusRectF( const Gdiplus::RectF
& );
88 ::com::sun::star::uno::Sequence
< double > argbToDoubleSequence( const Gdiplus::ARGB
& rColor
);
89 ::com::sun::star::uno::Sequence
< sal_Int8
> argbToIntSequence( const Gdiplus::ARGB
& rColor
);
90 Gdiplus::ARGB
sequenceToArgb( const ::com::sun::star::uno::Sequence
< sal_Int8
>& rColor
);
91 Gdiplus::ARGB
sequenceToArgb( const ::com::sun::star::uno::Sequence
< double >& rColor
);
93 GraphicsPathSharedPtr
graphicsPathFromRealPoint2DSequence( const ::com::sun::star::uno::Sequence
<
94 ::com::sun::star::uno::Sequence
< ::com::sun::star::geometry::RealPoint2D
> >& );
96 GraphicsPathSharedPtr
graphicsPathFromB2DPolygon(
97 const ::basegfx::B2DPolygon
& rPoly
,
98 bool bNoLineJoin
= false);
100 GraphicsPathSharedPtr
graphicsPathFromB2DPolyPolygon(
101 const ::basegfx::B2DPolyPolygon
& rPoly
,
102 bool bNoLineJoin
= false);
104 GraphicsPathSharedPtr
graphicsPathFromXPolyPolygon2D(
105 const ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XPolyPolygon2D
>&,
106 bool bNoLineJoin
= false );
108 bool drawGdiPlusBitmap( const GraphicsSharedPtr
& rGraphics
,
109 const BitmapSharedPtr
& rBitmap
);
110 bool drawDIBits( const ::boost::shared_ptr
< Gdiplus::Graphics
>& rGraphics
,
111 const BITMAPINFO
& rBI
,
114 bool drawRGBABits( const ::boost::shared_ptr
< Gdiplus::Graphics
>& rGraphics
,
115 const RawRGBABitmap
& rRawRGBAData
);
117 BitmapSharedPtr
bitmapFromXBitmap( const ::com::sun::star::uno::Reference
<
118 ::com::sun::star::rendering::XBitmap
>& xBitmap
);
120 CanvasFont::ImplRef
canvasFontFromXFont( const ::com::sun::star::uno::Reference
<
121 ::com::sun::star::rendering::XCanvasFont
>& xFont
);
123 void setModulateImageAttributes( Gdiplus::ImageAttributes
& o_rAttr
,
124 double nRedModulation
,
125 double nGreenModulation
,
126 double nBlueModulation
,
127 double nAlphaModulation
);
131 #endif // INCLUDED_CANVAS_SOURCE_DIRECTX_DX_IMPLTOOLS_HXX
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */