nss: upgrade to release 3.73
[LibreOffice.git] / vcl / inc / qt5 / Qt5Graphics.hxx
bloba163db87d94a7672c684b46793673da3ffa8bc31
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
22 #include <salgdi.hxx>
24 #include <memory>
26 #include <QtGui/QPainter>
27 #include <QtGui/QPainterPath>
28 #include <QtGui/QRegion>
30 #include "Qt5GraphicsBase.hxx"
32 class PhysicalFontCollection;
33 class QImage;
34 class QPushButton;
35 class Qt5Font;
36 class Qt5FontFace;
37 class Qt5Frame;
38 class Qt5Painter;
40 class Qt5Graphics final : public SalGraphics, public Qt5GraphicsBase
42 friend class Qt5Bitmap;
43 friend class Qt5Painter;
45 Qt5Frame* m_pFrame;
46 QImage* m_pQImage;
47 QRegion m_aClipRegion;
48 QPainterPath m_aClipPath;
49 Color m_aLineColor;
50 Color m_aFillColor;
51 QPainter::CompositionMode m_eCompositionMode;
53 rtl::Reference<Qt5Font> m_pTextStyle[MAX_FALLBACK];
54 Color m_aTextColor;
56 Qt5Graphics(Qt5Frame* pFrame, QImage* pQImage);
58 void drawScaledImage(const SalTwoRect& rPosAry, const QImage& rImage);
60 void handleDamage(const tools::Rectangle&) override;
62 public:
63 Qt5Graphics(Qt5Frame* pFrame)
64 : Qt5Graphics(pFrame, nullptr)
67 Qt5Graphics(QImage* pQImage)
68 : Qt5Graphics(nullptr, pQImage)
71 virtual ~Qt5Graphics() override;
73 void ChangeQImage(QImage* pImage);
75 virtual SalGraphicsImpl* GetImpl() const override;
76 virtual SystemGraphicsData GetGraphicsData() const override;
77 virtual bool supportsOperation(OutDevSupportType) const override;
78 virtual OUString getRenderBackendName() const override { return "qt5"; }
80 #if ENABLE_CAIRO_CANVAS
81 virtual bool SupportsCairo() const override;
82 virtual cairo::SurfaceSharedPtr
83 CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const override;
84 virtual cairo::SurfaceSharedPtr CreateSurface(const OutputDevice& rRefDevice, int x, int y,
85 int width, int height) const override;
86 virtual cairo::SurfaceSharedPtr CreateBitmapSurface(const OutputDevice& rRefDevice,
87 const BitmapSystemData& rData,
88 const Size& rSize) const override;
89 virtual css::uno::Any GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSurface,
90 const basegfx::B2ISize& rSize) const override;
91 #endif // ENABLE_CAIRO_CANVAS
93 // GDI
95 virtual bool setClipRegion(const vcl::Region&) override;
96 virtual void ResetClipRegion() override;
98 virtual void drawPixel(tools::Long nX, tools::Long nY) override;
99 virtual void drawPixel(tools::Long nX, tools::Long nY, Color nColor) override;
100 virtual void drawLine(tools::Long nX1, tools::Long nY1, tools::Long nX2,
101 tools::Long nY2) override;
102 virtual void drawRect(tools::Long nX, tools::Long nY, tools::Long nWidth,
103 tools::Long nHeight) override;
104 virtual void drawPolyLine(sal_uInt32 nPoints, const Point* pPtAry) override;
105 virtual void drawPolygon(sal_uInt32 nPoints, const Point* pPtAry) override;
106 virtual void drawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32* pPoints,
107 const Point** pPtAry) override;
108 virtual bool drawPolyPolygon(const basegfx::B2DHomMatrix& rObjectToDevice,
109 const basegfx::B2DPolyPolygon&, double fTransparency) override;
110 virtual bool drawPolyLineBezier(sal_uInt32 nPoints, const Point* pPtAry,
111 const PolyFlags* pFlgAry) override;
112 virtual bool drawPolygonBezier(sal_uInt32 nPoints, const Point* pPtAry,
113 const PolyFlags* pFlgAry) override;
114 virtual bool drawPolyPolygonBezier(sal_uInt32 nPoly, const sal_uInt32* pPoints,
115 const Point* const* pPtAry,
116 const PolyFlags* const* pFlgAry) override;
117 virtual bool drawPolyLine(const basegfx::B2DHomMatrix& rObjectToDevice,
118 const basegfx::B2DPolygon&, double fTransparency, double fLineWidths,
119 const std::vector<double>* pStroke, // MM01
120 basegfx::B2DLineJoin, css::drawing::LineCap eLineCap,
121 double fMiterMinimumAngle, bool bPixelSnapHairline) override;
122 virtual bool drawGradient(const tools::PolyPolygon&, const Gradient&) override;
124 virtual void copyArea(tools::Long nDestX, tools::Long nDestY, tools::Long nSrcX,
125 tools::Long nSrcY, tools::Long nSrcWidth, tools::Long nSrcHeight,
126 bool bWindowInvalidate) override;
128 virtual void copyBits(const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics) override;
129 virtual void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap) override;
130 virtual void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap,
131 const SalBitmap& rTransparentBitmap) override;
132 virtual void drawMask(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap,
133 Color nMaskColor) override;
135 virtual std::shared_ptr<SalBitmap> getBitmap(tools::Long nX, tools::Long nY, tools::Long nWidth,
136 tools::Long nHeight) override;
137 virtual Color getPixel(tools::Long nX, tools::Long nY) override;
139 virtual void invert(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight,
140 SalInvert nFlags) override;
141 virtual void invert(sal_uInt32 nPoints, const Point* pPtAry, SalInvert nFlags) override;
143 virtual bool drawEPS(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight,
144 void* pPtr, sal_uInt32 nSize) override;
146 virtual bool blendBitmap(const SalTwoRect&, const SalBitmap& rBitmap) override;
148 virtual bool blendAlphaBitmap(const SalTwoRect&, const SalBitmap& rSrcBitmap,
149 const SalBitmap& rMaskBitmap,
150 const SalBitmap& rAlphaBitmap) override;
152 virtual bool drawAlphaBitmap(const SalTwoRect&, const SalBitmap& rSourceBitmap,
153 const SalBitmap& rAlphaBitmap) override;
155 bool drawTransformedBitmap(const basegfx::B2DPoint& rNull, const basegfx::B2DPoint& rX,
156 const basegfx::B2DPoint& rY, const SalBitmap& rSourceBitmap,
157 const SalBitmap* pAlphaBitmap) override;
159 virtual bool drawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWidth,
160 tools::Long nHeight, sal_uInt8 nTransparency) override;
162 virtual void GetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY) override;
163 virtual sal_uInt16 GetBitCount() const override;
164 virtual tools::Long GetGraphicsWidth() const override;
166 virtual void SetLineColor() override;
167 virtual void SetLineColor(Color nColor) override;
168 virtual void SetFillColor() override;
169 virtual void SetFillColor(Color nColor) override;
170 virtual void SetXORMode(bool bSet, bool bInvertOnly) override;
171 virtual void SetROPLineColor(SalROPColor nROPColor) override;
172 virtual void SetROPFillColor(SalROPColor nROPColor) override;
174 // Text rendering + font support
176 virtual void SetTextColor(Color nColor) override;
177 virtual void SetFont(LogicalFontInstance*, int nFallbackLevel) override;
178 virtual void GetFontMetric(ImplFontMetricDataRef&, int nFallbackLevel) override;
179 virtual FontCharMapRef GetFontCharMap() const override;
180 virtual bool GetFontCapabilities(vcl::FontCapabilities& rFontCapabilities) const override;
181 virtual void GetDevFontList(PhysicalFontCollection*) override;
182 virtual void ClearDevFontCache() override;
183 virtual bool AddTempDevFont(PhysicalFontCollection*, const OUString& rFileURL,
184 const OUString& rFontName) override;
185 virtual bool CreateFontSubset(const OUString& rToFile, const PhysicalFontFace* pFont,
186 const sal_GlyphId* pGlyphIds, const sal_uInt8* pEncoding,
187 sal_Int32* pWidths, int nGlyphs,
188 FontSubsetInfo& rInfo // out parameter
189 ) override;
191 virtual const void* GetEmbedFontData(const PhysicalFontFace*, tools::Long* pDataLen) override;
192 virtual void FreeEmbedFontData(const void* pData, tools::Long nDataLen) override;
194 virtual void GetGlyphWidths(const PhysicalFontFace*, bool bVertical,
195 std::vector<sal_Int32>& rWidths, Ucs2UIntMap& rUnicodeEnc) override;
197 virtual std::unique_ptr<GenericSalLayout> GetTextLayout(int nFallbackLevel) override;
198 virtual void DrawTextLayout(const GenericSalLayout&) override;
201 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */