LibreOffice Module canvas (master)  1
ogl_spritedevicehelper.cxx
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 
10 #include <sal/config.h>
11 #include <sal/log.hxx>
12 
16 #include <com/sun/star/awt/XTopWindow.hpp>
17 #include <com/sun/star/rendering/XIntegerBitmapColorSpace.hpp>
18 #include <com/sun/star/uno/Reference.hxx>
20 #include <vcl/canvastools.hxx>
22 #include <vcl/syschild.hxx>
23 
25 #include "ogl_spritecanvas.hxx"
26 #include "ogl_canvasbitmap.hxx"
27 #include "ogl_canvastools.hxx"
29 #include "ogl_texturecache.hxx"
30 
31 using namespace ::com::sun::star;
32 
33 static void initContext()
34 {
35  // need the backside for mirror effects
36  glDisable(GL_CULL_FACE);
37 
38  // no perspective, we're 2D
39  glMatrixMode(GL_PROJECTION);
40  glLoadIdentity();
41 
42  // misc preferences
43  glEnable(GL_POINT_SMOOTH);
44  glEnable(GL_LINE_SMOOTH);
45  glEnable(GL_POLYGON_SMOOTH);
46  glHint(GL_POINT_SMOOTH_HINT,GL_NICEST);
47  glHint(GL_LINE_SMOOTH_HINT,GL_NICEST);
48  glHint(GL_POLYGON_SMOOTH_HINT,GL_NICEST);
49  glShadeModel(GL_FLAT);
50 }
51 
52 static void initTransformation(const ::Size& rSize)
53 {
54  // use whole window
55  glViewport( 0,0,
56  static_cast<GLsizei>(rSize.Width()),
57  static_cast<GLsizei>(rSize.Height()) );
58 
59  // model coordinate system is already in device pixel
60  glMatrixMode(GL_MODELVIEW);
61  glLoadIdentity();
62  glTranslated(-1.0, 1.0, 0.0);
63  glScaled( 2.0 / rSize.Width(),
64  -2.0 / rSize.Height(),
65  1.0 );
66 
67  // clear to black
68  glClearColor(0,0,0,0);
69  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
70 }
71 
72 namespace oglcanvas
73 {
74 
76  mpSpriteCanvas(nullptr),
77  maActiveSprites(),
78  maLastUpdate(),
79  mpTextureCache(std::make_shared<TextureCache>()),
80  mnLinearTwoColorGradientProgram(0),
81  mnLinearMultiColorGradientProgram(0),
82  mnRadialTwoColorGradientProgram(0),
83  mnRadialMultiColorGradientProgram(0),
84  mnRectangularTwoColorGradientProgram(0),
85  mnRectangularMultiColorGradientProgram(0),
87  {}
88 
90  { mxContext->dispose(); }
91 
93  SpriteCanvas& rSpriteCanvas,
94  const awt::Rectangle& rViewArea )
95  {
96  mpSpriteCanvas = &rSpriteCanvas;
97 
98  rSpriteCanvas.setWindow(
99  uno::Reference<awt::XWindow2>(
100  VCLUnoHelper::GetInterface(&rWindow),
101  uno::UNO_QUERY_THROW) );
102 
103  mxContext->requestLegacyContext();
104  mxContext->init(&rWindow);
105  // init window context
106  initContext();
107 
109  OpenGLHelper::LoadShaders("dummyVertexShader", "linearMultiColorGradientFragmentShader");
110 
112  OpenGLHelper::LoadShaders("dummyVertexShader", "linearTwoColorGradientFragmentShader");
113 
115  OpenGLHelper::LoadShaders("dummyVertexShader", "radialMultiColorGradientFragmentShader");
116 
118  OpenGLHelper::LoadShaders("dummyVertexShader", "radialTwoColorGradientFragmentShader");
119 
121  OpenGLHelper::LoadShaders("dummyVertexShader", "rectangularMultiColorGradientFragmentShader");
122 
124  OpenGLHelper::LoadShaders("dummyVertexShader", "rectangularTwoColorGradientFragmentShader");
125 
126  mxContext->makeCurrent();
127 
128  notifySizeUpdate(rViewArea);
129  // TODO(E3): check for GL_ARB_imaging extension
130  }
131 
133  {
134  // release all references
135  mpSpriteCanvas = nullptr;
136  mpTextureCache.reset();
137 
138  if( mxContext->isInitialized() )
139  {
140  glDeleteProgram( mnRectangularTwoColorGradientProgram );
141  glDeleteProgram( mnRectangularMultiColorGradientProgram );
142  glDeleteProgram( mnRadialTwoColorGradientProgram );
143  glDeleteProgram( mnRadialMultiColorGradientProgram );
144  glDeleteProgram( mnLinearTwoColorGradientProgram );
145  glDeleteProgram( mnLinearMultiColorGradientProgram );
146  }
147  }
148 
150  {
151  if( !mxContext->isInitialized() )
153 
154  // Map a one-by-one millimeter box to pixel
155  SystemChildWindow* pChildWindow = mxContext->getChildWindow();
156  const MapMode aOldMapMode( pChildWindow->GetMapMode() );
157  pChildWindow->SetMapMode( MapMode(MapUnit::MapMM) );
158  const Size aPixelSize( pChildWindow->LogicToPixel(Size(1,1)) );
159  pChildWindow->SetMapMode( aOldMapMode );
160 
161  return vcl::unotools::size2DFromSize( aPixelSize );
162  }
163 
164  geometry::RealSize2D SpriteDeviceHelper::getPhysicalSize()
165  {
166  if( !mxContext->isInitialized() )
168 
169  // Map the pixel dimensions of the output window to millimeter
170  SystemChildWindow* pChildWindow = mxContext->getChildWindow();
171  const MapMode aOldMapMode( pChildWindow->GetMapMode() );
172  pChildWindow->SetMapMode( MapMode(MapUnit::MapMM) );
173  const Size aLogSize( pChildWindow->PixelToLogic(pChildWindow->GetOutputSizePixel()) );
174  pChildWindow->SetMapMode( aOldMapMode );
175 
176  return vcl::unotools::size2DFromSize( aLogSize );
177  }
178 
179  uno::Reference< rendering::XLinePolyPolygon2D > SpriteDeviceHelper::createCompatibleLinePolyPolygon(
180  const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/,
181  const uno::Sequence< uno::Sequence< geometry::RealPoint2D > >& points )
182  {
183  // disposed?
184  if( !mpSpriteCanvas )
185  return uno::Reference< rendering::XLinePolyPolygon2D >(); // we're disposed
186 
187  return uno::Reference< rendering::XLinePolyPolygon2D >(
188  new ::basegfx::unotools::UnoPolyPolygon(
190  }
191 
192  uno::Reference< rendering::XBezierPolyPolygon2D > SpriteDeviceHelper::createCompatibleBezierPolyPolygon(
193  const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/,
194  const uno::Sequence< uno::Sequence< geometry::RealBezierSegment2D > >& points )
195  {
196  // disposed?
197  if( !mpSpriteCanvas )
198  return uno::Reference< rendering::XBezierPolyPolygon2D >(); // we're disposed
199 
200  return uno::Reference< rendering::XBezierPolyPolygon2D >(
201  new ::basegfx::unotools::UnoPolyPolygon(
203  }
204 
205  uno::Reference< rendering::XBitmap > SpriteDeviceHelper::createCompatibleBitmap(
206  const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/,
207  const geometry::IntegerSize2D& size )
208  {
209  // disposed?
210  if( !mpSpriteCanvas )
211  return uno::Reference< rendering::XBitmap >(); // we're disposed
212 
213  return uno::Reference< rendering::XBitmap >(
214  new CanvasBitmap( size,
216  *this ) );
217  }
218 
219  uno::Reference< rendering::XVolatileBitmap > SpriteDeviceHelper::createVolatileBitmap(
220  const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/,
221  const geometry::IntegerSize2D& /*size*/ )
222  {
223  return uno::Reference< rendering::XVolatileBitmap >();
224  }
225 
226  uno::Reference< rendering::XBitmap > SpriteDeviceHelper::createCompatibleAlphaBitmap(
227  const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/,
228  const geometry::IntegerSize2D& size )
229  {
230  // disposed?
231  if( !mpSpriteCanvas )
232  return uno::Reference< rendering::XBitmap >(); // we're disposed
233 
234  return uno::Reference< rendering::XBitmap >(
235  new CanvasBitmap( size,
237  *this ) );
238  }
239 
240  uno::Reference< rendering::XVolatileBitmap > SpriteDeviceHelper::createVolatileAlphaBitmap(
241  const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/,
242  const geometry::IntegerSize2D& /*size*/ )
243  {
244  return uno::Reference< rendering::XVolatileBitmap >();
245  }
246 
247  namespace
248  {
252  struct SpriteComparator
253  {
254  bool operator()( const ::rtl::Reference<CanvasCustomSprite>& rLHS,
255  const ::rtl::Reference<CanvasCustomSprite>& rRHS ) const
256  {
257  const double nPrioL( rLHS->getPriority() );
258  const double nPrioR( rRHS->getPriority() );
259 
260  // if prios are equal, tie-break on ptr value
261  return nPrioL == nPrioR ? rLHS.get() < rRHS.get() : nPrioL < nPrioR;
262  }
263  };
264  }
265 
266  bool SpriteDeviceHelper::showBuffer( bool bIsVisible, SAL_UNUSED_PARAMETER bool /*bUpdateAll*/ )
267  {
268  // hidden or disposed?
269  if( !bIsVisible || !mxContext->isInitialized() || !mpSpriteCanvas )
270  return false;
271 
272  mxContext->makeCurrent();
273 
274  SystemChildWindow* pChildWindow = mxContext->getChildWindow();
275  const ::Size& rOutputSize = pChildWindow->GetSizePixel();
276  initTransformation(rOutputSize);
277 
278  // render the actual spritecanvas content
280 
281  // render all sprites (in order of priority) on top of that
282  std::vector< ::rtl::Reference<CanvasCustomSprite> > aSprites(
283  maActiveSprites.begin(),
284  maActiveSprites.end());
285  std::sort(aSprites.begin(),
286  aSprites.end(),
287  SpriteComparator());
288  for( const auto& rSprite : aSprites )
289  rSprite->renderSprite();
290 
291 
292  // frame counter, other info
293  glMatrixMode(GL_MODELVIEW);
294  glLoadIdentity();
295  glTranslated(-1.0, 1.0, 0.0);
296  glScaled( 2.0 / rOutputSize.Width(),
297  -2.0 / rOutputSize.Height(),
298  1.0 );
299 
300  const double denominator( maLastUpdate.getElapsedTime() );
302 
303  const double fps(denominator == 0.0 ? 100.0 : 1.0/denominator);
304  std::vector<double> aVec; aVec.push_back(fps);
305  aVec.push_back(maActiveSprites.size());
306  aVec.push_back(mpTextureCache->getCacheSize());
307  aVec.push_back(mpTextureCache->getCacheMissCount());
308  aVec.push_back(mpTextureCache->getCacheHitCount());
309  renderOSD( aVec, 20 );
310 
311  /*
312  * TODO: moggi: fix it!
313  // switch buffer, sync etc.
314  const unx::Window aXWindow=pChildWindow->GetSystemData()->aWindow;
315  unx::glXSwapBuffers(reinterpret_cast<unx::Display*>(mpDisplay),
316  aXWindow);
317  pChildWindow->Show();
318  unx::glXWaitGL();
319  XSync( reinterpret_cast<unx::Display*>(mpDisplay), false );
320  */
321  mxContext->swapBuffers();
322 
323  // flush texture cache, such that it does not build up
324  // indefinitely.
325  // TODO: have max cache size/LRU time in config, prune only on
326  // demand
327  mpTextureCache->prune();
328 
329  return true;
330  }
331 
332  bool SpriteDeviceHelper::switchBuffer( bool bIsVisible, bool bUpdateAll )
333  {
334  // no difference for VCL canvas
335  return showBuffer( bIsVisible, bUpdateAll );
336  }
337 
339  {
340  return css::uno::Any(false);
341  }
342 
344  {
345  const SystemChildWindow* pChildWindow = mxContext->getChildWindow();
346  return uno::Any( reinterpret_cast< sal_Int64 >(pChildWindow) );
347  }
348 
350  {
351  return uno::Any();
352  }
353 
354  uno::Reference<rendering::XColorSpace> SpriteDeviceHelper::getColorSpace() const
355  {
356  // always the same
358  }
359 
360  void SpriteDeviceHelper::notifySizeUpdate( const awt::Rectangle& rBounds )
361  {
362  if( mxContext->isInitialized() )
363  {
364  SystemChildWindow* pChildWindow = mxContext->getChildWindow();
365  pChildWindow->setPosSizePixel(
366  0,0,rBounds.Width,rBounds.Height);
367  }
368  }
369 
371  {
372  SAL_INFO("canvas.ogl", __func__ );
373  }
374 
375  void SpriteDeviceHelper::show( const ::rtl::Reference< CanvasCustomSprite >& xSprite )
376  {
377  maActiveSprites.insert(xSprite);
378  }
379 
380  void SpriteDeviceHelper::hide( const ::rtl::Reference< CanvasCustomSprite >& xSprite )
381  {
382  maActiveSprites.erase(xSprite);
383  }
384 
385  static void setupUniforms( unsigned int nProgramId,
386  const ::basegfx::B2DHomMatrix& rTexTransform )
387  {
388  const GLint nTransformLocation = glGetUniformLocation(nProgramId,
389  "m_transform" );
390  // OGL is column-major
391  float aTexTransform[] =
392  {
393  float(rTexTransform.get(0,0)), float(rTexTransform.get(1,0)),
394  float(rTexTransform.get(0,1)), float(rTexTransform.get(1,1)),
395  float(rTexTransform.get(0,2)), float(rTexTransform.get(1,2))
396  };
397  glUniformMatrix3x2fv(nTransformLocation,1,false,aTexTransform);
398  }
399 
400  static void setupUniforms( unsigned int nProgramId,
401  const rendering::ARGBColor* pColors,
402  const uno::Sequence< double >& rStops,
403  const ::basegfx::B2DHomMatrix& rTexTransform )
404  {
405  glUseProgram(nProgramId);
406 
407  GLuint nColorsTexture;
408  glActiveTexture(GL_TEXTURE0);
409  glGenTextures(1, &nColorsTexture);
410  glBindTexture(GL_TEXTURE_1D, nColorsTexture);
411 
412  const sal_Int32 nColors=rStops.getLength();
413  glTexImage1D( GL_TEXTURE_1D, 0, GL_RGBA, nColors, 0, GL_RGBA, GL_DOUBLE, pColors );
414  glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
415  glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
416 
417  GLuint nStopsTexture;
418  glActiveTexture(GL_TEXTURE1);
419  glGenTextures(1, &nStopsTexture);
420  glBindTexture(GL_TEXTURE_1D, nStopsTexture);
421 
422  glTexImage1D( GL_TEXTURE_1D, 0, GL_ALPHA, nColors, 0, GL_ALPHA, GL_DOUBLE, rStops.getConstArray() );
423  glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
424  glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
425 
426  const GLint nColorArrayLocation = glGetUniformLocation(nProgramId,
427  "t_colorArray4d" );
428  glUniform1i( nColorArrayLocation, 0 ); // unit 0
429 
430  const GLint nStopArrayLocation = glGetUniformLocation(nProgramId,
431  "t_stopArray1d" );
432  glUniform1i( nStopArrayLocation, 1 ); // unit 1
433 
434  const GLint nNumColorLocation = glGetUniformLocation(nProgramId,
435  "i_nColors" );
436  glUniform1i( nNumColorLocation, nColors-1 );
437 
438  setupUniforms(nProgramId,rTexTransform);
439  }
440 
441  static void setupUniforms( unsigned int nProgramId,
442  const rendering::ARGBColor& rStartColor,
443  const rendering::ARGBColor& rEndColor,
444  const ::basegfx::B2DHomMatrix& rTexTransform )
445  {
446  glUseProgram(nProgramId);
447 
448  const GLint nStartColorLocation = glGetUniformLocation(nProgramId,
449  "v_startColor4d" );
450  glUniform4f(nStartColorLocation,
451  rStartColor.Red,
452  rStartColor.Green,
453  rStartColor.Blue,
454  rStartColor.Alpha);
455 
456  const GLint nEndColorLocation = glGetUniformLocation(nProgramId,
457  "v_endColor4d" );
458  glUniform4f(nEndColorLocation,
459  rEndColor.Red,
460  rEndColor.Green,
461  rEndColor.Blue,
462  rEndColor.Alpha);
463 
464  setupUniforms(nProgramId,rTexTransform);
465  }
466 
467  void SpriteDeviceHelper::useLinearGradientShader( const rendering::ARGBColor* pColors,
468  const uno::Sequence< double >& rStops,
469  const ::basegfx::B2DHomMatrix& rTexTransform )
470  {
471  if( rStops.getLength() > 2 )
472  setupUniforms(mnLinearMultiColorGradientProgram, pColors, rStops, rTexTransform);
473  else
474  setupUniforms(mnLinearTwoColorGradientProgram, pColors[0], pColors[1], rTexTransform);
475  }
476 
477  void SpriteDeviceHelper::useRadialGradientShader( const rendering::ARGBColor* pColors,
478  const uno::Sequence< double >& rStops,
479  const ::basegfx::B2DHomMatrix& rTexTransform )
480  {
481  if( rStops.getLength() > 2 )
482  setupUniforms(mnRadialMultiColorGradientProgram, pColors, rStops, rTexTransform);
483  else
484  setupUniforms(mnRadialTwoColorGradientProgram, pColors[0], pColors[1], rTexTransform);
485  }
486 
487  void SpriteDeviceHelper::useRectangularGradientShader( const rendering::ARGBColor* pColors,
488  const uno::Sequence< double >& rStops,
489  const ::basegfx::B2DHomMatrix& rTexTransform )
490  {
491  if( rStops.getLength() > 2 )
492  setupUniforms(mnRectangularMultiColorGradientProgram, pColors, rStops, rTexTransform);
493  else
494  setupUniforms(mnRectangularTwoColorGradientProgram, pColors[0], pColors[1], rTexTransform);
495  }
496 
497  namespace
498  {
499 
500  class BufferContextImpl : public IBufferContext
501  {
503  GLuint mnDepthId;
504  GLuint mnTextureId;
505 
506  virtual void startBufferRendering() override
507  {
508  glBindFramebuffer(GL_FRAMEBUFFER, mnFramebufferId);
509  }
510 
511  virtual void endBufferRendering() override
512  {
513  glBindFramebuffer(GL_FRAMEBUFFER, 0);
514  }
515 
516  virtual GLuint getTextureId() override
517  {
518  return mnTextureId;
519  }
520 
521  public:
522  explicit BufferContextImpl(const ::basegfx::B2IVector& rSize) :
523  mnFramebufferId(0),
524  mnDepthId(0),
525  mnTextureId(0)
526  {
527  OpenGLHelper::createFramebuffer(rSize.getX(), rSize.getY(), mnFramebufferId,
529  }
530 
531  virtual ~BufferContextImpl() override
532  {
533  glDeleteTextures(1, &mnTextureId);
534  glDeleteRenderbuffers(1, &mnDepthId);
535  glDeleteFramebuffers(1, &mnFramebufferId);
536  }
537  };
538  }
539 
540  IBufferContextSharedPtr SpriteDeviceHelper::createBufferContext(const ::basegfx::B2IVector& rSize) const
541  {
542  return std::make_shared<BufferContextImpl>(rSize);
543  }
544 
546  {
547  return *mpTextureCache;
548  }
549 }
550 
551 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
GLuint mnTextureId
void disposing()
Dispose all internal references.
void useRadialGradientShader(const css::rendering::ARGBColor *pColors, const css::uno::Sequence< double > &rStops, const ::basegfx::B2DHomMatrix &rTexTransform)
enable radial gradient shader "texture" with given parameters
void dumpScreenContent() const
called when DumpScreenContent property is enabled on XGraphicDevice, and writes out bitmaps of curren...
std::shared_ptr< TextureCache > mpTextureCache
css::uno::Reference< css::rendering::XVolatileBitmap > createVolatileAlphaBitmap(const css::uno::Reference< css::rendering::XGraphicDevice > &rDevice, const css::geometry::IntegerSize2D &size)
GLuint mnDepthId
TextureCache & getTextureCache() const
Get instance of internal texture cache.
uno::Reference< uno::XComponentContext > mxContext
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
void useRectangularGradientShader(const css::rendering::ARGBColor *pColors, const css::uno::Sequence< double > &rStops, const ::basegfx::B2DHomMatrix &rTexTransform)
enable rectangular gradient shader "texture" with given parameters
const cppcanvas::SpriteCanvasSharedPtr mpSpriteCanvas
static void createFramebuffer(tools::Long nWidth, tools::Long nHeight, GLuint &nFramebufferId, GLuint &nRenderbufferDepthId, GLuint &nRenderbufferColorId)
virtual Size GetSizePixel() const
css::uno::Reference< css::rendering::XVolatileBitmap > createVolatileBitmap(const css::uno::Reference< css::rendering::XGraphicDevice > &rDevice, const css::geometry::IntegerSize2D &size)
const MapMode & GetMapMode() const
void reset()
Reset the time.
Definition: elapsedtime.cxx:54
std::shared_ptr< T > make_shared(Args &&...args)
void SetMapMode()
void show(const ::rtl::Reference< CanvasCustomSprite > &)
static void initTransformation(const ::Size &rSize)
std::shared_ptr< IBufferContext > IBufferContextSharedPtr
::basegfx::B2DPolyPolygon polyPolygonFromPoint2DSequenceSequence(const uno::Sequence< uno::Sequence< geometry::RealPoint2D > > &points)
::basegfx::B2DPolyPolygon polyPolygonFromBezier2DSequenceSequence(const uno::Sequence< uno::Sequence< geometry::RealBezierSegment2D > > &curves)
css::geometry::RealSize2D getPhysicalSize()
bool showBuffer(bool bIsVisible, bool bUpdateAll)
static void initContext()
::canvas::tools::ElapsedTime maLastUpdate
For the frame counter timings.
IBufferContextSharedPtr createBufferContext(const ::basegfx::B2IVector &rSize) const
create a pbuffer context (for rendering into background surface)
void renderRecordedActions() const
Write out recorded actions.
bool switchBuffer(bool bIsVisible, bool bUpdateAll)
css::uno::Reference< css::rendering::XColorSpace > getColorSpace() const
geometry::RealSize2D size2DFromSize(const Size &rSize)
rtl::Reference< OpenGLContext > mxContext
GLuint mnFramebufferId
static GLint LoadShaders(const OUString &rVertexShaderName, const OUString &rFragmentShaderName, const OUString &rGeometryShaderName, const OString &preamble, const OString &rDigest)
Size GetOutputSizePixel() const
css::uno::Reference< css::rendering::XBezierPolyPolygon2D > createCompatibleBezierPolyPolygon(const css::uno::Reference< css::rendering::XGraphicDevice > &rDevice, const css::uno::Sequence< css::uno::Sequence< css::geometry::RealBezierSegment2D > > &points)
void notifySizeUpdate(const css::awt::Rectangle &rBounds)
static void setupUniforms(unsigned int nProgramId, const ::basegfx::B2DHomMatrix &rTexTransform)
Point PixelToLogic(const Point &rDevicePt) const
Point LogicToPixel(const Point &rLogicPt) const
virtual void setPosSizePixel(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, PosSizeFlags nFlags=PosSizeFlags::All)
css::uno::Reference< css::rendering::XBitmap > createCompatibleAlphaBitmap(const css::uno::Reference< css::rendering::XGraphicDevice > &rDevice, const css::geometry::IntegerSize2D &size)
void init(vcl::Window &rWindow, SpriteCanvas &rSpriteCanvas, const css::awt::Rectangle &rViewArea)
void renderOSD(const std::vector< double > &rNumbers, double scale)
Product of this component's factory.
geometry::RealSize2D createInfiniteSize2D()
Create a RealSize2D with both coordinate values set to +infinity.
Definition: canvastools.cxx:68
#define SAL_INFO(area, stream)
css::uno::Reference< css::rendering::XBitmap > createCompatibleBitmap(const css::uno::Reference< css::rendering::XGraphicDevice > &rDevice, const css::geometry::IntegerSize2D &size)
void hide(const ::rtl::Reference< CanvasCustomSprite > &)
css::geometry::RealSize2D getPhysicalResolution()
double getElapsedTime() const
Query the elapsed time.
Definition: elapsedtime.cxx:80
static css::uno::Reference< css::awt::XWindow > GetInterface(vcl::Window *pWindow)
std::set< ::rtl::Reference< CanvasCustomSprite > > maActiveSprites
css::uno::Reference< css::rendering::XLinePolyPolygon2D > createCompatibleLinePolyPolygon(const css::uno::Reference< css::rendering::XGraphicDevice > &rDevice, const css::uno::Sequence< css::uno::Sequence< css::geometry::RealPoint2D > > &points)
void useLinearGradientShader(const css::rendering::ARGBColor *pColors, const css::uno::Sequence< double > &rStops, const ::basegfx::B2DHomMatrix &rTexTransform)
enable linear gradient shader "texture" with given parameters
SpriteCanvas * mpSpriteCanvas
Pointer to sprite canvas (owner of this helper), needed to create bitmaps.
uno::Reference< rendering::XIntegerBitmapColorSpace > const & getStdColorSpace()
Return a color space for a default RGBA integer format.