LibreOffice Module canvas (master)  1
dx_impltools.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #ifndef INCLUDED_CANVAS_SOURCE_DIRECTX_DX_IMPLTOOLS_HXX
21 #define INCLUDED_CANVAS_SOURCE_DIRECTX_DX_IMPLTOOLS_HXX
22 
23 #include <com/sun/star/uno/Reference.hxx>
24 #include <com/sun/star/uno/Sequence.hxx>
25 #include <com/sun/star/util/TriState.hpp>
26 
30 
31 #include <memory>
32 #include "dx_canvasfont.hxx"
33 
34 namespace basegfx
35 {
36  class B2DPoint;
37  class B2DRange;
38  class B2DHomMatrix;
39  class B2IRange;
40  class B2DPolyPolygon;
41 };
42 
44 {
45  struct IntegerRectangle2D;
46  struct RealPoint2D;
47 }
48 
50 {
51  class XBitmap;
52  class XPolyPolygon2D;
53  class XCanvasFont;
54 }
55 
56 
57 namespace dxcanvas
58 {
59  namespace tools
60  {
61  struct RawRGBABitmap;
62 
64  polyPolygonFromXPolyPolygon2D( const css::uno::Reference< css::rendering::XPolyPolygon2D >& );
65 
66  Gdiplus::Graphics* createGraphicsFromHDC(HDC);
67  Gdiplus::Graphics* createGraphicsFromBitmap(const BitmapSharedPtr&);
68 
69  void setupGraphics( Gdiplus::Graphics& rGraphics );
70 
71  void gdiPlusMatrixFromB2DHomMatrix( Gdiplus::Matrix& rGdiplusMatrix,
72  const ::basegfx::B2DHomMatrix& rMatrix );
73  void gdiPlusMatrixFromAffineMatrix2D( Gdiplus::Matrix& rGdiplusMatrix,
74  const css::geometry::AffineMatrix2D& rMatrix );
75 
76  Gdiplus::PointF gdiPlusPointFFromRealPoint2D( const css::geometry::RealPoint2D& );
77  Gdiplus::RectF gdiPlusRectFFromRectangle2D( const css::geometry::RealRectangle2D& );
78  Gdiplus::Rect gdiPlusRectFromIntegerRectangle2D( const css::geometry::IntegerRectangle2D& );
79  RECT gdiRectFromB2IRect( const ::basegfx::B2IRange& );
80 
81  css::geometry::RealPoint2D realPoint2DFromGdiPlusPointF( const Gdiplus::PointF& );
82  css::geometry::RealRectangle2D realRectangle2DFromGdiPlusRectF( const Gdiplus::RectF& );
83 
84  ::basegfx::B2DPoint b2dPointFromGdiPlusPointF( const Gdiplus::PointF& );
85  ::basegfx::B2DRange b2dRangeFromGdiPlusRectF( const Gdiplus::RectF& );
86 
87  css::uno::Sequence< sal_Int8 > argbToIntSequence( Gdiplus::ARGB rColor );
88  Gdiplus::ARGB sequenceToArgb( const css::uno::Sequence< sal_Int8 >& rColor );
89  Gdiplus::ARGB sequenceToArgb( const css::uno::Sequence< double >& rColor );
90 
92  css::uno::Sequence< css::geometry::RealPoint2D > >& );
93 
95  const ::basegfx::B2DPolygon& rPoly,
96  bool bNoLineJoin = false);
97 
99  const ::basegfx::B2DPolyPolygon& rPoly,
100  bool bNoLineJoin = false);
101 
103  const css::uno::Reference< css::rendering::XPolyPolygon2D >&,
104  bool bNoLineJoin = false );
105 
106  bool drawGdiPlusBitmap( const GraphicsSharedPtr& rGraphics,
107  const BitmapSharedPtr& rBitmap );
108  bool drawDIBits( const std::shared_ptr< Gdiplus::Graphics >& rGraphics,
109  const BITMAPINFO& rBI,
110  const void* pBits );
111 
112  bool drawRGBABits( const std::shared_ptr< Gdiplus::Graphics >& rGraphics,
113  const RawRGBABitmap& rRawRGBAData );
114 
115  BitmapSharedPtr bitmapFromXBitmap( const css::uno::Reference< css::rendering::XBitmap >& xBitmap );
116 
117  CanvasFont::ImplRef canvasFontFromXFont( const css::uno::Reference< css::rendering::XCanvasFont >& xFont );
118 
119  void setModulateImageAttributes( Gdiplus::ImageAttributes& o_rAttr,
120  double nRedModulation,
121  double nGreenModulation,
122  double nBlueModulation,
123  double nAlphaModulation );
124  }
125 }
126 
127 #endif // INCLUDED_CANVAS_SOURCE_DIRECTX_DX_IMPLTOOLS_HXX
128 
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
GraphicsPathSharedPtr graphicsPathFromXPolyPolygon2D(const uno::Reference< rendering::XPolyPolygon2D > &xPoly, bool bNoLineJoin)
GraphicsPathSharedPtr graphicsPathFromB2DPolygon(const ::basegfx::B2DPolygon &rPoly, bool bNoLineJoin)
void setModulateImageAttributes(Gdiplus::ImageAttributes &o_rAttr, double nRedModulation, double nGreenModulation, double nBlueModulation, double nAlphaModulation)
Gdiplus::Graphics * createGraphicsFromBitmap(const BitmapSharedPtr &rBitmap)
GraphicsPathSharedPtr graphicsPathFromRealPoint2DSequence(const uno::Sequence< uno::Sequence< geometry::RealPoint2D > > &points)
Gdiplus::ARGB sequenceToArgb(const uno::Sequence< sal_Int8 > &rColor)
Gdiplus::RectF gdiPlusRectFFromRectangle2D(const geometry::RealRectangle2D &rRect)
bool drawDIBits(const std::shared_ptr< Gdiplus::Graphics > &rGraphics, const BITMAPINFO &rBI, const void *pBits)
Gdiplus::Rect gdiPlusRectFromIntegerRectangle2D(const geometry::IntegerRectangle2D &rRect)
geometry::RealPoint2D realPoint2DFromGdiPlusPointF(const Gdiplus::PointF &rPoint)
::basegfx::B2DPolyPolygon polyPolygonFromXPolyPolygon2D(const uno::Reference< rendering::XPolyPolygon2D > &xPoly)
bool drawGdiPlusBitmap(const GraphicsSharedPtr &rGraphics, const BitmapSharedPtr &rBitmap)
Gdiplus::Graphics * createGraphicsFromHDC(HDC aHDC)
::basegfx::B2DPoint b2dPointFromGdiPlusPointF(const Gdiplus::PointF &rPoint)
bool drawRGBABits(const std::shared_ptr< Gdiplus::Graphics > &rGraphics, const RawRGBABitmap &rRawRGBAData)
std::shared_ptr< ::cppcanvas::Bitmap > BitmapSharedPtr
Gdiplus::PointF gdiPlusPointFFromRealPoint2D(const css::geometry::RealPoint2D &)
void gdiPlusMatrixFromB2DHomMatrix(Gdiplus::Matrix &rGdiplusMatrix, const ::basegfx::B2DHomMatrix &rMatrix)
RECT gdiRectFromB2IRect(const ::basegfx::B2IRange &rRect)
GraphicsPathSharedPtr graphicsPathFromB2DPolyPolygon(const ::basegfx::B2DPolyPolygon &rPoly, bool bNoLineJoin)
uno::Sequence< sal_Int8 > argbToIntSequence(Gdiplus::ARGB rColor)
geometry::RealRectangle2D realRectangle2DFromGdiPlusRectF(const Gdiplus::RectF &rRect)
CanvasFont::ImplRef canvasFontFromXFont(const uno::Reference< rendering::XCanvasFont > &xFont)
std::shared_ptr< Gdiplus::GraphicsPath > GraphicsPathSharedPtr
Definition: dx_winstuff.hxx:62
::basegfx::B2DRange b2dRangeFromGdiPlusRectF(const Gdiplus::RectF &rRect)
rtl::Reference< CanvasFont > ImplRef
void setupGraphics(Gdiplus::Graphics &rGraphics)
BitmapSharedPtr bitmapFromXBitmap(const uno::Reference< rendering::XBitmap > &xBitmap)
std::shared_ptr< Gdiplus::Graphics > GraphicsSharedPtr
Definition: dx_winstuff.hxx:61
void gdiPlusMatrixFromAffineMatrix2D(Gdiplus::Matrix &rGdiplusMatrix, const geometry::AffineMatrix2D &rMatrix)