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 <memory>
23 #include <string.h>
24 
25 #include <com/sun/star/rendering/ColorComponentTag.hpp>
26 
29 #include <tools/diagnose_ex.h>
31 
32 #include "dx_graphicsprovider.hxx"
33 #include "dx_impltools.hxx"
34 #include "dx_surfacebitmap.hxx"
35 #include "dx_surfacegraphics.hxx"
36 
37 using namespace ::com::sun::star;
38 
39 namespace dxcanvas
40 {
41  namespace
42  {
43 
44  // DXColorBuffer
45 
46 
47  struct DXColorBuffer : public canvas::IColorBuffer
48  {
49  public:
50  DXColorBuffer( const COMReference<surface_type>& rSurface,
51  const ::basegfx::B2IVector& rSize )
52  : maSize(rSize)
53  , maLockedRect{}
54  , mpSurface(rSurface)
55  {
56  }
57 
58  // implementation of the 'IColorBuffer' interface
59  public:
60 
61  virtual sal_uInt8* lock() const override;
62  virtual void unlock() const override;
63  virtual sal_uInt32 getWidth() const override;
64  virtual sal_uInt32 getHeight() const override;
65  virtual sal_uInt32 getStride() const override;
66  virtual Format getFormat() const override;
67 
68  private:
69 
71  mutable D3DLOCKED_RECT maLockedRect;
72  mutable COMReference<surface_type> mpSurface;
73  };
74 
75  sal_uInt8* DXColorBuffer::lock() const
76  {
77  if(SUCCEEDED(mpSurface->LockRect(&maLockedRect,nullptr,D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY)))
78  return static_cast<sal_uInt8 *>(maLockedRect.pBits);
79  return nullptr;
80  }
81 
82  void DXColorBuffer::unlock() const
83  {
84  mpSurface->UnlockRect();
85  }
86 
87  sal_uInt32 DXColorBuffer::getWidth() const
88  {
89  return maSize.getX();
90  }
91 
92  sal_uInt32 DXColorBuffer::getHeight() const
93  {
94  return maSize.getY();
95  }
96 
97  sal_uInt32 DXColorBuffer::getStride() const
98  {
99  return maLockedRect.Pitch;
100  }
101 
102  canvas::IColorBuffer::Format DXColorBuffer::getFormat() const
103  {
105  }
106 
107 
108  // GDIColorBuffer
109 
110 
111  struct GDIColorBuffer : public canvas::IColorBuffer
112  {
113  public:
114 
115  GDIColorBuffer( const BitmapSharedPtr& rSurface,
116  const ::basegfx::B2IVector& rSize )
117  : maSize(rSize)
118  , aBmpData{}
119  , mpGDIPlusBitmap(rSurface)
120  {
121  }
122 
123  // implementation of the 'IColorBuffer' interface
124  public:
125 
126  virtual sal_uInt8* lock() const override;
127  virtual void unlock() const override;
128  virtual sal_uInt32 getWidth() const override;
129  virtual sal_uInt32 getHeight() const override;
130  virtual sal_uInt32 getStride() const override;
131  virtual Format getFormat() const override;
132 
133  private:
134 
136  mutable Gdiplus::BitmapData aBmpData;
138  };
139 
140  sal_uInt8* GDIColorBuffer::lock() const
141  {
142  aBmpData.Width = maSize.getX();
143  aBmpData.Height = maSize.getY();
144  aBmpData.Stride = 4*aBmpData.Width;
145  aBmpData.PixelFormat = PixelFormat32bppARGB;
146  aBmpData.Scan0 = nullptr;
147  const Gdiplus::Rect aRect( 0,0,aBmpData.Width,aBmpData.Height );
148  if( Gdiplus::Ok != mpGDIPlusBitmap->LockBits( &aRect,
149  Gdiplus::ImageLockModeRead,
150  PixelFormat32bppARGB,
151  &aBmpData ) )
152  {
153  return nullptr;
154  }
155 
156  return static_cast<sal_uInt8*>(aBmpData.Scan0);
157  }
158 
159  void GDIColorBuffer::unlock() const
160  {
161  mpGDIPlusBitmap->UnlockBits( &aBmpData );
162  }
163 
164  sal_uInt32 GDIColorBuffer::getWidth() const
165  {
166  return maSize.getX();
167  }
168 
169  sal_uInt32 GDIColorBuffer::getHeight() const
170  {
171  return maSize.getY();
172  }
173 
174  sal_uInt32 GDIColorBuffer::getStride() const
175  {
176  return aBmpData.Stride;
177  }
178 
179  canvas::IColorBuffer::Format GDIColorBuffer::getFormat() const
180  {
182  }
183  }
184 
185 
186  // DXSurfaceBitmap::DXSurfaceBitmap
187 
188 
189  DXSurfaceBitmap::DXSurfaceBitmap( const ::basegfx::B2IVector& rSize,
190  const std::shared_ptr<canvas::ISurfaceProxyManager>& rMgr,
191  const IDXRenderModuleSharedPtr& rRenderModule,
192  bool bWithAlpha ) :
193  mpGdiPlusUser( GDIPlusUser::createInstance() ),
194  maSize(rSize),
195  mpRenderModule(rRenderModule),
196  mpSurfaceManager(rMgr),
197  mpSurfaceProxy(),
198  mpSurface(),
199  mpGDIPlusBitmap(),
200  mpGraphics(),
201  mpColorBuffer(),
202  mbIsSurfaceDirty(true),
203  mbAlpha(bWithAlpha)
204  {
205  init();
206  }
207 
208 
209  // DXSurfaceBitmap::getSize
210 
211 
213  {
214  return maSize;
215  }
216 
217 
218  // DXSurfaceBitmap::init
219 
220 
222  {
223  // create container for pixel data
224  if(mbAlpha)
225  {
226  mpGDIPlusBitmap = std::make_shared<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 = std::make_shared<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 = std::make_shared<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 = std::make_shared<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)
sal_Int64 n
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.
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
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:190
GraphicsSharedPtr mpGraphics
Definition: dx_canvas.cxx:69
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