20#include <config_features.h>
23#include <osl/diagnose.h>
65 : mxSalBmp(rBitmap.mxSalBmp)
66 , maPrefMapMode(rBitmap.maPrefMapMode)
67 , maPrefSize(rBitmap.maPrefSize)
72 : mxSalBmp(
std::move(pSalBitmap))
74 , maPrefSize(mxSalBmp->GetSize())
107 sal_uInt16 nActCol = 16;
109 for( sal_uInt16 nB = 0; nB < 256; nB += 51 )
110 for( sal_uInt16 nG = 0; nG < 256; nG += 51 )
111 for( sal_uInt16 nR = 0; nR < 256; nR += 51 )
132 mxSalBmp->Create(rSizePixel, ePixelFormat, *pPal);
139void savePNG(
const OUString& sWhere,
const Bitmap& rBmp)
141 SvFileStream aStream(sWhere, StreamMode::WRITE | StreamMode::TRUNC);
153 static const OUString sDumpPath(OUString::createFromAscii(std::getenv(
"VCL_DUMP_BMP_PATH")));
156 static volatile bool save(
false);
157 if (!sDumpPath.isEmpty() && save)
160 savePNG(sDumpPath +
"BitmapDump.png", *
this);
168constexpr std::enable_if_t<255 % (
N - 1) == 0, std::array<BitmapColor, N>> getGreyscalePalette()
170 const int step = 255 / (
N - 1);
171 std::array<BitmapColor, N>
a;
172 for (
size_t i = 0;
i <
N; ++
i)
185 static const BitmapPalette aGreyPalette2 = getGreyscalePalette<2>();
186 return aGreyPalette2;
190 static const BitmapPalette aGreyPalette4 = getGreyscalePalette<4>();
191 return aGreyPalette4;
195 static const BitmapPalette aGreyPalette16 = getGreyscalePalette<16>();
196 return aGreyPalette16;
200 static const BitmapPalette aGreyPalette256 = getGreyscalePalette<256>();
201 return aGreyPalette256;
204 OSL_FAIL(
"Bitmap::GetGreyPalette: invalid entry count (2/4/16/256 allowed)");
210 if (
this == &rBitmap)
222 maPrefSize = std::move(rBitmap.maPrefSize);
223 maPrefMapMode = std::move(rBitmap.maPrefMapMode);
224 mxSalBmp = std::move(rBitmap.mxSalBmp);
241 if (aChecksum1 == 0 || aChecksum2 == 0)
243 return aChecksum1 == aChecksum2;
313 std::shared_ptr<SalBitmap> xNewImpBmp(
ImplGetSVData()->mpDefInst->CreateSalBitmap());
329 std::shared_ptr<SalBitmap> xOldImpBmp =
mxSalBmp;
331 (void)
mxSalBmp->Create(*xOldImpBmp);
342 if ((aOldSizePix != aNewSizePix) && aOldSizePix.
Width() && aOldSizePix.
Height())
365 std::unique_ptr<BitmapInfoAccess> pInfoAccess(
new BitmapInfoAccess( *
this ));
372 return pInfoAccess.release();
377 std::unique_ptr<BitmapReadAccess> pReadAccess(
new BitmapReadAccess( *
this ));
384 return pReadAccess.release();
396 return pWriteAccess.release();
401 delete pBitmapAccess;
429 for(
tools::Long nY = 0, nY2 = nOldY; nY < nNewHeight; nY++, nY2++ )
431 Scanline pScanline = pWriteAcc->GetScanline(nY);
433 for(
tools::Long nX = 0, nX2 = nOldX; nX < nNewWidth; nX++, nX2++ )
434 pWriteAcc->SetPixelOnData( pScanline, nX, pReadAcc->
GetPixelFromData( pScanlineRead, nX2 ) );
465 if( nSrcBitCount > nDstBitCount )
469 if (nSrcBitCount == 24)
471 else if (nSrcBitCount == 8)
476 else if (nSrcBitCount == 4)
486 if( pSrcAcc && pDstAcc )
489 const int nDstCount = 1 << nDstBitCount;
491 for (
int i = 0; (
i < nSrcCount ) && ( nNextIndex < nDstCount ); ++
i)
497 for (
int j = 0; j < nDstCount; ++j)
499 if( rSrcCol == pDstAcc->GetPaletteColor(
static_cast<sal_uInt16
>(j) ) )
507 pDstAcc->SetPaletteColor(
static_cast<sal_uInt16
>(nNextIndex++), rSrcCol );
531 if( pReadAcc->
HasPalette() && pWriteAcc->HasPalette() )
541 for(
tools::Long nSrcY = aRectSrc.
Top(); nSrcY < nSrcEndY; nSrcY++, nDstY++ )
543 Scanline pScanline = pWriteAcc->GetScanline(nDstY);
545 for(
tools::Long nSrcX = aRectSrc.
Left(), nDstX = aRectDst.
Left(); nSrcX < nSrcEndX; nSrcX++, nDstX++ )
551 for(
tools::Long nSrcY = aRectSrc.
Top(); nSrcY < nSrcEndY; nSrcY++, nDstY++ )
553 Scanline pScanline = pWriteAcc->GetScanline(nDstY);
555 for(
tools::Long nSrcX = aRectSrc.
Left(), nDstX = aRectDst.
Left(); nSrcX < nSrcEndX; nSrcX++, nDstX++ )
560 for(
tools::Long nSrcY = aRectSrc.
Top(); nSrcY < nSrcEndY; nSrcY++, nDstY++ )
562 Scanline pScanline = pWriteAcc->GetScanline(nDstY);
564 for(
tools::Long nSrcX = aRectSrc.
Left(), nDstX = aRectDst.
Left(); nSrcX < nSrcEndX; nSrcX++, nDstX++ )
565 pWriteAcc->SetPixelOnData( pScanline, nDstX, pReadAcc->
GetPixelFromData( pScanlineRead, nSrcX ) );
569 bRet = ( nWidth > 0 ) && ( nHeight > 0 );
582 if( !aRectSrc.
IsEmpty() && ( aRectSrc != aRectDst ) )
599 if( ( nDstX <= nSrcX ) && ( nDstY <= nSrcY ) )
601 for(
tools::Long nY = nSrcY, nYN = nDstY; nY <= nSrcEndY1; nY++, nYN++ )
603 Scanline pScanline = pWriteAcc->GetScanline(nYN);
604 Scanline pScanlineSrc = pWriteAcc->GetScanline(nY);
605 for(
tools::Long nX = nSrcX, nXN = nDstX; nX <= nSrcEndX1; nX++, nXN++ )
606 pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixelFromData( pScanlineSrc, nX ) );
609 else if( ( nDstX <= nSrcX ) && ( nDstY >= nSrcY ) )
611 for(
tools::Long nY = nSrcEndY1, nYN = nDstEndY1; nY >= nSrcY; nY--, nYN-- )
613 Scanline pScanline = pWriteAcc->GetScanline(nYN);
614 Scanline pScanlineSrc = pWriteAcc->GetScanline(nY);
615 for(
tools::Long nX = nSrcX, nXN = nDstX; nX <= nSrcEndX1; nX++, nXN++ )
616 pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixelFromData( pScanlineSrc, nX ) );
619 else if( ( nDstX >= nSrcX ) && ( nDstY <= nSrcY ) )
621 for(
tools::Long nY = nSrcY, nYN = nDstY; nY <= nSrcEndY1; nY++, nYN++ )
623 Scanline pScanline = pWriteAcc->GetScanline(nYN);
624 Scanline pScanlineSrc = pWriteAcc->GetScanline(nY);
625 for(
tools::Long nX = nSrcEndX1, nXN = nDstEndX1; nX >= nSrcX; nX--, nXN-- )
626 pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixelFromData( pScanlineSrc, nX ) );
631 for(
tools::Long nY = nSrcEndY1, nYN = nDstEndY1; nY >= nSrcY; nY--, nYN-- )
633 Scanline pScanline = pWriteAcc->GetScanline(nYN);
634 Scanline pScanlineSrc = pWriteAcc->GetScanline(nY);
635 for(
tools::Long nX = nSrcEndX1, nXN = nDstEndX1; nX >= nSrcX; nX--, nXN-- )
636 pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixelFromData( pScanlineSrc, nX ) );
687 for(
tools::Long nSrcY = aRectSrc.
Top(); nSrcY < nSrcEndY; nSrcY++, nDstY++)
689 Scanline pScanline = pWriteAcc->GetScanline(nDstY);
691 for(
tools::Long nSrcX = aRectSrc.
Left(), nDstX = aRectDst.
Left(); nSrcX < nSrcEndX; nSrcX++, nDstX++ )
692 pWriteAcc->SetPixelOnData( pScanline, nDstX, pReadAcc->
GetPixelFromData( pScanlineRead, nSrcX ) );
696 bRet = ( nWidth > 0 ) && ( nHeight > 0 );
709 if( !aRectSrc.
IsEmpty() && ( aRectSrc != aRectDst ) )
726 if( ( nDstX <= nSrcX ) && ( nDstY <= nSrcY ) )
728 for(
tools::Long nY = nSrcY, nYN = nDstY; nY <= nSrcEndY1; nY++, nYN++ )
730 Scanline pScanline = pWriteAcc->GetScanline(nYN);
731 Scanline pScanlineSrc = pWriteAcc->GetScanline(nY);
732 for(
tools::Long nX = nSrcX, nXN = nDstX; nX <= nSrcEndX1; nX++, nXN++ )
733 pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixelFromData( pScanlineSrc, nX ) );
736 else if( ( nDstX <= nSrcX ) && ( nDstY >= nSrcY ) )
738 for(
tools::Long nY = nSrcEndY1, nYN = nDstEndY1; nY >= nSrcY; nY--, nYN-- )
740 Scanline pScanline = pWriteAcc->GetScanline(nYN);
741 Scanline pScanlineSrc = pWriteAcc->GetScanline(nY);
742 for(
tools::Long nX = nSrcX, nXN = nDstX; nX <= nSrcEndX1; nX++, nXN++ )
743 pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixelFromData( pScanlineSrc, nX ) );
746 else if( ( nDstX >= nSrcX ) && ( nDstY <= nSrcY ) )
748 for(
tools::Long nY = nSrcY, nYN = nDstY; nY <= nSrcEndY1; nY++, nYN++ )
750 Scanline pScanline = pWriteAcc->GetScanline(nYN);
751 Scanline pScanlineSrc = pWriteAcc->GetScanline(nY);
752 for(
tools::Long nX = nSrcEndX1, nXN = nDstEndX1; nX >= nSrcX; nX--, nXN-- )
753 pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixelFromData( pScanlineSrc, nX ) );
758 for(
tools::Long nY = nSrcEndY1, nYN = nDstEndY1; nY >= nSrcY; nY--, nYN-- )
760 Scanline pScanline = pWriteAcc->GetScanline(nYN);
761 Scanline pScanlineSrc = pWriteAcc->GetScanline(nY);
762 for(
tools::Long nX = nSrcEndX1, nXN = nDstEndX1; nX >= nSrcX; nX--, nXN-- )
763 pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixelFromData( pScanlineSrc, nX ) );
785 const Size aNewSize( nWidth + nDX, nHeight + nDY );
800 const tools::Long nNewHeight = pWriteAcc->Height();
805 aColor = pWriteAcc->GetBestMatchingColor( *pInitColor );
807 for( nY = 0; nY < nHeight; nY++ )
809 pWriteAcc->CopyScanline( nY, *pReadAcc );
811 if( pInitColor && nDX )
813 Scanline pScanline = pWriteAcc->GetScanline(nY);
814 for( nX = nNewX; nX < nNewWidth; nX++ )
815 pWriteAcc->SetPixelOnData( pScanline, nX, aColor );
819 if( pInitColor && nDY )
820 for( nY = nNewY; nY < nNewHeight; nY++ )
822 Scanline pScanline = pWriteAcc->GetScanline(nY);
823 for( nX = 0; nX < nNewWidth; nX++ )
824 pWriteAcc->SetPixelOnData( pScanline, nX, aColor );
843 std::shared_ptr<SalBitmap> xImpDispBmp(
ImplGetSVData()->mpDefInst->CreateSalBitmap());
844 if (xImpDispBmp->Create(*
mxSalBmp, pDispGraphics))
867 std::shared_ptr<SalBitmap> xImpBmp(
ImplGetSVData()->mpDefInst->CreateSalBitmap());
869 if (xImpBmp->Create(*
mxSalBmp) && xImpBmp->InterpretAs8Bit())
878 std::shared_ptr<SalBitmap> xImpBmp(
ImplGetSVData()->mpDefInst->CreateSalBitmap());
879 if (xImpBmp->Create(*
mxSalBmp) && xImpBmp->ConvertToGreyscale())
891 switch( eConversion )
947 OSL_FAIL(
"Bitmap::Convert(): Unsupported conversion" );
965 bPalDiffers = ( rPal != pReadAcc->
GetPalette() );
982 Scanline pScanline = pWriteAcc->GetScanline(nY);
987 pWriteAcc->SetPixelOnData( pScanline, nX,
1000 Scanline pWriteScan = pWriteAcc->GetScanline( nY );
1008 *pWriteScan++ =
static_cast<sal_uInt8>( ( nB * 28UL + nG * 151UL + nR * 77UL ) >> nShift );
1020 Scanline pWriteScan = pWriteAcc->GetScanline( nY );
1028 *pWriteScan++ =
static_cast<sal_uInt8>( ( nB * 28UL + nG * 151UL + nR * 77UL ) >> nShift );
1036 Scanline pScanline = pWriteAcc->GetScanline(nY);
1074 if (pWriteAcc->HasPalette())
1082 for (sal_uInt16
i = 0;
i < nOldCount;
i++)
1083 aPalette[
i] = rOldPalette[
i];
1088 pWriteAcc->SetPalette(aPalette);
1092 Scanline pScanline = pWriteAcc->GetScanline(nY);
1096 pWriteAcc->SetPixelOnData(pScanline, nX, pReadAcc->
GetPixelFromData(pScanlineRead, nX));
1106 Scanline pScanline = pWriteAcc->GetScanline(nY);
1118 Scanline pScanline = pWriteAcc->GetScanline(nY);
1122 pWriteAcc->SetPixelOnData(pScanline, nX, pReadAcc->
GetPixelFromData(pScanlineRead, nX));
1154 const sal_uInt16
nCount = 1 << nNewBitCount;
1163 std::vector<ImpErrorQuad> aErrQuad1(nWidth);
1164 std::vector<ImpErrorQuad> aErrQuad2(nWidth);
1185 pWriteAcc->SetPalette(aPalette);
1189 pQLine2 = !nY ? aErrQuad1.data() : aErrQuad2.data();
1200 assert(pQLine2 || nHeight == 0);
1202 for (
tools::Long nY = 0; nY < nHeight; nY++, nYTmp++)
1206 Scanline pScanline = pWriteAcc->GetScanline(nY);
1207 pWriteAcc->SetPixelOnData(pScanline, 0,
BitmapColor(cIndex));
1210 for (nX = 1; nX < nWidth1; nX++)
1214 aErrQuad = (
ImpErrorQuad(aColor) -= pWriteAcc->GetPaletteColor(cIndex));
1219 pWriteAcc->SetPixelOnData(pScanline, nX,
BitmapColor(cIndex));
1226 pWriteAcc->SetPixelOnData(pScanline, nX,
BitmapColor(cIndex));
1232 pQLine2 = bQ1 ? aErrQuad2.data() : aErrQuad1.data();
1234 if (nYTmp < nHeight)
1237 for (nX = 0; nX < nWidth; nX++)
1279 std::shared_ptr<SalBitmap> xImpBmp(
ImplGetSVData()->mpDefInst->CreateSalBitmap());
1280 if (xImpBmp->Create(*
mxSalBmp) && xImpBmp->Scale(rScaleX, rScaleY, nScaleFlag))
1291 bool bRetval(
false);
1328 OSL_ENSURE(!bRetval || eStartPixelFormat ==
getPixelFormat(),
"Bitmap::Scale has changed the ColorDepth, this should *not* happen (!)");
1340 static_cast<double>(rNewSize.
Height()) / aSize.
Height(),
1351#if HAVE_FEATURE_SKIA
1390 SAL_WARN(
"vcl",
"Can't adapt the pixelformat as it is invalid.");
1398 *pColorArray++ =
static_cast<sal_Int32
>(rColor.
GetBlue()) << 12;
1399 *pColorArray++ =
static_cast<sal_Int32
>(rColor.
GetGreen()) << 12;
1400 *pColorArray++ =
static_cast<sal_Int32
>(rColor.
GetRed()) << 12;
1417 if( ( aSize.
Width() <= 3 ) || ( aSize.
Height() <= 2 ) )
1423 if( !pReadAcc || !pWriteAcc )
1431 std::unique_ptr<sal_Int32[]> p1(
new sal_Int32[ nW ]);
1432 std::unique_ptr<sal_Int32[]> p2(
new sal_Int32[ nW ]);
1433 sal_Int32* p1T = p1.get();
1434 sal_Int32* p2T = p2.get();
1435 sal_Int32* pTmp = p2T;
1442 for(
tools::Long nY = 1, nYAcc = 0; nY <= nHeight; nY++, nYAcc++ )
1461 Scanline pScanline = pWriteAcc->GetScanline(nYAcc);
1465 for ( nX = 3, nXAcc = 1; nX < nW2; nXAcc++ )
1497 short nChannelRPercent,
short nChannelGPercent,
short nChannelBPercent,
1498 double fGamma,
bool bInvert,
bool msoBrightness )
1501 if( !nLuminancePercent && !nContrastPercent &&
1502 !nChannelRPercent && !nChannelGPercent && !nChannelBPercent &&
1503 ( fGamma == 1.0 ) && !bInvert )
1515 std::unique_ptr<sal_uInt8[]> cMapR(
new sal_uInt8[ 256 ]);
1516 std::unique_ptr<sal_uInt8[]> cMapG(
new sal_uInt8[ 256 ]);
1517 std::unique_ptr<sal_uInt8[]> cMapB(
new sal_uInt8[ 256 ]);
1518 double fM, fROff, fGOff, fBOff, fOff;
1521 if( nContrastPercent >= 0 )
1522 fM = 128.0 / ( 128.0 - 1.27 *
MinMax( nContrastPercent, 0, 100 ) );
1524 fM = ( 128.0 + 1.27 *
MinMax( nContrastPercent, -100, 0 ) ) / 128.0;
1528 fOff =
MinMax( nLuminancePercent, -100, 100 ) * 2.55 + 128.0 - fM * 128.0;
1530 fOff =
MinMax( nLuminancePercent, -100, 100 ) * 2.55;
1533 fROff = nChannelRPercent * 2.55 + fOff;
1534 fGOff = nChannelGPercent * 2.55 + fOff;
1535 fBOff = nChannelBPercent * 2.55 + fOff;
1538 fGamma = ( fGamma <= 0.0 || fGamma > 10.0 ) ? 1.0 : ( 1.0 / fGamma );
1539 const bool bGamma = ( fGamma != 1.0 );
1555 cMapR[ nX ] =
static_cast<sal_uInt8>(
MinMax(
FRound( (nX+fROff/2-128) * fM + 128 + fROff/2 ), 0, 255 ));
1556 cMapG[ nX ] =
static_cast<sal_uInt8>(
MinMax(
FRound( (nX+fGOff/2-128) * fM + 128 + fGOff/2 ), 0, 255 ));
1557 cMapB[ nX ] =
static_cast<sal_uInt8>(
MinMax(
FRound( (nX+fBOff/2-128) * fM + 128 + fBOff/2 ), 0, 255 ));
1561 cMapR[ nX ] =
GAMMA( cMapR[ nX ], fGamma );
1562 cMapG[ nX ] =
GAMMA( cMapG[ nX ], fGamma );
1563 cMapB[ nX ] =
GAMMA( cMapB[ nX ], fGamma );
1568 cMapR[ nX ] = ~cMapR[ nX ];
1569 cMapG[ nX ] = ~cMapG[ nX ];
1570 cMapB[ nX ] = ~cMapB[ nX ];
1575 if( pAcc->HasPalette() )
1579 for( sal_uInt16
i = 0,
nCount = pAcc->GetPaletteEntryCount();
i <
nCount;
i++ )
1585 pAcc->SetPaletteColor(
i, aNewCol );
1592 Scanline pScan = pAcc->GetScanline( nY );
1596 *pScan = cMapB[ *pScan ]; pScan++;
1597 *pScan = cMapG[ *pScan ]; pScan++;
1598 *pScan = cMapR[ *pScan ]; pScan++;
1606 Scanline pScan = pAcc->GetScanline( nY );
1610 *pScan = cMapR[ *pScan ]; pScan++;
1611 *pScan = cMapG[ *pScan ]; pScan++;
1612 *pScan = cMapB[ *pScan ]; pScan++;
1620 Scanline pScanline = pAcc->GetScanline(nY);
1623 aCol = pAcc->GetPixelFromData( pScanline, nX );
1627 pAcc->SetPixelOnData( pScanline, nX, aCol );
1639inline sal_uInt8 backBlendAlpha(sal_uInt16 alpha, sal_uInt16 srcCol, sal_uInt16 startCol)
1641 const sal_uInt16 nAlpha((alpha * startCol) / 255);
1644 return static_cast<sal_uInt8>(((srcCol - nAlpha) * 255) / (255 - nAlpha));
1652 const Color& rStartColor,
1664 if(0 == nHeight || 0 == nWidth)
1670 if(pAlphaAcc->Height() != nHeight || pAlphaAcc->Width() != nWidth)
1674 const sal_uInt16 nStartColRed(rStartColor.
GetRed());
1675 const sal_uInt16 nStartColGreen(rStartColor.
GetGreen());
1676 const sal_uInt16 nStartColBlue(rStartColor.
GetBlue());
1683 const sal_uInt8 nAlpha8(pAlphaAcc->GetColor(
y,
x).GetRed());
1686 if(0 == nAlpha8 || 255 == nAlpha8)
1690 const sal_uInt16 nAlpha16(
static_cast<sal_uInt16
>(nAlpha8));
1696 aColor.
SetRed(backBlendAlpha(nAlpha16,
static_cast<sal_uInt16
>(aColor.
GetRed()), nStartColRed));
1697 aColor.
SetGreen(backBlendAlpha(nAlpha16,
static_cast<sal_uInt16
>(aColor.
GetGreen()), nStartColGreen));
1698 aColor.
SetBlue(backBlendAlpha(nAlpha16,
static_cast<sal_uInt16
>(aColor.
GetBlue()), nStartColBlue));
1701 pAcc->SetPixel(
y,
x, aColor);
1710 return mxSalBmp->accessSystemDependentDataHolder();
static BitmapColor getColor(const BitmapReadAccess *pReadAcc, tools::Long nZ)
static sal_Int32 * shiftColor(sal_Int32 *pColorArray, BitmapColor const &rColor)
sal_uInt64 BitmapChecksum
Bitmap GetBitmap(Color aTransparentReplaceColor) const
static bool Filter(BitmapEx &rBmpEx, BitmapFilter const &rFilter)
tools::Long Height() const
tools::Long Width() const
const BitmapPalette & GetPalette() const
ScanlineFormat GetScanlineFormat() const
sal_uInt16 GetPaletteEntryCount() const
const BitmapColor & GetPaletteColor(sal_uInt16 nColor) const
sal_uInt16 GetEntryCount() const
bool IsGreyPaletteAny() const
Returns true if the palette is a grey palette (may not be 8-bit).
void SetEntryCount(sal_uInt16 nCount)
bool IsGreyPalette8Bit() const
Returns true if the palette is 8-bit grey palette.
BitmapColor GetPixelFromData(const sal_uInt8 *pData, tools::Long nX) const
sal_uInt8 GetIndexFromData(const sal_uInt8 *pData, tools::Long nX) const
Scanline GetScanline(tools::Long nY) const
bool Dither()
Apply a Floyd dither algorithm to the bitmap.
Bitmap CreateDisplayBitmap(OutputDevice *pDisplay) const
Bitmap & operator=(const Bitmap &rBitmap)
bool Crop(const tools::Rectangle &rRectPixel)
Crop the bitmap.
BitmapWriteAccess * AcquireWriteAccess()
bool HasGreyPalette8Bit() const
SAL_DLLPRIVATE void ImplSetSalBitmap(const std::shared_ptr< SalBitmap > &xImpBmp)
bool Convert(BmpConversion eConversion)
Convert bitmap format.
static const BitmapPalette & GetGreyPalette(int nEntries)
SAL_DLLPRIVATE void ImplMakeUnique()
BitmapChecksum GetChecksum() const
SAL_DLLPRIVATE void ReassignWithSize(const Bitmap &rBitmap)
ReassignWithSize and recalculate bitmap.
Size GetSizePixel() const
static void ReleaseAccess(BitmapInfoAccess *pAccess)
bool Scale(const Size &rNewSize, BmpScaleFlag nScaleFlag=BmpScaleFlag::Default)
Scale the bitmap.
bool CopyPixel_AlphaOptimized(const tools::Rectangle &rRectDst, const tools::Rectangle &rRectSrc, const Bitmap *pBmpSrc)
void Vectorize(GDIMetaFile &rMtf, sal_uInt8 cReduce, const Link< tools::Long, void > *pProgress)
Convert the bitmap to a meta file.
BitmapReadAccess * AcquireReadAccess()
bool HasGreyPaletteAny() const
bool operator==(const Bitmap &rBitmap) const
SAL_DLLPRIVATE bool ImplConvertUp(vcl::PixelFormat ePixelFormat, Color const *pExtColor=nullptr)
bool Adjust(short nLuminancePercent, short nContrastPercent=0, short nChannelRPercent=0, short nChannelGPercent=0, short nChannelBPercent=0, double fGamma=1.0, bool bInvert=false, bool msoBrightness=false)
Change various global color characteristics.
void RemoveBlendedStartColor(const Color &rColor, const AlphaMask &rAlphaMask)
Remove existing blending against COL_WHITE based on given AlphaMask.
SAL_DLLPRIVATE bool ImplMakeGreyscales()
bool CopyPixel(const tools::Rectangle &rRectDst, const tools::Rectangle &rRectSrc, const Bitmap *pBmpSrc=nullptr)
Copy a rectangular area from another bitmap.
SAL_DLLPRIVATE bool ImplConvertDown8BPP(Color const *pExtColor=nullptr)
void AdaptBitCount(Bitmap &rNew) const
bool GetSystemData(BitmapSystemData &rData) const
get system dependent bitmap data
const basegfx::SystemDependentDataHolder * accessSystemDependentDataHolder() const
bool Expand(sal_Int32 nDX, sal_Int32 nDY, const Color *pInitColor=nullptr)
Expand the bitmap by pixel padding.
vcl::PixelFormat getPixelFormat() const
static bool HasFastScale()
Returns true if bitmap scaling is considered to be fast.
std::shared_ptr< SalBitmap > mxSalBmp
BitmapInfoAccess * AcquireInfoAccess()
sal_uInt8 GetLuminance() const
sal_uInt8 GetBlue() const
void SetGreen(sal_uInt8 nGreen)
void SetRed(sal_uInt8 nRed)
sal_uInt8 GetGreen() const
void SetBlue(sal_uInt8 nBlue)
Class to import and export graphic formats.
static GraphicFilter & GetGraphicFilter()
ErrCode compressAsPNG(const Graphic &rGraphic, SvStream &rOutputStream)
void ImplAddColorError7(const ImpErrorQuad &rErrQuad)
BitmapColor ImplGetColor() const
void ImplAddColorError5(const ImpErrorQuad &rErrQuad)
void ImplAddColorError3(const ImpErrorQuad &rErrQuad)
void ImplAddColorError1(const ImpErrorQuad &rErrQuad)
sal_uInt16 GetBestPaletteIndex(const BitmapColor &rColor)
const BitmapPalette & GetPalette()
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
SalGraphics const * GetGraphics() const
Get the graphic context that the output device uses to draw on.
virtual std::shared_ptr< SalBitmap > CreateSalBitmap()=0
constexpr tools::Long Height() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
constexpr ::Color COL_LIGHTRED(0xFF, 0x00, 0x00)
constexpr ::Color COL_GRAY(0x80, 0x80, 0x80)
constexpr ::Color COL_GREEN(0x00, 0x80, 0x00)
constexpr ::Color COL_WHITE(0xFF, 0xFF, 0xFF)
constexpr ::Color COL_LIGHTCYAN(0x00, 0xFF, 0xFF)
constexpr ::Color COL_MAGENTA(0x80, 0x00, 0x80)
constexpr ::Color COL_LIGHTMAGENTA(0xFF, 0x00, 0xFF)
constexpr ::Color COL_BROWN(0x80, 0x80, 0x00)
constexpr ::Color COL_YELLOW(0xFF, 0xFF, 0x00)
constexpr ::Color COL_RED(0x80, 0x00, 0x00)
constexpr ::Color COL_LIGHTGRAY(0xC0, 0xC0, 0xC0)
constexpr ::Color COL_LIGHTBLUE(0x00, 0x00, 0xFF)
constexpr ::Color COL_CYAN(0x00, 0x80, 0x80)
constexpr ::Color COL_LIGHTGREEN(0x00, 0xFF, 0x00)
constexpr ::Color COL_BLUE(0x00, 0x00, 0x80)
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
const sal_uLong nVCLBLut[6]
const sal_uLong nVCLGLut[6]
const sal_uLong nVCLRLut[6]
tools::Long FRound(double fVal)
std::enable_if< std::is_signed< T >::value||std::is_floating_point< T >::value, long >::type MinMax(T nVal, tools::Long nMin, tools::Long nMax)
#define GAMMA(_def_cVal, _def_InvGamma)
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
bool ImplVectorize(const Bitmap &rColorBmp, GDIMetaFile &rMtf, sal_uInt8 cReduce, const Link< tools::Long, void > *pProgress)
VCL_DLLPUBLIC bool isVCLSkiaEnabled()
constexpr bool isPalettePixelFormat(PixelFormat ePixelFormat)
Is it a pixel format that forces creation of a palette.
PixelFormat
Pixel format of the bitmap in bits per pixel.
constexpr sal_uInt16 pixelFormatBitCount(PixelFormat ePixelFormat)
HashMap_OWString_Interface aMap
ImplSVData * ImplGetSVData()