LibreOffice Module canvas (master)  1
dx_surfacebitmap.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  * 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 #include <sal/config.h>
21 
22 #include <string.h>
23 
24 #include <com/sun/star/rendering/ColorComponentTag.hpp>
25 
28 #include <tools/diagnose_ex.h>
30 
31 #include "dx_graphicsprovider.hxx"
32 #include "dx_impltools.hxx"
33 #include "dx_surfacebitmap.hxx"
34 #include "dx_surfacegraphics.hxx"
35 
36 using namespace ::com::sun::star;
37 
38 namespace dxcanvas
39 {
40  namespace
41  {
42 
43  // DXColorBuffer
44 
45 
46  struct DXColorBuffer : public canvas::IColorBuffer
47  {
48  public:
49  DXColorBuffer( const COMReference<surface_type>& rSurface,
50  const ::basegfx::B2IVector& rSize )
51  : maSize(rSize)
52  , maLockedRect{}
53  , mpSurface(rSurface)
54  {
55  }
56 
57  // implementation of the 'IColorBuffer' interface
58  public:
59 
60  virtual sal_uInt8* lock() const override;
61  virtual void unlock() const override;
62  virtual sal_uInt32 getWidth() const override;
63  virtual sal_uInt32 getHeight() const override;
64  virtual sal_uInt32 getStride() const override;
65  virtual Format getFormat() const override;
66 
67  private:
68 
70  mutable D3DLOCKED_RECT maLockedRect;
71  mutable COMReference<surface_type> mpSurface;
72  };
73 
74  sal_uInt8* DXColorBuffer::lock() const
75  {
76  if(SUCCEEDED(mpSurface->LockRect(&maLockedRect,nullptr,D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY)))
77  return static_cast<sal_uInt8 *>(maLockedRect.pBits);
78  return nullptr;
79  }
80 
81  void DXColorBuffer::unlock() const
82  {
83  mpSurface->UnlockRect();
84  }
85 
86  sal_uInt32 DXColorBuffer::getWidth() const
87  {
88  return maSize.getX();
89  }
90 
91  sal_uInt32 DXColorBuffer::getHeight() const
92  {
93  return maSize.getY();
94  }
95 
96  sal_uInt32 DXColorBuffer::getStride() const
97  {
98  return maLockedRect.Pitch;
99  }
100 
101  canvas::IColorBuffer::Format DXColorBuffer::getFormat() const
102  {
104  }
105 
106 
107  // GDIColorBuffer
108 
109 
110  struct GDIColorBuffer : public canvas::IColorBuffer
111  {
112  public:
113 
114  GDIColorBuffer( const BitmapSharedPtr& rSurface,
115  const ::basegfx::B2IVector& rSize )
116  : maSize(rSize)
117  , aBmpData{}
118  , mpGDIPlusBitmap(rSurface)
119  {
120  }
121 
122  // implementation of the 'IColorBuffer' interface
123  public:
124 
125  virtual sal_uInt8* lock() const override;
126  virtual void unlock() const override;
127  virtual sal_uInt32 getWidth() const override;
128  virtual sal_uInt32 getHeight() const override;
129  virtual sal_uInt32 getStride() const override;
130  virtual Format getFormat() const override;
131 
132  private:
133 
135  mutable Gdiplus::BitmapData aBmpData;
137  };
138 
139  sal_uInt8* GDIColorBuffer::lock() const
140  {
141  aBmpData.Width = maSize.getX();
142  aBmpData.Height = maSize.getY();
143  aBmpData.Stride = 4*aBmpData.Width;
144  aBmpData.PixelFormat = PixelFormat32bppARGB;
145  aBmpData.Scan0 = nullptr;
146  const Gdiplus::Rect aRect( 0,0,aBmpData.Width,aBmpData.Height );
147  if( Gdiplus::Ok != mpGDIPlusBitmap->LockBits( &aRect,
148  Gdiplus::ImageLockModeRead,
149  PixelFormat32bppARGB,
150  &aBmpData ) )
151  {
152  return nullptr;
153  }
154 
155  return static_cast<sal_uInt8*>(aBmpData.Scan0);
156  }
157 
158  void GDIColorBuffer::unlock() const
159  {
160  mpGDIPlusBitmap->UnlockBits( &aBmpData );
161  }
162 
163  sal_uInt32 GDIColorBuffer::getWidth() const
164  {
165  return maSize.getX();
166  }
167 
168  sal_uInt32 GDIColorBuffer::getHeight() const
169  {
170  return maSize.getY();
171  }
172 
173  sal_uInt32 GDIColorBuffer::getStride() const
174  {
175  return aBmpData.Stride;
176  }
177 
178  canvas::IColorBuffer::Format GDIColorBuffer::getFormat() const
179  {
181  }
182  }
183 
184 
185  // DXSurfaceBitmap::DXSurfaceBitmap
186 
187 
188  DXSurfaceBitmap::DXSurfaceBitmap( const ::basegfx::B2IVector& rSize,
189  const std::shared_ptr<canvas::ISurfaceProxyManager>& rMgr,
190  const IDXRenderModuleSharedPtr& rRenderModule,
191  bool bWithAlpha ) :
192  mpGdiPlusUser( GDIPlusUser::createInstance() ),
193  maSize(rSize),
194  mpRenderModule(rRenderModule),
195  mpSurfaceManager(rMgr),
196  mpSurfaceProxy(),
197  mpSurface(),
198  mpGDIPlusBitmap(),
199  mpGraphics(),
200  mpColorBuffer(),
201  mbIsSurfaceDirty(true),
202  mbAlpha(bWithAlpha)
203  {
204  init();
205  }
206 
207 
208  // DXSurfaceBitmap::getSize
209 
210 
212  {
213  return maSize;
214  }
215 
216 
217  // DXSurfaceBitmap::init
218 
219 
221  {
222  // create container for pixel data
223  if(mbAlpha)
224  {
225  mpGDIPlusBitmap.reset(
226  new Gdiplus::Bitmap(
227  maSize.getX(),
228  maSize.getY(),
229  PixelFormat32bppARGB
230  ));
232 
233  // create the colorbuffer object, which is basically a simple
234  // wrapper around the directx surface. the colorbuffer is the
235  // interface which is used by the surfaceproxy to support any
236  // kind of underlying structure for the pixel data container.
237  mpColorBuffer.reset(new GDIColorBuffer(mpGDIPlusBitmap,maSize));
238  }
239  else
240  {
241  mpSurface = mpRenderModule->createSystemMemorySurface(maSize);
242 
243  // create the colorbuffer object, which is basically a simple
244  // wrapper around the directx surface. the colorbuffer is the
245  // interface which is used by the surfaceproxy to support any
246  // kind of underlying structure for the pixel data container.
247  mpColorBuffer.reset(new DXColorBuffer(mpSurface,maSize));
248  }
249 
250  // create a (possibly hardware accelerated) mirror surface.
251  mpSurfaceProxy = mpSurfaceManager->createSurfaceProxy(mpColorBuffer);
252  }
253 
254 
255  // DXSurfaceBitmap::resize
256 
257 
258  bool DXSurfaceBitmap::resize( const ::basegfx::B2IVector& rSize )
259  {
260  if(maSize != rSize)
261  {
262  maSize = rSize;
263  init();
264  }
265 
266  return true;
267  }
268 
269 
270  // DXSurfaceBitmap::clear
271 
272 
274  {
275  GraphicsSharedPtr pGraphics(getGraphics());
276  Gdiplus::Color transColor(255,0,0,0);
277  pGraphics->SetCompositingMode( Gdiplus::CompositingModeSourceCopy );
278  pGraphics->Clear( transColor );
279  }
280 
281 
282  // DXSurfaceBitmap::hasAlpha
283 
284 
286  {
287  return mbAlpha;
288  }
289 
290 
291  // DXSurfaceBitmap::getGraphics
292 
293 
295  {
296  // since clients will most probably draw directly
297  // to the GDI+ bitmap, we need to mark it as dirty
298  // to ensure that the corresponding dxsurface will
299  // be updated.
300  mbIsSurfaceDirty = true;
301 
302  if(hasAlpha())
303  return mpGraphics;
304  else
306  }
307 
308 
309  // DXSurfaceBitmap::getBitmap
310 
311 
313  {
314  if(hasAlpha())
315  return mpGDIPlusBitmap;
316 
317  BitmapSharedPtr pResult;
318 
319  D3DLOCKED_RECT aLockedRect;
320  if(SUCCEEDED(mpSurface->LockRect(&aLockedRect,nullptr,D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY)))
321  {
322  // decide about the format we pass the gdi+, the directx surface is always
323  // 32bit, either with or without alpha component.
324  Gdiplus::PixelFormat nFormat = hasAlpha() ? PixelFormat32bppARGB : PixelFormat32bppRGB;
325 
326  // construct a gdi+ bitmap from the raw pixel data.
327  pResult.reset(new Gdiplus::Bitmap( maSize.getX(),maSize.getY(),
328  aLockedRect.Pitch,
329  nFormat,
330  static_cast<BYTE *>(aLockedRect.pBits) ));
331 
332  mpSurface->UnlockRect();
333  }
334 
335  return pResult;
336  }
337 
338 
339  // DXSurfaceBitmap::draw
340 
341 
342  bool DXSurfaceBitmap::draw( double fAlpha,
343  const ::basegfx::B2DPoint& rPos,
344  const ::basegfx::B2DPolyPolygon& rClipPoly,
345  const ::basegfx::B2DHomMatrix& rTransform )
346  {
347  if( mbIsSurfaceDirty )
348  {
349  mpSurfaceProxy->setColorBufferDirty();
350  mbIsSurfaceDirty = false;
351  }
352 
353  return mpSurfaceProxy->draw( fAlpha, rPos, rClipPoly, rTransform );
354  }
355 
356 
357  // DXSurfaceBitmap::draw
358 
359 
360  bool DXSurfaceBitmap::draw( double fAlpha,
361  const ::basegfx::B2DPoint& rPos,
362  const ::basegfx::B2DRange& rArea,
363  const ::basegfx::B2DHomMatrix& rTransform )
364  {
365  if( mbIsSurfaceDirty )
366  {
367  mpSurfaceProxy->setColorBufferDirty();
368  mbIsSurfaceDirty = false;
369  }
370 
371  return mpSurfaceProxy->draw( fAlpha, rPos, rArea, rTransform );
372  }
373 
374 
375  // DXSurfaceBitmap::draw
376 
377 
378  bool DXSurfaceBitmap::draw( double fAlpha,
379  const ::basegfx::B2DPoint& rPos,
380  const ::basegfx::B2DHomMatrix& rTransform )
381  {
382  if( mbIsSurfaceDirty )
383  {
384  mpSurfaceProxy->setColorBufferDirty();
385  mbIsSurfaceDirty = false;
386  }
387 
388  return mpSurfaceProxy->draw( fAlpha, rPos, rTransform );
389  }
390 
391 
392  // DXSurfaceBitmap::draw
393 
394 
395  bool DXSurfaceBitmap::draw( const ::basegfx::B2IRange& rArea )
396  {
397  if( mbIsSurfaceDirty )
398  {
399  mpSurfaceProxy->setColorBufferDirty();
400  mbIsSurfaceDirty = false;
401  }
402 
403  const double fAlpha(1.0);
404  const ::basegfx::B2DHomMatrix aTransform;
405  const ::basegfx::B2DRange aIEEEArea( rArea );
406  return mpSurfaceProxy->draw(fAlpha,
407  ::basegfx::B2DPoint(),
408  aIEEEArea,
409  aTransform);
410  }
411 
412 
413  // DXSurfaceBitmap::getData
414 
415 
416  uno::Sequence< sal_Int8 > DXSurfaceBitmap::getData( rendering::IntegerBitmapLayout& rBitmapLayout,
417  const geometry::IntegerRectangle2D& rect )
418  {
419  if(hasAlpha())
420  {
421  uno::Sequence< sal_Int8 > aRes( (rect.X2-rect.X1)*(rect.Y2-rect.Y1)*4 ); // TODO(F1): Be format-agnostic here
422 
423  const Gdiplus::Rect aRect( tools::gdiPlusRectFromIntegerRectangle2D( rect ) );
424 
425  Gdiplus::BitmapData aBmpData;
426  aBmpData.Width = rect.X2-rect.X1;
427  aBmpData.Height = rect.Y2-rect.Y1;
428  aBmpData.Stride = 4*aBmpData.Width;
429  aBmpData.PixelFormat = PixelFormat32bppARGB;
430  aBmpData.Scan0 = aRes.getArray();
431 
432  // TODO(F1): Support more pixel formats natively
433 
434  // read data from bitmap
435  if( Gdiplus::Ok != mpGDIPlusBitmap->LockBits( &aRect,
436  Gdiplus::ImageLockModeRead | Gdiplus::ImageLockModeUserInputBuf,
437  PixelFormat32bppARGB, // TODO(F1): Adapt to
438  // Graphics native
439  // format/change
440  // getMemoryLayout
441  &aBmpData ) )
442  {
443  // failed to lock, bail out
444  return uno::Sequence< sal_Int8 >();
445  }
446 
447  mpGDIPlusBitmap->UnlockBits( &aBmpData );
448 
449  return aRes;
450  }
451  else
452  {
453  sal_uInt32 nWidth = rect.X2-rect.X1;
454  sal_uInt32 nHeight = rect.Y2-rect.Y1;
455 
456  uno::Sequence< sal_Int8 > aRes(nWidth*nHeight*4);
457 
458  D3DLOCKED_RECT aLockedRect;
459  if(FAILED(mpSurface->LockRect(&aLockedRect,nullptr,D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY)))
460  return uno::Sequence< sal_Int8 >();
461  D3DSURFACE_DESC aDesc;
462  if(FAILED(mpSurface->GetDesc(&aDesc)))
463  return uno::Sequence< sal_Int8 >();
464 
465  assert(aDesc.Format == D3DFMT_A8R8G8B8 || aDesc.Format == D3DFMT_X8R8G8B8);
466 
467  sal_uInt8 *pSrc = (static_cast<BYTE *>(aLockedRect.pBits)+(rect.Y1*aLockedRect.Pitch))+rect.X1;
468  sal_uInt8 *pDst = reinterpret_cast<sal_uInt8 *>(aRes.getArray());
469  sal_uInt32 nSegmentSizeInBytes = nWidth*4;
470  for(sal_uInt32 y=0; y<nHeight; ++y)
471  {
472  memcpy(pDst,pSrc,nSegmentSizeInBytes);
473  pDst += nSegmentSizeInBytes;
474  pSrc += aLockedRect.Pitch;
475  }
476 
477  if(rBitmapLayout.ColorSpace->getComponentTags().getArray()[0] == rendering::ColorComponentTag::RGB_RED &&
478  rBitmapLayout.ColorSpace->getComponentTags().getArray()[2] == rendering::ColorComponentTag::RGB_BLUE)
479  {
480  pDst = reinterpret_cast<sal_uInt8 *>(aRes.getArray());
481  for(sal_uInt32 y=0; y<nHeight; ++y)
482  {
483  sal_uInt8* pPixel = pDst;
484  for(sal_uInt32 n = 0; n<nWidth; n++)
485  {
486  sal_uInt8 nB = pPixel[0];
487  pPixel[0] = pPixel[2];
488  pPixel[2] = nB;
489  pPixel += 4;
490  }
491  pDst += nSegmentSizeInBytes;
492  }
493  }
494 
495  mpSurface->UnlockRect();
496  return aRes;
497  }
498  }
499 
500 
501  // DXSurfaceBitmap::setData
502 
503 
504  void DXSurfaceBitmap::setData( const uno::Sequence< sal_Int8 >& data,
505  const rendering::IntegerBitmapLayout& /*bitmapLayout*/,
506  const geometry::IntegerRectangle2D& rect )
507  {
508  if(hasAlpha())
509  {
510  const Gdiplus::Rect aRect( tools::gdiPlusRectFromIntegerRectangle2D( rect ) );
511 
512  Gdiplus::BitmapData aBmpData;
513  aBmpData.Width = rect.X2-rect.X1;
514  aBmpData.Height = rect.Y2-rect.Y1;
515  aBmpData.Stride = 4*aBmpData.Width;
516  aBmpData.PixelFormat = PixelFormat32bppARGB;
517  aBmpData.Scan0 = const_cast<sal_Int8 *>(data.getConstArray());
518 
519  // TODO(F1): Support more pixel formats natively
520 
521  if( Gdiplus::Ok != mpGDIPlusBitmap->LockBits( &aRect,
522  Gdiplus::ImageLockModeWrite | Gdiplus::ImageLockModeUserInputBuf,
523  PixelFormat32bppARGB, // TODO: Adapt to
524  // Graphics native
525  // format/change
526  // getMemoryLayout
527  &aBmpData ) )
528  {
529  throw uno::RuntimeException();
530  }
531 
532  // commit data to bitmap
533  mpGDIPlusBitmap->UnlockBits( &aBmpData );
534  }
535  else
536  {
537  sal_uInt32 nWidth = rect.X2-rect.X1;
538  sal_uInt32 nHeight = rect.Y2-rect.Y1;
539 
540  // lock the directx surface to receive the pointer to the surface memory.
541  D3DLOCKED_RECT aLockedRect;
542  if(FAILED(mpSurface->LockRect(&aLockedRect,nullptr,D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY)))
543  throw uno::RuntimeException();
544 
545  sal_uInt8 const *pSrc = reinterpret_cast<sal_uInt8 const *>(data.getConstArray());
546  sal_uInt8 *pDst = (static_cast<BYTE *>(aLockedRect.pBits)+(rect.Y1*aLockedRect.Pitch))+rect.X1;
547  sal_uInt32 nSegmentSizeInBytes = nWidth<<4;
548  for(sal_uInt32 y=0; y<nHeight; ++y)
549  {
550  memcpy(pDst,pSrc,nSegmentSizeInBytes);
551  pSrc += nSegmentSizeInBytes;
552  pDst += aLockedRect.Pitch;
553  }
554 
555  mpSurface->UnlockRect();
556  }
557 
558  mbIsSurfaceDirty = true;
559  }
560 
561 
562  // DXSurfaceBitmap::setPixel
563 
564 
565  void DXSurfaceBitmap::setPixel( const uno::Sequence< sal_Int8 >& color,
566  const rendering::IntegerBitmapLayout& /*bitmapLayout*/,
567  const geometry::IntegerPoint2D& pos )
568  {
569  if(hasAlpha())
570  {
571  const geometry::IntegerSize2D aSize( maSize.getX(),maSize.getY() );
572 
573  ENSURE_ARG_OR_THROW( pos.X >= 0 && pos.X < aSize.Width,
574  "CanvasHelper::setPixel: X coordinate out of bounds" );
575  ENSURE_ARG_OR_THROW( pos.Y >= 0 && pos.Y < aSize.Height,
576  "CanvasHelper::setPixel: Y coordinate out of bounds" );
577  ENSURE_ARG_OR_THROW( color.getLength() > 3,
578  "CanvasHelper::setPixel: not enough color components" );
579 
580  if( Gdiplus::Ok != mpGDIPlusBitmap->SetPixel( pos.X, pos.Y,
581  Gdiplus::Color( tools::sequenceToArgb( color ))))
582  {
583  throw uno::RuntimeException();
584  }
585  }
586  else
587  {
588  ENSURE_ARG_OR_THROW( pos.X >= 0 && pos.X < maSize.getX(),
589  "CanvasHelper::setPixel: X coordinate out of bounds" );
590  ENSURE_ARG_OR_THROW( pos.Y >= 0 && pos.Y < maSize.getY(),
591  "CanvasHelper::setPixel: Y coordinate out of bounds" );
592  ENSURE_ARG_OR_THROW( color.getLength() > 3,
593  "CanvasHelper::setPixel: not enough color components" );
594 
595  Gdiplus::Color aColor(tools::sequenceToArgb(color));
596 
597  // lock the directx surface to receive the pointer to the surface memory.
598  D3DLOCKED_RECT aLockedRect;
599  if(FAILED(mpSurface->LockRect(&aLockedRect,nullptr,D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY)))
600  throw uno::RuntimeException();
601 
602  sal_uInt32 *pDst = reinterpret_cast<sal_uInt32 *>((static_cast<BYTE *>(aLockedRect.pBits)+(pos.Y*aLockedRect.Pitch))+pos.X);
603  *pDst = aColor.GetValue();
604  mpSurface->UnlockRect();
605  }
606 
607  mbIsSurfaceDirty = true;
608  }
609 
610 
611  // DXSurfaceBitmap::getPixel
612 
613 
614  uno::Sequence< sal_Int8 > DXSurfaceBitmap::getPixel( rendering::IntegerBitmapLayout& /*bitmapLayout*/,
615  const geometry::IntegerPoint2D& pos )
616  {
617  if(hasAlpha())
618  {
619  const geometry::IntegerSize2D aSize( maSize.getX(),maSize.getY() );
620 
621  ENSURE_ARG_OR_THROW( pos.X >= 0 && pos.X < aSize.Width,
622  "CanvasHelper::getPixel: X coordinate out of bounds" );
623  ENSURE_ARG_OR_THROW( pos.Y >= 0 && pos.Y < aSize.Height,
624  "CanvasHelper::getPixel: Y coordinate out of bounds" );
625 
626  Gdiplus::Color aColor;
627 
628  if( Gdiplus::Ok != mpGDIPlusBitmap->GetPixel( pos.X, pos.Y, &aColor ) )
629  return uno::Sequence< sal_Int8 >();
630 
631  return tools::argbToIntSequence(aColor.GetValue());
632  }
633  else
634  {
635  ENSURE_ARG_OR_THROW( pos.X >= 0 && pos.X < maSize.getX(),
636  "CanvasHelper::getPixel: X coordinate out of bounds" );
637  ENSURE_ARG_OR_THROW( pos.Y >= 0 && pos.Y < maSize.getY(),
638  "CanvasHelper::getPixel: Y coordinate out of bounds" );
639 
640  // lock the directx surface to receive the pointer to the surface memory.
641  D3DLOCKED_RECT aLockedRect;
642  if(FAILED(mpSurface->LockRect(&aLockedRect,nullptr,D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY)))
643  throw uno::RuntimeException();
644 
645  sal_uInt32 *pDst = reinterpret_cast<sal_uInt32 *>((static_cast<BYTE *>(aLockedRect.pBits)+(pos.Y*aLockedRect.Pitch))+pos.X);
646  Gdiplus::Color aColor(*pDst);
647  mpSurface->UnlockRect();
648 
649  return tools::argbToIntSequence(aColor.GetValue());
650  }
651  }
652 }
653 
654 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
signed char sal_Int8
unsigned char BYTE
virtual css::uno::Sequence< sal_Int8 > getData(css::rendering::IntegerBitmapLayout &bitmapLayout, const css::geometry::IntegerRectangle2D &rect) override
std::shared_ptr< IDXRenderModule > IDXRenderModuleSharedPtr
IDXRenderModuleSharedPtr mpRenderModule
virtual ::basegfx::B2IVector getSize() const override
Gdiplus::Graphics * createGraphicsFromBitmap(const BitmapSharedPtr &rBitmap)
Gdiplus::ARGB sequenceToArgb(const uno::Sequence< sal_Int8 > &rColor)
Gdiplus::Rect gdiPlusRectFromIntegerRectangle2D(const geometry::IntegerRectangle2D &rRect)
virtual void setData(const css::uno::Sequence< sal_Int8 > &data, const css::rendering::IntegerBitmapLayout &bitmapLayout, const css::geometry::IntegerRectangle2D &rect) override
GraphicsSharedPtr createSurfaceGraphics(const COMReference< surface_type > &rSurface)
Container providing a Gdiplus::Graphics for a Surface.
virtual css::uno::Sequence< sal_Int8 > getPixel(css::rendering::IntegerBitmapLayout &bitmapLayout, const css::geometry::IntegerPoint2D &pos) override
::basegfx::B2IVector maSize
float y
Definition: dx_9rm.cxx:189
std::shared_ptr< ::cppcanvas::Bitmap > BitmapSharedPtr
sal_Int32 getX() const
bool draw(double fAlpha, const ::basegfx::B2DPoint &rPos, const ::basegfx::B2DHomMatrix &rTransform)
HRESULT createInstance(REFIID iid, Ifc **ppIfc)
Gdiplus::BitmapData aBmpData
virtual BitmapSharedPtr getBitmap() const override
virtual void setPixel(const css::uno::Sequence< sal_Int8 > &color, const css::rendering::IntegerBitmapLayout &bitmapLayout, const css::geometry::IntegerPoint2D &pos) override
#define ENSURE_ARG_OR_THROW(c, m)
std::shared_ptr< Gdiplus::Bitmap > BitmapSharedPtr
Definition: dx_winstuff.hxx:63
::basegfx::B2IVector maSize
uno::Sequence< sal_Int8 > argbToIntSequence(Gdiplus::ARGB rColor)
virtual bool hasAlpha() const override
Format
The underlying pixel format for this buffer.
unsigned char sal_uInt8
bool resize(const ::basegfx::B2IVector &rSize)
DXSurfaceBitmap(const ::basegfx::B2IVector &rSize, const std::shared_ptr< canvas::ISurfaceProxyManager > &rMgr, const IDXRenderModuleSharedPtr &rRenderModule, bool bWithAlpha)
sal_Int32 getY() const
COMReference< surface_type > mpSurface
D3DLOCKED_RECT maLockedRect
BitmapSharedPtr mpGDIPlusBitmap
Interface for a raw memory pixel container.
std::shared_ptr< canvas::ISurfaceProxyManager > mpSurfaceManager
virtual GraphicsSharedPtr getGraphics() override
std::shared_ptr< osl::Mutex > const & lock()
COMReference< surface_type > mpSurface
std::shared_ptr< Gdiplus::Graphics > GraphicsSharedPtr
Definition: dx_winstuff.hxx:61
std::shared_ptr< canvas::ISurfaceProxy > mpSurfaceProxy
std::shared_ptr< canvas::IColorBuffer > mpColorBuffer