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;
315 std::shared_ptr<SalBitmap> xNewImpBmp(
ImplGetSVData()->mpDefInst->CreateSalBitmap());
332 std::shared_ptr<SalBitmap> xOldImpBmp =
mxSalBmp;
334 (void)
mxSalBmp->Create(*xOldImpBmp);
345 if ((aOldSizePix != aNewSizePix) && aOldSizePix.
Width() && aOldSizePix.
Height())
368 std::unique_ptr<BitmapInfoAccess> pInfoAccess(
new BitmapInfoAccess( *
this ));
375 return pInfoAccess.release();
380 std::unique_ptr<BitmapReadAccess> pReadAccess(
new BitmapReadAccess( *
this ));
387 return pReadAccess.release();
399 return pWriteAccess.release();
404 delete pBitmapAccess;
432 for(
tools::Long nY = 0, nY2 = nOldY; nY < nNewHeight; nY++, nY2++ )
434 Scanline pScanline = pWriteAcc->GetScanline(nY);
436 for(
tools::Long nX = 0, nX2 = nOldX; nX < nNewWidth; nX++, nX2++ )
437 pWriteAcc->SetPixelOnData( pScanline, nX, pReadAcc->
GetPixelFromData( pScanlineRead, nX2 ) );
468 if( nSrcBitCount > nDstBitCount )
472 if (nSrcBitCount == 24)
474 else if (nSrcBitCount == 8)
479 else if (nSrcBitCount == 4)
489 if( pSrcAcc && pDstAcc )
492 const int nDstCount = 1 << nDstBitCount;
494 for (
int i = 0; (
i < nSrcCount ) && ( nNextIndex < nDstCount ); ++
i)
500 for (
int j = 0; j < nDstCount; ++j)
502 if( rSrcCol == pDstAcc->GetPaletteColor(
static_cast<sal_uInt16
>(j) ) )
510 pDstAcc->SetPaletteColor(
static_cast<sal_uInt16
>(nNextIndex++), rSrcCol );
534 if( pReadAcc->
HasPalette() && pWriteAcc->HasPalette() )
544 for(
tools::Long nSrcY = aRectSrc.
Top(); nSrcY < nSrcEndY; nSrcY++, nDstY++ )
546 Scanline pScanline = pWriteAcc->GetScanline(nDstY);
548 for(
tools::Long nSrcX = aRectSrc.
Left(), nDstX = aRectDst.
Left(); nSrcX < nSrcEndX; nSrcX++, nDstX++ )
554 for(
tools::Long nSrcY = aRectSrc.
Top(); nSrcY < nSrcEndY; nSrcY++, nDstY++ )
556 Scanline pScanline = pWriteAcc->GetScanline(nDstY);
558 for(
tools::Long nSrcX = aRectSrc.
Left(), nDstX = aRectDst.
Left(); nSrcX < nSrcEndX; nSrcX++, nDstX++ )
563 for(
tools::Long nSrcY = aRectSrc.
Top(); nSrcY < nSrcEndY; nSrcY++, nDstY++ )
565 Scanline pScanline = pWriteAcc->GetScanline(nDstY);
567 for(
tools::Long nSrcX = aRectSrc.
Left(), nDstX = aRectDst.
Left(); nSrcX < nSrcEndX; nSrcX++, nDstX++ )
568 pWriteAcc->SetPixelOnData( pScanline, nDstX, pReadAcc->
GetPixelFromData( pScanlineRead, nSrcX ) );
572 bRet = ( nWidth > 0 ) && ( nHeight > 0 );
585 if( !aRectSrc.
IsEmpty() && ( aRectSrc != aRectDst ) )
602 if( ( nDstX <= nSrcX ) && ( nDstY <= nSrcY ) )
604 for(
tools::Long nY = nSrcY, nYN = nDstY; nY <= nSrcEndY1; nY++, nYN++ )
606 Scanline pScanline = pWriteAcc->GetScanline(nYN);
607 Scanline pScanlineSrc = pWriteAcc->GetScanline(nY);
608 for(
tools::Long nX = nSrcX, nXN = nDstX; nX <= nSrcEndX1; nX++, nXN++ )
609 pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixelFromData( pScanlineSrc, nX ) );
612 else if( ( nDstX <= nSrcX ) && ( nDstY >= nSrcY ) )
614 for(
tools::Long nY = nSrcEndY1, nYN = nDstEndY1; nY >= nSrcY; nY--, nYN-- )
616 Scanline pScanline = pWriteAcc->GetScanline(nYN);
617 Scanline pScanlineSrc = pWriteAcc->GetScanline(nY);
618 for(
tools::Long nX = nSrcX, nXN = nDstX; nX <= nSrcEndX1; nX++, nXN++ )
619 pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixelFromData( pScanlineSrc, nX ) );
622 else if( ( nDstX >= nSrcX ) && ( nDstY <= nSrcY ) )
624 for(
tools::Long nY = nSrcY, nYN = nDstY; nY <= nSrcEndY1; nY++, nYN++ )
626 Scanline pScanline = pWriteAcc->GetScanline(nYN);
627 Scanline pScanlineSrc = pWriteAcc->GetScanline(nY);
628 for(
tools::Long nX = nSrcEndX1, nXN = nDstEndX1; nX >= nSrcX; nX--, nXN-- )
629 pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixelFromData( pScanlineSrc, nX ) );
634 for(
tools::Long nY = nSrcEndY1, nYN = nDstEndY1; nY >= nSrcY; nY--, nYN-- )
636 Scanline pScanline = pWriteAcc->GetScanline(nYN);
637 Scanline pScanlineSrc = pWriteAcc->GetScanline(nY);
638 for(
tools::Long nX = nSrcEndX1, nXN = nDstEndX1; nX >= nSrcX; nX--, nXN-- )
639 pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixelFromData( pScanlineSrc, nX ) );
690 for(
tools::Long nSrcY = aRectSrc.
Top(); nSrcY < nSrcEndY; nSrcY++, nDstY++)
692 Scanline pScanline = pWriteAcc->GetScanline(nDstY);
694 for(
tools::Long nSrcX = aRectSrc.
Left(), nDstX = aRectDst.
Left(); nSrcX < nSrcEndX; nSrcX++, nDstX++ )
695 pWriteAcc->SetPixelOnData( pScanline, nDstX, pReadAcc->
GetPixelFromData( pScanlineRead, nSrcX ) );
699 bRet = ( nWidth > 0 ) && ( nHeight > 0 );
712 if( !aRectSrc.
IsEmpty() && ( aRectSrc != aRectDst ) )
729 if( ( nDstX <= nSrcX ) && ( nDstY <= nSrcY ) )
731 for(
tools::Long nY = nSrcY, nYN = nDstY; nY <= nSrcEndY1; nY++, nYN++ )
733 Scanline pScanline = pWriteAcc->GetScanline(nYN);
734 Scanline pScanlineSrc = pWriteAcc->GetScanline(nY);
735 for(
tools::Long nX = nSrcX, nXN = nDstX; nX <= nSrcEndX1; nX++, nXN++ )
736 pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixelFromData( pScanlineSrc, nX ) );
739 else if( ( nDstX <= nSrcX ) && ( nDstY >= nSrcY ) )
741 for(
tools::Long nY = nSrcEndY1, nYN = nDstEndY1; nY >= nSrcY; nY--, nYN-- )
743 Scanline pScanline = pWriteAcc->GetScanline(nYN);
744 Scanline pScanlineSrc = pWriteAcc->GetScanline(nY);
745 for(
tools::Long nX = nSrcX, nXN = nDstX; nX <= nSrcEndX1; nX++, nXN++ )
746 pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixelFromData( pScanlineSrc, nX ) );
749 else if( ( nDstX >= nSrcX ) && ( nDstY <= nSrcY ) )
751 for(
tools::Long nY = nSrcY, nYN = nDstY; nY <= nSrcEndY1; nY++, nYN++ )
753 Scanline pScanline = pWriteAcc->GetScanline(nYN);
754 Scanline pScanlineSrc = pWriteAcc->GetScanline(nY);
755 for(
tools::Long nX = nSrcEndX1, nXN = nDstEndX1; nX >= nSrcX; nX--, nXN-- )
756 pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixelFromData( pScanlineSrc, nX ) );
761 for(
tools::Long nY = nSrcEndY1, nYN = nDstEndY1; nY >= nSrcY; nY--, nYN-- )
763 Scanline pScanline = pWriteAcc->GetScanline(nYN);
764 Scanline pScanlineSrc = pWriteAcc->GetScanline(nY);
765 for(
tools::Long nX = nSrcEndX1, nXN = nDstEndX1; nX >= nSrcX; nX--, nXN-- )
766 pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixelFromData( pScanlineSrc, nX ) );
788 const Size aNewSize( nWidth + nDX, nHeight + nDY );
803 const tools::Long nNewHeight = pWriteAcc->Height();
808 aColor = pWriteAcc->GetBestMatchingColor( *pInitColor );
810 for( nY = 0; nY < nHeight; nY++ )
812 pWriteAcc->CopyScanline( nY, *pReadAcc );
814 if( pInitColor && nDX )
816 Scanline pScanline = pWriteAcc->GetScanline(nY);
817 for( nX = nNewX; nX < nNewWidth; nX++ )
818 pWriteAcc->SetPixelOnData( pScanline, nX, aColor );
822 if( pInitColor && nDY )
823 for( nY = nNewY; nY < nNewHeight; nY++ )
825 Scanline pScanline = pWriteAcc->GetScanline(nY);
826 for( nX = 0; nX < nNewWidth; nX++ )
827 pWriteAcc->SetPixelOnData( pScanline, nX, aColor );
846 std::shared_ptr<SalBitmap> xImpDispBmp(
ImplGetSVData()->mpDefInst->CreateSalBitmap());
847 if (xImpDispBmp->Create(*
mxSalBmp, pDispGraphics))
870 std::shared_ptr<SalBitmap> xImpBmp(
ImplGetSVData()->mpDefInst->CreateSalBitmap());
872 if (xImpBmp->Create(*
mxSalBmp) && xImpBmp->InterpretAs8Bit())
881 std::shared_ptr<SalBitmap> xImpBmp(
ImplGetSVData()->mpDefInst->CreateSalBitmap());
882 if (xImpBmp->Create(*
mxSalBmp) && xImpBmp->ConvertToGreyscale())
894 switch( eConversion )
950 OSL_FAIL(
"Bitmap::Convert(): Unsupported conversion" );
968 bPalDiffers = ( rPal != pReadAcc->
GetPalette() );
985 Scanline pScanline = pWriteAcc->GetScanline(nY);
990 pWriteAcc->SetPixelOnData( pScanline, nX,
1003 Scanline pWriteScan = pWriteAcc->GetScanline( nY );
1011 *pWriteScan++ =
static_cast<sal_uInt8>( ( nB * 28UL + nG * 151UL + nR * 77UL ) >> nShift );
1023 Scanline pWriteScan = pWriteAcc->GetScanline( nY );
1031 *pWriteScan++ =
static_cast<sal_uInt8>( ( nB * 28UL + nG * 151UL + nR * 77UL ) >> nShift );
1039 Scanline pScanline = pWriteAcc->GetScanline(nY);
1077 if (pWriteAcc->HasPalette())
1085 for (sal_uInt16
i = 0;
i < nOldCount;
i++)
1086 aPalette[
i] = rOldPalette[
i];
1091 pWriteAcc->SetPalette(aPalette);
1095 Scanline pScanline = pWriteAcc->GetScanline(nY);
1099 pWriteAcc->SetPixelOnData(pScanline, nX, pReadAcc->
GetPixelFromData(pScanlineRead, nX));
1109 Scanline pScanline = pWriteAcc->GetScanline(nY);
1121 Scanline pScanline = pWriteAcc->GetScanline(nY);
1125 pWriteAcc->SetPixelOnData(pScanline, nX, pReadAcc->
GetPixelFromData(pScanlineRead, nX));
1157 const sal_uInt16
nCount = 1 << nNewBitCount;
1166 std::vector<ImpErrorQuad> aErrQuad1(nWidth);
1167 std::vector<ImpErrorQuad> aErrQuad2(nWidth);
1188 pWriteAcc->SetPalette(aPalette);
1192 pQLine2 = !nY ? aErrQuad1.data() : aErrQuad2.data();
1203 assert(pQLine2 || nHeight == 0);
1205 for (
tools::Long nY = 0; nY < nHeight; nY++, nYTmp++)
1209 Scanline pScanline = pWriteAcc->GetScanline(nY);
1210 pWriteAcc->SetPixelOnData(pScanline, 0,
BitmapColor(cIndex));
1213 for (nX = 1; nX < nWidth1; nX++)
1217 aErrQuad = (
ImpErrorQuad(aColor) -= pWriteAcc->GetPaletteColor(cIndex));
1222 pWriteAcc->SetPixelOnData(pScanline, nX,
BitmapColor(cIndex));
1229 pWriteAcc->SetPixelOnData(pScanline, nX,
BitmapColor(cIndex));
1235 pQLine2 = bQ1 ? aErrQuad2.data() : aErrQuad1.data();
1237 if (nYTmp < nHeight)
1240 for (nX = 0; nX < nWidth; nX++)
1282 std::shared_ptr<SalBitmap> xImpBmp(
ImplGetSVData()->mpDefInst->CreateSalBitmap());
1283 if (xImpBmp->Create(*
mxSalBmp) && xImpBmp->Scale(rScaleX, rScaleY, nScaleFlag))
1294 bool bRetval(
false);
1331 OSL_ENSURE(!bRetval || eStartPixelFormat ==
getPixelFormat(),
"Bitmap::Scale has changed the ColorDepth, this should *not* happen (!)");
1343 static_cast<double>(rNewSize.
Height()) / aSize.
Height(),
1354#if HAVE_FEATURE_SKIA
1393 SAL_WARN(
"vcl",
"Can't adapt the pixelformat as it is invalid.");
1401 *pColorArray++ =
static_cast<sal_Int32
>(rColor.
GetBlue()) << 12;
1402 *pColorArray++ =
static_cast<sal_Int32
>(rColor.
GetGreen()) << 12;
1403 *pColorArray++ =
static_cast<sal_Int32
>(rColor.
GetRed()) << 12;
1420 if( ( aSize.
Width() <= 3 ) || ( aSize.
Height() <= 2 ) )
1426 if( !pReadAcc || !pWriteAcc )
1434 std::unique_ptr<sal_Int32[]> p1(
new sal_Int32[ nW ]);
1435 std::unique_ptr<sal_Int32[]> p2(
new sal_Int32[ nW ]);
1436 sal_Int32* p1T = p1.get();
1437 sal_Int32* p2T = p2.get();
1438 sal_Int32* pTmp = p2T;
1445 for(
tools::Long nY = 1, nYAcc = 0; nY <= nHeight; nY++, nYAcc++ )
1464 Scanline pScanline = pWriteAcc->GetScanline(nYAcc);
1468 for ( nX = 3, nXAcc = 1; nX < nW2; nXAcc++ )
1500 short nChannelRPercent,
short nChannelGPercent,
short nChannelBPercent,
1501 double fGamma,
bool bInvert,
bool msoBrightness )
1506 if( !nLuminancePercent && !nContrastPercent &&
1507 !nChannelRPercent && !nChannelGPercent && !nChannelBPercent &&
1508 ( fGamma == 1.0 ) && !bInvert )
1521 std::unique_ptr<sal_uInt8[]> cMapR(
new sal_uInt8[ 256 ]);
1522 std::unique_ptr<sal_uInt8[]> cMapG(
new sal_uInt8[ 256 ]);
1523 std::unique_ptr<sal_uInt8[]> cMapB(
new sal_uInt8[ 256 ]);
1524 double fM, fROff, fGOff, fBOff, fOff;
1527 if( nContrastPercent >= 0 )
1528 fM = 128.0 / ( 128.0 - 1.27 *
MinMax( nContrastPercent, 0, 100 ) );
1530 fM = ( 128.0 + 1.27 *
MinMax( nContrastPercent, -100, 0 ) ) / 128.0;
1534 fOff =
MinMax( nLuminancePercent, -100, 100 ) * 2.55 + 128.0 - fM * 128.0;
1536 fOff =
MinMax( nLuminancePercent, -100, 100 ) * 2.55;
1539 fROff = nChannelRPercent * 2.55 + fOff;
1540 fGOff = nChannelGPercent * 2.55 + fOff;
1541 fBOff = nChannelBPercent * 2.55 + fOff;
1544 fGamma = ( fGamma <= 0.0 || fGamma > 10.0 ) ? 1.0 : ( 1.0 / fGamma );
1545 const bool bGamma = ( fGamma != 1.0 );
1561 cMapR[ nX ] =
static_cast<sal_uInt8>(
MinMax(
FRound( (nX+fROff/2-128) * fM + 128 + fROff/2 ), 0, 255 ));
1562 cMapG[ nX ] =
static_cast<sal_uInt8>(
MinMax(
FRound( (nX+fGOff/2-128) * fM + 128 + fGOff/2 ), 0, 255 ));
1563 cMapB[ nX ] =
static_cast<sal_uInt8>(
MinMax(
FRound( (nX+fBOff/2-128) * fM + 128 + fBOff/2 ), 0, 255 ));
1567 cMapR[ nX ] =
GAMMA( cMapR[ nX ], fGamma );
1568 cMapG[ nX ] =
GAMMA( cMapG[ nX ], fGamma );
1569 cMapB[ nX ] =
GAMMA( cMapB[ nX ], fGamma );
1574 cMapR[ nX ] = ~cMapR[ nX ];
1575 cMapG[ nX ] = ~cMapG[ nX ];
1576 cMapB[ nX ] = ~cMapB[ nX ];
1581 if( pAcc->HasPalette() )
1585 for( sal_uInt16
i = 0,
nCount = pAcc->GetPaletteEntryCount();
i <
nCount;
i++ )
1591 pAcc->SetPaletteColor(
i, aNewCol );
1598 Scanline pScan = pAcc->GetScanline( nY );
1602 *pScan = cMapB[ *pScan ]; pScan++;
1603 *pScan = cMapG[ *pScan ]; pScan++;
1604 *pScan = cMapR[ *pScan ]; pScan++;
1612 Scanline pScan = pAcc->GetScanline( nY );
1616 *pScan = cMapR[ *pScan ]; pScan++;
1617 *pScan = cMapG[ *pScan ]; pScan++;
1618 *pScan = cMapB[ *pScan ]; pScan++;
1626 Scanline pScanline = pAcc->GetScanline(nY);
1629 aCol = pAcc->GetPixelFromData( pScanline, nX );
1633 pAcc->SetPixelOnData( pScanline, nX, aCol );
1648inline sal_uInt8 backBlendAlpha(sal_uInt16 alpha, sal_uInt16 srcCol, sal_uInt16 startCol)
1650 const sal_uInt16 nAlpha((alpha * startCol) / 255);
1653 return static_cast<sal_uInt8>(((srcCol - nAlpha) * 255) / (255 - nAlpha));
1661 const Color& rStartColor,
1673 if(0 == nHeight || 0 == nWidth)
1679 if(pAlphaAcc->Height() != nHeight || pAlphaAcc->Width() != nWidth)
1683 const sal_uInt16 nStartColRed(rStartColor.
GetRed());
1684 const sal_uInt16 nStartColGreen(rStartColor.
GetGreen());
1685 const sal_uInt16 nStartColBlue(rStartColor.
GetBlue());
1692 const sal_uInt8 nAlpha8(pAlphaAcc->GetColor(
y,
x).GetRed());
1695 if(0 == nAlpha8 || 255 == nAlpha8)
1699 const sal_uInt16 nAlpha16(
static_cast<sal_uInt16
>(nAlpha8));
1705 aColor.
SetRed(backBlendAlpha(nAlpha16,
static_cast<sal_uInt16
>(aColor.
GetRed()), nStartColRed));
1706 aColor.
SetGreen(backBlendAlpha(nAlpha16,
static_cast<sal_uInt16
>(aColor.
GetGreen()), nStartColGreen));
1707 aColor.
SetBlue(backBlendAlpha(nAlpha16,
static_cast<sal_uInt16
>(aColor.
GetBlue()), nStartColBlue));
1710 pAcc->SetPixel(
y,
x, aColor);
1719 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()