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 .
22 #include <vcl/dllapi.h>
23 #include <tools/long.hxx>
24 #include <tools/color.hxx>
25 #include <salgdiimpl.hxx>
28 #include <headless/CairoCommon.hxx>
30 class VCL_DLLPUBLIC SvpGraphicsBackend final
: public SalGraphicsImpl
32 CairoCommon
& m_rCairoCommon
;
35 SvpGraphicsBackend(CairoCommon
& rCairoCommon
);
39 void freeResources() override
;
41 OUString
getRenderBackendName() const override
{ return "svp"; }
43 void setClipRegion(vcl::Region
const& rRegion
) override
;
44 void ResetClipRegion() override
;
46 sal_uInt16
GetBitCount() const override
;
48 tools::Long
GetGraphicsWidth() const override
;
50 void SetLineColor() override
;
51 void SetLineColor(Color nColor
) override
;
52 void SetFillColor() override
;
53 void SetFillColor(Color nColor
) override
;
54 void SetXORMode(bool bSet
, bool bInvertOnly
) override
;
55 void SetROPLineColor(SalROPColor nROPColor
) override
;
56 void SetROPFillColor(SalROPColor nROPColor
) override
;
58 void drawPixel(tools::Long nX
, tools::Long nY
) override
;
59 void drawPixel(tools::Long nX
, tools::Long nY
, Color nColor
) override
;
61 void drawLine(tools::Long nX1
, tools::Long nY1
, tools::Long nX2
, tools::Long nY2
) override
;
62 void drawRect(tools::Long nX
, tools::Long nY
, tools::Long nWidth
, tools::Long nHeight
) override
;
63 void drawPolyLine(sal_uInt32 nPoints
, const Point
* pPointArray
) override
;
64 void drawPolygon(sal_uInt32 nPoints
, const Point
* pPointArray
) override
;
65 void drawPolyPolygon(sal_uInt32 nPoly
, const sal_uInt32
* pPoints
,
66 const Point
** pPointArray
) override
;
68 void drawPolyPolygon(const basegfx::B2DHomMatrix
& rObjectToDevice
,
69 const basegfx::B2DPolyPolygon
&, double fTransparency
) override
;
71 bool drawPolyLine(const basegfx::B2DHomMatrix
& rObjectToDevice
, const basegfx::B2DPolygon
&,
72 double fTransparency
, double fLineWidth
, const std::vector
<double>* pStroke
,
73 basegfx::B2DLineJoin
, css::drawing::LineCap
, double fMiterMinimumAngle
,
74 bool bPixelSnapHairline
) override
;
76 bool drawPolyLineBezier(sal_uInt32 nPoints
, const Point
* pPointArray
,
77 const PolyFlags
* pFlagArray
) override
;
79 bool drawPolygonBezier(sal_uInt32 nPoints
, const Point
* pPointArray
,
80 const PolyFlags
* pFlagArray
) override
;
82 bool drawPolyPolygonBezier(sal_uInt32 nPoly
, const sal_uInt32
* pPoints
,
83 const Point
* const* pPointArray
,
84 const PolyFlags
* const* pFlagArray
) override
;
86 void copyArea(tools::Long nDestX
, tools::Long nDestY
, tools::Long nSrcX
, tools::Long nSrcY
,
87 tools::Long nSrcWidth
, tools::Long nSrcHeight
, bool bWindowInvalidate
) override
;
89 void copyBits(const SalTwoRect
& rPosAry
, SalGraphics
* pSrcGraphics
) override
;
91 void drawBitmap(const SalTwoRect
& rPosAry
, const SalBitmap
& rSalBitmap
) override
;
93 void drawBitmap(const SalTwoRect
& rPosAry
, const SalBitmap
& rSalBitmap
,
94 const SalBitmap
& rMaskBitmap
) override
;
96 void drawMask(const SalTwoRect
& rPosAry
, const SalBitmap
& rSalBitmap
,
97 Color nMaskColor
) override
;
99 std::shared_ptr
<SalBitmap
> getBitmap(tools::Long nX
, tools::Long nY
, tools::Long nWidth
,
100 tools::Long nHeight
) override
;
102 Color
getPixel(tools::Long nX
, tools::Long nY
) override
;
104 void invert(tools::Long nX
, tools::Long nY
, tools::Long nWidth
, tools::Long nHeight
,
105 SalInvert nFlags
) override
;
107 void invert(sal_uInt32 nPoints
, const Point
* pPtAry
, SalInvert nFlags
) override
;
109 bool drawEPS(tools::Long nX
, tools::Long nY
, tools::Long nWidth
, tools::Long nHeight
,
110 void* pPtr
, sal_uInt32 nSize
) override
;
112 bool blendBitmap(const SalTwoRect
&, const SalBitmap
& rBitmap
) override
;
114 bool blendAlphaBitmap(const SalTwoRect
&, const SalBitmap
& rSrcBitmap
,
115 const SalBitmap
& rMaskBitmap
, const SalBitmap
& rAlphaBitmap
) override
;
117 bool drawAlphaBitmap(const SalTwoRect
&, const SalBitmap
& rSourceBitmap
,
118 const SalBitmap
& rAlphaBitmap
) override
;
120 bool drawTransformedBitmap(const basegfx::B2DPoint
& rNull
, const basegfx::B2DPoint
& rX
,
121 const basegfx::B2DPoint
& rY
, const SalBitmap
& rSourceBitmap
,
122 const SalBitmap
* pAlphaBitmap
, double fAlpha
) override
;
124 bool hasFastDrawTransformedBitmap() const override
;
126 bool drawAlphaRect(tools::Long nX
, tools::Long nY
, tools::Long nWidth
, tools::Long nHeight
,
127 sal_uInt8 nTransparency
) override
;
129 bool drawGradient(const tools::PolyPolygon
& rPolygon
, const Gradient
& rGradient
) override
;
130 bool implDrawGradient(basegfx::B2DPolyPolygon
const& rPolyPolygon
,
131 SalGradient
const& rGradient
) override
;
133 bool supportsOperation(OutDevSupportType eType
) const override
;
135 void drawBitmapBuffer(const SalTwoRect
& rPosAry
, const BitmapBuffer
* pBuffer
,
136 cairo_operator_t eOp
);
139 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */