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 #pragma once
21 
22 #include <com/sun/star/uno/Reference.hxx>
23 #include <com/sun/star/uno/Sequence.hxx>
24 #include <com/sun/star/util/TriState.hpp>
25 
29 
30 #include <memory>
31 #include "dx_canvasfont.hxx"
32 
33 namespace basegfx
34 {
35  class B2DPoint;
36  class B2DRange;
37  class B2DHomMatrix;
38  class B2IRange;
39  class B2DPolyPolygon;
40 };
41 
43 {
44  struct IntegerRectangle2D;
45  struct RealPoint2D;
46 }
47 
49 {
50  class XBitmap;
51  class XPolyPolygon2D;
52  class XCanvasFont;
53 }
54 
55 
56 namespace dxcanvas::tools
57 {
58  struct RawRGBABitmap;
59 
61  polyPolygonFromXPolyPolygon2D( const css::uno::Reference< css::rendering::XPolyPolygon2D >& );
62 
63  Gdiplus::Graphics* createGraphicsFromHDC(HDC);
65 
66  void setupGraphics( Gdiplus::Graphics& rGraphics );
67 
68  void gdiPlusMatrixFromB2DHomMatrix( Gdiplus::Matrix& rGdiplusMatrix,
69  const ::basegfx::B2DHomMatrix& rMatrix );
70  void gdiPlusMatrixFromAffineMatrix2D( Gdiplus::Matrix& rGdiplusMatrix,
71  const css::geometry::AffineMatrix2D& rMatrix );
72 
73  Gdiplus::PointF gdiPlusPointFFromRealPoint2D( const css::geometry::RealPoint2D& );
74  Gdiplus::RectF gdiPlusRectFFromRectangle2D( const css::geometry::RealRectangle2D& );
75  Gdiplus::Rect gdiPlusRectFromIntegerRectangle2D( const css::geometry::IntegerRectangle2D& );
76  RECT gdiRectFromB2IRect( const ::basegfx::B2IRange& );
77 
78  css::geometry::RealPoint2D realPoint2DFromGdiPlusPointF( const Gdiplus::PointF& );
79  css::geometry::RealRectangle2D realRectangle2DFromGdiPlusRectF( const Gdiplus::RectF& );
80 
81  ::basegfx::B2DPoint b2dPointFromGdiPlusPointF( const Gdiplus::PointF& );
82  ::basegfx::B2DRange b2dRangeFromGdiPlusRectF( const Gdiplus::RectF& );
83 
84  css::uno::Sequence< sal_Int8 > argbToIntSequence( Gdiplus::ARGB rColor );
85  Gdiplus::ARGB sequenceToArgb( const css::uno::Sequence< sal_Int8 >& rColor );
86  Gdiplus::ARGB sequenceToArgb( const css::uno::Sequence< double >& rColor );
87 
89  css::uno::Sequence< css::geometry::RealPoint2D > >& );
90 
92  const ::basegfx::B2DPolygon& rPoly,
93  bool bNoLineJoin = false);
94 
96  const ::basegfx::B2DPolyPolygon& rPoly,
97  bool bNoLineJoin = false);
98 
100  const css::uno::Reference< css::rendering::XPolyPolygon2D >&,
101  bool bNoLineJoin = false );
102 
103  bool drawGdiPlusBitmap( const GraphicsSharedPtr& rGraphics,
104  const BitmapSharedPtr& rBitmap );
105  bool drawDIBits( const std::shared_ptr< Gdiplus::Graphics >& rGraphics,
106  const BITMAPINFO& rBI,
107  const void* pBits );
108 
109  bool drawRGBABits( const std::shared_ptr< Gdiplus::Graphics >& rGraphics,
110  const RawRGBABitmap& rRawRGBAData );
111 
112  BitmapSharedPtr bitmapFromXBitmap( const css::uno::Reference< css::rendering::XBitmap >& xBitmap );
113 
114  CanvasFont::ImplRef canvasFontFromXFont( const css::uno::Reference< css::rendering::XCanvasFont >& xFont );
115 
116  void setModulateImageAttributes( Gdiplus::ImageAttributes& o_rAttr,
117  double nRedModulation,
118  double nGreenModulation,
119  double nBlueModulation,
120  double nAlphaModulation );
121 }
122 
123 
124 /* 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)
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 &)
GraphicsSharedPtr createGraphicsFromBitmap(const BitmapSharedPtr &rBitmap)
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:61
::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:60
void gdiPlusMatrixFromAffineMatrix2D(Gdiplus::Matrix &rGdiplusMatrix, const geometry::AffineMatrix2D &rMatrix)