59 int nNumTilesX,
int nNumTilesY,
60 const Size& rTileSizePixel,
64 const int nExponent = 2;
68 while( nNumTilesX / nMSBFactor != 0 ||
69 nNumTilesY / nMSBFactor != 0 )
71 nMSBFactor *= nExponent;
77 nMSBFactor /= nExponent;
87 nNumTilesX, nNumTilesY, rTileSizePixel, pAttr, aTileInfo ) );
102 int nNumOrigTilesX,
int nNumOrigTilesY,
103 int nRemainderTilesX,
int nRemainderTilesY,
108 std::unique_ptr<GraphicObject> xTmpGraphic;
116 bool bNoFirstTileDraw(
false );
119 const int nNewRemainderX( nRemainderTilesX % nMSBFactor );
120 const int nNewRemainderY( nRemainderTilesY % nMSBFactor );
127 if( nMSBFactor == 1 )
137 nNumOrigTilesX, nNumOrigTilesY,
138 nNewRemainderX, nNewRemainderY,
139 rTileSizePixel, pAttr, aTileInfo ) )
144 xTmpGraphic.reset(
new GraphicObject(std::move(aTileBitmap)));
145 pTileGraphic = xTmpGraphic.get();
170 for (
int nX=0; nX < aTileInfo.
nTilesEmptyX; nX += nMSBFactor)
181 rVDev.
SetLineColor(
Color( 255 * nExponent / nMSBFactor, 255 - 255 * nExponent / nMSBFactor, 128 - 255 * nExponent / nMSBFactor ) );
191 for (
int nY=0; nY < aTileInfo.
nTilesEmptyY; nY += nMSBFactor)
215 bNoFirstTileDraw =
true;
225 nRemainderTilesX -= nNewRemainderX;
226 nRemainderTilesY -= nNewRemainderY;
233 rTileSizePixel.
Height()*nMSBFactor*nExponent );
245 for (
int nY=0; nY < aTileInfo.
nTilesEmptyY && nY < nExponent*nMSBFactor; nY += nMSBFactor)
249 for (
int nX=0; nX < aTileInfo.
nTilesEmptyX && nX < nExponent*nMSBFactor; nX += nMSBFactor)
251 if( bNoFirstTileDraw )
252 bNoFirstTileDraw =
false;
265 rVDev.
SetLineColor(
Color( 255 * nExponent / nMSBFactor, 255 - 255 * nExponent / nMSBFactor, 128 - 255 * nExponent / nMSBFactor ) );
285 static_cast<sal_Int64
>(rSizePixel.
Width()) * rSizePixel.
Height() <
286 static_cast<sal_Int64
>(nTileCacheSize1D)*nTileCacheSize1D )
292 const int nNumTilesInCacheX( (nTileCacheSize1D + rSizePixel.
Width()-1) / rSizePixel.
Width() );
293 const int nNumTilesInCacheY( (nTileCacheSize1D + rSizePixel.
Height()-1) / rSizePixel.
Height() );
295 aVDev->SetOutputSizePixel(
Size( nNumTilesInCacheX*rSizePixel.
Width(),
296 nNumTilesInCacheY*rSizePixel.
Height() ) );
297 aVDev->SetMapMode( aMapMode );
301 nNumTilesInCacheY, rSizePixel, pAttr ) )
303 BitmapEx aTileBitmap( aVDev->GetBitmap(
Point(0,0), aVDev->GetOutputSize() ) );
316 nNumTilesInCacheY, rSizePixel, pAttr ) )
321 AlphaMask( aVDev->GetBitmap(
Point(0,0), aVDev->GetOutputSize() ) ) );
324 aVDev->GetBitmap(
Point(0,0), aVDev->GetOutputSize() ).CreateMask(
COL_WHITE ) );
332 rOffset, pAttr, nTileCacheSize1D);
341 int nInvisibleTilesX;
342 int nInvisibleTilesY;
345 if( aOutOffset.
Width() < 0 )
346 nInvisibleTilesX = (aOutOffset.
Width() - rSizePixel.
Width() + 1) / rSizePixel.
Width();
348 nInvisibleTilesX = aOutOffset.
Width() / rSizePixel.
Width();
351 if( aOutOffset.
Height() < 0 )
352 nInvisibleTilesY = (aOutOffset.
Height() - rSizePixel.
Height() + 1) / rSizePixel.
Height();
354 nInvisibleTilesY = aOutOffset.
Height() / rSizePixel.
Height();
360 const Point aOutStart( aOutOrigin.
X() + nInvisibleTilesX*rSizePixel.
Width(),
361 aOutOrigin.
Y() + nInvisibleTilesY*rSizePixel.
Height() );
381 int nNumTilesX,
int nNumTilesY,
384 Point aCurrPos( rPosPixel );
399 for( nY=0; nY < nNumTilesY; ++nY )
401 aCurrPos.
setX( rPosPixel.
X() );
403 for( nX=0; nX < nNumTilesX; ++nX )
413 bDrawInPixel ? rTileSizePixel : aTileSizeLogic,
430 const Size& rCropLeftTop,
431 const Size& rCropRightBottom,
433 const Size& rDstSize,
434 bool bEnlarge )
const
441 rBmpEx.
Crop( rCropRect );
445 rCropLeftTop.
Width() < 0 ||
446 rCropLeftTop.
Height() < 0 ||
447 rCropRightBottom.
Width() < 0 ||
448 rCropRightBottom.
Height() < 0 ) )
451 sal_Int32 nPadLeft( rCropLeftTop.
Width() < 0 ? -rCropLeftTop.
Width() : 0 );
452 sal_Int32 nPadTop( rCropLeftTop.
Height() < 0 ? -rCropLeftTop.
Height() : 0 );
453 sal_Int32 nPadTotalWidth( aBmpSize.
Width() + nPadLeft + (rCropRightBottom.
Width() < 0 ? -rCropRightBottom.
Width() : 0) );
454 sal_Int32 nPadTotalHeight( aBmpSize.
Height() + nPadTop + (rCropRightBottom.
Height() < 0 ? -rCropRightBottom.
Height() : 0) );
475 aBmpEx2.
Scale(
Size(nPadTotalWidth, nPadTotalHeight));
490 double fSrcWH =
static_cast<double>(aSizePixel.
Width()) / aSizePixel.
Height();
491 double fDstWH =
static_cast<double>(rDstSize.
Width()) / rDstSize.
Height();
492 double fScaleX = 1.0, fScaleY = 1.0;
495 if( fSrcWH < fDstWH )
496 fScaleY = aSizePixel.
Width() / ( fDstWH * aSizePixel.
Height() );
498 fScaleX = fDstWH * aSizePixel.
Height() / aSizePixel.
Width();
500 rBmpEx.
Scale( fScaleX, fScaleY );
void Erase(sal_uInt8 cTransparency)
const AlphaMask & GetAlphaMask() const
bool Scale(const Size &rNewSize, BmpScaleFlag nScaleFlag=BmpScaleFlag::Default)
Scale the bitmap.
bool Erase(const Color &rFillColor)
Fill the entire bitmap with the given color.
bool CopyPixel(const tools::Rectangle &rRectDst, const tools::Rectangle &rRectSrc, const BitmapEx *pBmpExSrc)
Copy a rectangular area from another bitmap.
Bitmap GetBitmap(Color aTransparentReplaceColor) const
bool Crop(const tools::Rectangle &rRectPixel)
Crop the bitmap.
const Size & GetSizePixel() const
Degree10 GetRotation() const
void VCL_DLLPRIVATE ImplTransformBitmap(BitmapEx &rBmpEx, const GraphicAttr &rAttr, const Size &rCropLeftTop, const Size &rCropRightBottom, const tools::Rectangle &rCropRect, const Size &rDstSize, bool bEnlarge) const
void SetGraphic(const Graphic &rGraphic)
const Graphic & GetGraphic() const
GraphicType GetType() const
bool VCL_DLLPRIVATE ImplDrawTiled(OutputDevice &rOut, const tools::Rectangle &rArea, const Size &rSizePixel, const Size &rOffset, const GraphicAttr *pAttr, int nTileCacheSize1D)
bool VCL_DLLPRIVATE ImplRenderTileRecursive(VirtualDevice &rVDev, int nExponent, int nMSBFactor, int nNumOrigTilesX, int nNumOrigTilesY, int nRemainderTilesX, int nRemainderTilesY, const Size &rTileSizePixel, const GraphicAttr *pAttr, ImplTileInfo &rTileInfo)
internally called by ImplRenderTempTile()
bool IsTransparent() const
bool VCL_DLLPRIVATE ImplRenderTempTile(VirtualDevice &rVDev, int nNumTilesX, int nNumTilesY, const Size &rTileSizePixel, const GraphicAttr *pAttr)
Render a given number of tiles in an optimized way.
bool Draw(OutputDevice &rOut, const Point &rPt, const Size &rSz, const GraphicAttr *pAttr=nullptr) const
const Fraction & GetScaleX() const
MapUnit GetMapUnit() const
const Fraction & GetScaleY() const
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
GDIMetaFile * GetConnectMetaFile() const
void EnableMapMode(bool bEnable=true)
void DrawEllipse(const tools::Rectangle &rRect)
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
void DrawRect(const tools::Rectangle &rRect)
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
virtual Bitmap GetBitmap(const Point &rSrcPt, const Size &rSize) const
const MapMode & GetMapMode() const
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
void IntersectClipRegion(const tools::Rectangle &rRect)
bool IsMapModeEnabled() const
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
constexpr ::Color COL_WHITE(0xFF, 0xFF, 0xFF)
BitmapEx GetBitmapEx(BitmapEx const &rBitmapEx, DrawModeFlags nDrawMode)