LibreOffice Module vcl (master)  1
salgdiimpl.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_VCL_INC_SALGDIIMPL_HXX
21 #define INCLUDED_VCL_INC_SALGDIIMPL_HXX
22 
23 #include <vcl/dllapi.h>
24 
25 #include <tools/color.hxx>
26 #include <tools/poly.hxx>
27 
28 #include <vcl/salgtype.hxx>
29 #include <vcl/region.hxx>
30 #include <vcl/vclenum.hxx>
31 
32 #include <com/sun/star/drawing/LineCap.hpp>
33 
34 class SalGraphics;
35 class SalBitmap;
36 class SalFrame;
37 class Gradient;
38 class SalVirtualDevice;
39 struct SalGradient;
40 
42 {
44 public:
45 
46  void setAntiAlias(bool bNew)
47  {
48  m_bAntiAlias = bNew;
49  }
50 
51  bool getAntiAlias() const
52  {
53  return m_bAntiAlias;
54  }
55 
57  : m_bAntiAlias(false)
58  {}
59 
60  virtual ~SalGraphicsImpl();
61 
62  virtual void Init() = 0;
63 
64  virtual void DeInit() {}
65 
66  virtual void freeResources() = 0;
67 
68  virtual OUString getRenderBackendName() const = 0;
69 
70  virtual bool setClipRegion( const vcl::Region& ) = 0;
71  //
72  // get the depth of the device
73  virtual sal_uInt16 GetBitCount() const = 0;
74 
75  // get the width of the device
76  virtual tools::Long GetGraphicsWidth() const = 0;
77 
78  // set the clip region to empty
79  virtual void ResetClipRegion() = 0;
80 
81  // set the line color to transparent (= don't draw lines)
82 
83  virtual void SetLineColor() = 0;
84 
85  // set the line color to a specific color
86  virtual void SetLineColor( Color nColor ) = 0;
87 
88  // set the fill color to transparent (= don't fill)
89  virtual void SetFillColor() = 0;
90 
91  // set the fill color to a specific color, shapes will be
92  // filled accordingly
93  virtual void SetFillColor( Color nColor ) = 0;
94 
95  // enable/disable XOR drawing
96  virtual void SetXORMode( bool bSet, bool bInvertOnly ) = 0;
97 
98  // set line color for raster operations
99  virtual void SetROPLineColor( SalROPColor nROPColor ) = 0;
100 
101  // set fill color for raster operations
102  virtual void SetROPFillColor( SalROPColor nROPColor ) = 0;
103 
104  // draw --> LineColor and FillColor and RasterOp and ClipRegion
105  virtual void drawPixel( tools::Long nX, tools::Long nY ) = 0;
106  virtual void drawPixel( tools::Long nX, tools::Long nY, Color nColor ) = 0;
107 
108  virtual void drawLine( tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2 ) = 0;
109 
110  virtual void drawRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) = 0;
111 
112  virtual void drawPolyLine( sal_uInt32 nPoints, const Point* pPtAry ) = 0;
113 
114  virtual void drawPolygon( sal_uInt32 nPoints, const Point* pPtAry ) = 0;
115 
116  virtual void drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, const Point** pPtAry ) = 0;
117 
118  virtual bool drawPolyPolygon(
119  const basegfx::B2DHomMatrix& rObjectToDevice,
121  double fTransparency) = 0;
122 
123  virtual bool drawPolyLine(
124  const basegfx::B2DHomMatrix& rObjectToDevice,
125  const basegfx::B2DPolygon&,
126  double fTransparency,
127  double fLineWidth,
128  const std::vector< double >* pStroke, // MM01
130  css::drawing::LineCap,
131  double fMiterMinimumAngle,
132  bool bPixelSnapHairline) = 0;
133 
134  virtual bool drawPolyLineBezier(
135  sal_uInt32 nPoints,
136  const Point* pPtAry,
137  const PolyFlags* pFlgAry ) = 0;
138 
139  virtual bool drawPolygonBezier(
140  sal_uInt32 nPoints,
141  const Point* pPtAry,
142  const PolyFlags* pFlgAry ) = 0;
143 
144  virtual bool drawPolyPolygonBezier(
145  sal_uInt32 nPoly,
146  const sal_uInt32* pPoints,
147  const Point* const* pPtAry,
148  const PolyFlags* const* pFlgAry ) = 0;
149 
150  // CopyArea --> No RasterOp, but ClipRegion
151  virtual void copyArea(
152  tools::Long nDestX, tools::Long nDestY,
153  tools::Long nSrcX, tools::Long nSrcY,
154  tools::Long nSrcWidth, tools::Long nSrcHeight,
155  bool bWindowInvalidate ) = 0;
156 
157  // CopyBits and DrawBitmap --> RasterOp and ClipRegion
158  // CopyBits() --> pSrcGraphics == NULL, then CopyBits on same Graphics
159  virtual void copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) = 0;
160 
161  virtual void drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap ) = 0;
162 
163  virtual void drawBitmap(
164  const SalTwoRect& rPosAry,
165  const SalBitmap& rSalBitmap,
166  const SalBitmap& rMaskBitmap ) = 0;
167 
168  virtual void drawMask(
169  const SalTwoRect& rPosAry,
170  const SalBitmap& rSalBitmap,
171  Color nMaskColor ) = 0;
172 
173  virtual std::shared_ptr<SalBitmap> getBitmap( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) = 0;
174 
175  virtual Color getPixel( tools::Long nX, tools::Long nY ) = 0;
176 
177  // invert --> ClipRegion (only Windows or VirDevs)
178  virtual void invert(
179  tools::Long nX, tools::Long nY,
180  tools::Long nWidth, tools::Long nHeight,
181  SalInvert nFlags) = 0;
182 
183  virtual void invert( sal_uInt32 nPoints, const Point* pPtAry, SalInvert nFlags ) = 0;
184 
185  virtual bool drawEPS(
186  tools::Long nX, tools::Long nY,
187  tools::Long nWidth, tools::Long nHeight,
188  void* pPtr,
189  sal_uInt32 nSize ) = 0;
190 
191  virtual bool blendBitmap(
192  const SalTwoRect&,
193  const SalBitmap& rBitmap ) = 0;
194 
195  virtual bool blendAlphaBitmap(
196  const SalTwoRect&,
197  const SalBitmap& rSrcBitmap,
198  const SalBitmap& rMaskBitmap,
199  const SalBitmap& rAlphaBitmap ) = 0;
200 
201  virtual bool drawAlphaBitmap(
202  const SalTwoRect&,
203  const SalBitmap& rSourceBitmap,
204  const SalBitmap& rAlphaBitmap ) = 0;
205 
207  virtual bool drawTransformedBitmap(
208  const basegfx::B2DPoint& rNull,
209  const basegfx::B2DPoint& rX,
210  const basegfx::B2DPoint& rY,
211  const SalBitmap& rSourceBitmap,
212  const SalBitmap* pAlphaBitmap,
213  double fAlpha) = 0;
214 
217  virtual bool hasFastDrawTransformedBitmap() const = 0;
218 
219  virtual bool drawAlphaRect(
220  tools::Long nX, tools::Long nY,
221  tools::Long nWidth, tools::Long nHeight,
222  sal_uInt8 nTransparency ) = 0;
223 
224  virtual bool drawGradient(const tools::PolyPolygon& rPolygon, const Gradient& rGradient) = 0;
225  virtual bool implDrawGradient(basegfx::B2DPolyPolygon const & rPolyPolygon, SalGradient const & rGradient) = 0;
226 
227  virtual bool supportsOperation(OutDevSupportType eType) const = 0;
228 };
229 
230 #endif
231 
232 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void Init()
SalROPColor
Definition: salgtype.hxx:70
void setAntiAlias(bool bNew)
Definition: salgdiimpl.hxx:46
long Long
void drawPolygon(VirtualDevice *dev, bool drawFrame, tools::Polygon const &orig, Size const &pSize)
draws a polygon knowing penSize
Definition: shape.cxx:218
OutDevSupportType
Definition: vclenum.hxx:194
virtual void DeInit()
Definition: salgdiimpl.hxx:64
void drawLine(VirtualDevice *dev, Point const &orig, Point const &dest, Size const &pSize)
draws a line from orig to dest knowing penSize
Definition: shape.cxx:111
SalInvert
Definition: salgtype.hxx:74
#define VCL_PLUGIN_PUBLIC
Definition: dllapi.h:40
A SalFrame is a system window (e.g. an X11 window).
Definition: salframe.hxx:112
unsigned char sal_uInt8
A non-visible drawable/buffer (e.g. an X11 Pixmap).
Definition: salvd.hxx:28
void SetLineColor(const css::uno::Reference< css::beans::XPropertySet > &xGridProperties, sal_Int32 nColor)
bool getAntiAlias() const
Definition: salgdiimpl.hxx:51
PolyFlags