39#define DIBCOREHEADERSIZE ( 12UL )
40#define DIBINFOHEADERSIZE ( sizeof(DIBInfoHeader) )
41#define DIBV5HEADERSIZE ( sizeof(DIBV5Header) )
80 sal_uInt32 nCompression;
81 sal_uInt32 nSizeImage;
82 sal_Int32 nXPelsPerMeter;
83 sal_Int32 nYPelsPerMeter;
85 sal_uInt32 nColsImportant;
102struct DIBV5Header :
public DIBInfoHeader
104 sal_uInt32 nV5RedMask;
105 sal_uInt32 nV5GreenMask;
106 sal_uInt32 nV5BlueMask;
107 sal_uInt32 nV5AlphaMask;
108 sal_uInt32 nV5CSType;
109 CIEXYZTriple aV5Endpoints;
110 sal_uInt32 nV5GammaRed;
111 sal_uInt32 nV5GammaGreen;
112 sal_uInt32 nV5GammaBlue;
113 sal_uInt32 nV5Intent;
114 sal_uInt32 nV5ProfileData;
115 sal_uInt32 nV5ProfileSize;
116 sal_uInt32 nV5Reserved;
145bool ImplReadDIBInfoHeader(
SvStream& rIStm, DIBV5Header& rHeader,
bool& bTopDown,
bool bMSOFormat)
150 sal_uInt64
const aStartPos(rIStm.
Tell());
158 rIStm.
ReadInt16( nTmp16 ); rHeader.nWidth = nTmp16;
159 rIStm.
ReadInt16( nTmp16 ); rHeader.nHeight = nTmp16;
167 rHeader.nWidth = nTmp16;
169 rHeader.nHeight = nTmp16;
172 rHeader.nPlanes = nTmp8;
174 rHeader.nBitCount = nTmp8;
176 rHeader.nSizeImage = nTmp16;
178 rHeader.nCompression = nTmp16;
179 if ( !rHeader.nSizeImage )
180 rHeader.nSizeImage = ((rHeader.nWidth * rHeader.nBitCount + 31) & ~31) / 8 * rHeader.nHeight;
181 rIStm.
ReadInt32( rHeader.nXPelsPerMeter );
182 rIStm.
ReadInt32( rHeader.nYPelsPerMeter );
189 std::size_t nUsed(
sizeof(rHeader.nSize));
191 auto readUInt16 = [&nUsed, &rHeader, &rIStm](sal_uInt16 &
v) {
192 if (nUsed < rHeader.nSize) {
197 auto readInt32 = [&nUsed, &rHeader, &rIStm](sal_Int32 &
v) {
198 if (nUsed < rHeader.nSize) {
203 auto readUInt32 = [&nUsed, &rHeader, &rIStm](sal_uInt32 &
v) {
204 if (nUsed < rHeader.nSize) {
211 readInt32( rHeader.nWidth );
212 readInt32( rHeader.nHeight );
213 readUInt16( rHeader.nPlanes );
214 readUInt16( rHeader.nBitCount );
215 readUInt32( rHeader.nCompression );
216 readUInt32( rHeader.nSizeImage );
217 readInt32( rHeader.nXPelsPerMeter );
218 readInt32( rHeader.nYPelsPerMeter );
219 readUInt32( rHeader.nColsUsed );
220 readUInt32( rHeader.nColsImportant );
223 readUInt32( rHeader.nV5RedMask );
224 readUInt32( rHeader.nV5GreenMask );
225 readUInt32( rHeader.nV5BlueMask );
226 readUInt32( rHeader.nV5AlphaMask );
227 readUInt32( rHeader.nV5CSType );
230 readInt32( rHeader.aV5Endpoints.aXyzRed.aXyzX );
231 readInt32( rHeader.aV5Endpoints.aXyzRed.aXyzY );
232 readInt32( rHeader.aV5Endpoints.aXyzRed.aXyzZ );
233 readInt32( rHeader.aV5Endpoints.aXyzGreen.aXyzX );
234 readInt32( rHeader.aV5Endpoints.aXyzGreen.aXyzY );
235 readInt32( rHeader.aV5Endpoints.aXyzGreen.aXyzZ );
236 readInt32( rHeader.aV5Endpoints.aXyzBlue.aXyzX );
237 readInt32( rHeader.aV5Endpoints.aXyzBlue.aXyzY );
238 readInt32( rHeader.aV5Endpoints.aXyzBlue.aXyzZ );
240 readUInt32( rHeader.nV5GammaRed );
241 readUInt32( rHeader.nV5GammaGreen );
242 readUInt32( rHeader.nV5GammaBlue );
243 readUInt32( rHeader.nV5Intent );
244 readUInt32( rHeader.nV5ProfileData );
245 readUInt32( rHeader.nV5ProfileSize );
246 readUInt32( rHeader.nV5Reserved );
249 sal_uInt32 nColorMask = 0;
259 if (!
checkSeek(rIStm, aStartPos + rHeader.nSize + nColorMask))
263 if (!rIStm.
good() || rHeader.nHeight == SAL_MIN_INT32)
266 if ( rHeader.nHeight < 0 )
269 rHeader.nHeight *= -1;
276 if ( rHeader.nWidth < 0 || rHeader.nXPelsPerMeter < 0 || rHeader.nYPelsPerMeter < 0 )
278 rIStm.
SetError( SVSTREAM_FILEFORMAT_ERROR );
282 assert(rHeader.nHeight >= 0);
283 if (rHeader.nHeight != 0 && rHeader.nWidth >= 0
284 && (rHeader.nSizeImage / 16 /
static_cast<sal_uInt32
>(rHeader.nHeight)
287 rHeader.nSizeImage = 0;
291 if (rHeader.nPlanes != 1)
294 if (rHeader.nBitCount != 0 && rHeader.nBitCount != 1 &&
295 rHeader.nBitCount != 4 && rHeader.nBitCount != 8 &&
296 rHeader.nBitCount != 16 && rHeader.nBitCount != 24 &&
297 rHeader.nBitCount != 32)
308 const sal_uLong nPalSize = nColors * ( bQuad ? 4UL : 3UL );
311 std::unique_ptr<sal_uInt8[]> pEntries(
new sal_uInt8[ nPalSize ]);
312 if (rIStm.
ReadBytes(pEntries.get(), nPalSize) != nPalSize)
318 for( sal_uInt16 i = 0;
i < nColors;
i++ )
320 aPalColor.SetBlue( *pTmpEntry++ );
321 aPalColor.SetGreen( *pTmpEntry++ );
322 aPalColor.SetRed( *pTmpEntry++ );
335 const sal_uInt16 nPaletteEntryCount = rPalette.
GetEntryCount();
336 if (nPaletteEntryCount && nIndex >= nPaletteEntryCount)
338 auto nSanitizedIndex =
nIndex % nPaletteEntryCount;
339 SAL_WARN_IF(nIndex != nSanitizedIndex,
"vcl",
"invalid colormap index: "
340 <<
static_cast<unsigned int>(nIndex) <<
", colormap len is: "
341 << nPaletteEntryCount);
350 Scanline pEndRLE = pBuffer + rHeader.nSizeImage;
357 bool bEndDecoding =
false;
363 if( ( nCountByte = *pRLE++ ) == 0 )
374 nCountByte = nRunByte >> 1;
384 rAcc.
SetPixelOnData(pScanline, nX++, SanitizePaletteIndex(cTmp >> 4, rPalette));
387 rAcc.
SetPixelOnData(pScanline, nX++, SanitizePaletteIndex(cTmp & 0x0f, rPalette));
396 rAcc.
SetPixelOnData(pScanline, nX++, SanitizePaletteIndex(*pRLE >> 4, rPalette));
401 if( ( ( nRunByte + 1 ) >> 1 ) & 1 )
417 rAcc.
SetPixelOnData(pScanline, nX++, SanitizePaletteIndex(*pRLE, rPalette));
436 else if( nRunByte == 1 )
460 nRunByte = nCountByte >> 1;
462 for (
sal_uLong i = 0;
i < nRunByte && nX < nWidth; ++
i)
464 rAcc.
SetPixelOnData(pScanline, nX++, SanitizePaletteIndex(cTmp >> 4, rPalette));
466 rAcc.
SetPixelOnData(pScanline, nX++, SanitizePaletteIndex(cTmp & 0x0f, rPalette));
469 if( ( nCountByte & 1 ) && ( nX < nWidth ) )
470 rAcc.
SetPixelOnData(pScanline, nX++, SanitizePaletteIndex(cTmp >> 4, rPalette));
474 for (
sal_uLong i = 0;
i < nCountByte && nX < nWidth; ++
i)
475 rAcc.
SetPixelOnData(pScanline, nX++, SanitizePaletteIndex(cTmp, rPalette));
479 while (!bEndDecoding && (nY >= 0));
485 bool bTopDown,
bool& rAlphaUsed,
const sal_uInt64 nAlignedWidth)
487 sal_uInt32 nRMask(( rHeader.nBitCount == 16 ) ? 0x00007c00UL : 0x00ff0000UL);
488 sal_uInt32 nGMask(( rHeader.nBitCount == 16 ) ? 0x000003e0UL : 0x0000ff00UL);
489 sal_uInt32 nBMask(( rHeader.nBitCount == 16 ) ? 0x0000001fUL : 0x000000ffUL);
491 bool bTCMask(!pAccAlpha && ((16 == rHeader.nBitCount) || (32 == rHeader.nBitCount)));
492 bool bRLE((
RLE_8 == rHeader.nCompression && 8 == rHeader.nBitCount) || (
RLE_4 == rHeader.nCompression && 4 == rHeader.nBitCount));
516 > std::numeric_limits<std::size_t>::max() / rHeader.nHeight)
520 std::size_t
n = nAlignedWidth * rHeader.nHeight;
528 if (rHeader.nV5RedMask > 0)
529 nRMask = rHeader.nV5RedMask;
530 if (rHeader.nV5GreenMask > 0)
531 nGMask = rHeader.nV5GreenMask;
532 if (rHeader.nV5BlueMask > 0)
533 nBMask = rHeader.nV5BlueMask;
543 if(!rHeader.nSizeImage)
550 std::vector<sal_uInt8>
aBuffer(rHeader.nSizeImage);
551 if (rIStm.
ReadBytes(
aBuffer.data(), rHeader.nSizeImage) != rHeader.nSizeImage)
553 if (!ImplDecodeRLE(
aBuffer.data(), rHeader, rAcc, rPalette,
RLE_4 == rHeader.nCompression))
566 std::vector<sal_uInt8>
aBuf(nAlignedWidth);
572 switch(rHeader.nBitCount)
576 for( ;
nCount--; nY += nI )
586 for(
tools::Long nX = 0, nShift = 8; nX < nWidth; nX++ )
594 auto nIndex = (cTmp >> --nShift) & 1;
595 rAcc.
SetPixelOnData(pScanline, nX, SanitizePaletteIndex(nIndex, rPalette));
603 for( ;
nCount--; nY += nI )
613 for(
tools::Long nX = 0, nShift = 2; nX < nWidth; nX++ )
621 auto nIndex = (cTmp >> ( --nShift << 2 ) ) & 0x0f;
622 rAcc.
SetPixelOnData(pScanline, nX, SanitizePaletteIndex(nIndex, rPalette));
630 for( ;
nCount--; nY += nI )
643 rAcc.
SetPixelOnData(pScanline, nX, SanitizePaletteIndex(nIndex, rPalette));
652 if (!aRedMask.CalcMaskShift())
655 if (!aGreenMask.CalcMaskShift())
658 if (!aBlueMask.CalcMaskShift())
661 ColorMask aMask(aRedMask, aGreenMask, aBlueMask);
664 for( ;
nCount--; nY += nI )
666 sal_uInt16 * pTmp16 =
reinterpret_cast<sal_uInt16*
>(
aBuf.data());
667 if (rIStm.
ReadBytes(pTmp16, nAlignedWidth)
676 aMask.GetColorFor16BitLSB( aColor,
reinterpret_cast<sal_uInt8*
>(pTmp16++) );
687 for( ;
nCount--; nY += nI )
699 aPixelColor.
SetBlue( *pTmp++ );
701 aPixelColor.
SetRed( *pTmp++ );
711 if (!aRedMask.CalcMaskShift())
714 if (!aGreenMask.CalcMaskShift())
717 if (!aBlueMask.CalcMaskShift())
719 ColorMask aMask(aRedMask, aGreenMask, aBlueMask);
728 for( ;
nCount--; nY += nI )
730 pTmp32 =
reinterpret_cast<sal_uInt32*
>(
aBuf.data());
731 if (rIStm.
ReadBytes(pTmp32, nAlignedWidth)
741 aMask.GetColorAndAlphaFor32Bit( aColor, aAlpha,
reinterpret_cast<sal_uInt8*
>(pTmp32++) );
744 rAlphaUsed |= 0xff != aAlpha;
750 for( ;
nCount--; nY += nI )
752 pTmp32 =
reinterpret_cast<sal_uInt32*
>(
aBuf.data());
753 if (rIStm.
ReadBytes(pTmp32, nAlignedWidth)
762 aMask.GetColorFor32Bit( aColor,
reinterpret_cast<sal_uInt8*
>(pTmp32++) );
778 const sal_uInt64 nStmPos = rIStm.
Tell();
779 bool bTopDown(
false);
781 if (!ImplReadDIBInfoHeader(rIStm, aHeader, bTopDown, bMSOFormat))
785 if (aHeader.nBitCount == 0)
788 if (aHeader.nWidth <= 0 || aHeader.nHeight <= 0)
793 if (nOffset && aHeader.nSize > nOffset)
800 sal_uInt16 nColors(0);
802 std::unique_ptr<SvMemoryStream> pMemStm;
803 std::vector<sal_uInt8>
aData;
805 if (aHeader.nBitCount <= 8)
807 if(aHeader.nColsUsed)
809 nColors =
static_cast<sal_uInt16
>(aHeader.nColsUsed);
813 nColors = ( 1 << aHeader.nBitCount );
819 sal_uInt32 nCodedSize(0);
820 sal_uInt32 nUncodedSize(0);
831 pMemStm->WriteStream(rIStm, nCodedSize);
834 size_t nSizeInc(4 * pMemStm->remainingSize());
835 if (nUncodedSize < nSizeInc)
836 nSizeInc = nUncodedSize;
843 aData.resize(nSizeInc);
845 while (nUncodedSize > nDataPos)
847 assert(
aData.size() > nDataPos);
848 const size_t nToRead(std::min<size_t>(nUncodedSize - nDataPos,
aData.size() - nDataPos));
850 assert(!
aData.empty());
856 if (nDataPos < nUncodedSize)
865 aData.resize(nDataPos);
867 nUncodedSize = sal_uInt32(
aData.size());
881 pIStm = pMemStm.get();
882 assert(!
aData.empty());
883 pMemStm->SetBuffer(
aData.data(), nUncodedSize, nUncodedSize);
908 sal_Int32 nSeekRel = nOffset - (pIStm->
Tell() - nStmPos);
913 const sal_Int64 nBitsPerLine (
static_cast<sal_Int64
>(aHeader.nWidth) *
static_cast<sal_Int64
>(aHeader.nBitCount));
914 if (nBitsPerLine > SAL_MAX_UINT32)
918 switch (aHeader.nCompression)
922 if (aHeader.nBitCount != 8)
927 nMaxWidth /= aHeader.nHeight;
934 if (aHeader.nBitCount != 4)
938 nMaxWidth /= aHeader.nHeight;
945 if (aHeader.nCompression & 0x000F)
949 SAL_WARN(
"vcl",
"bad bmp compression scheme: " << aHeader.nCompression <<
", rejecting bmp");
953 SAL_WARN(
"vcl",
"bad bmp compression scheme: " << aHeader.nCompression <<
", assuming meant to be COMPRESS_NONE");
961 nMaxWidth /= aHeader.nHeight;
962 if (nMaxWidth < nAlignedWidth)
968 const Size aSizePixel(aHeader.nWidth, aHeader.nHeight);
971 bool bAlphaPossible(pBmpAlpha && aHeader.nBitCount == 32);
975 const bool bRedSet(0 != aHeader.nV5RedMask);
976 const bool bGreenSet(0 != aHeader.nV5GreenMask);
977 const bool bBlueSet(0 != aHeader.nV5BlueMask);
983 if((bRedSet || bGreenSet || bBlueSet) && (0 == aHeader.nV5AlphaMask))
985 bAlphaPossible =
false;
1000 Bitmap aNewBmp(aSizePixel, ePixelFormat, pPal);
1004 if (pAcc->Width() != aHeader.nWidth || pAcc->Height() != aHeader.nHeight)
1010 bool bAlphaUsed(
false);
1011 bool bRet = ImplReadDIBBits(*pIStm, aHeader, *pAcc, aPalette, pAccAlpha.
get(), bTopDown, bAlphaUsed, nAlignedWidth);
1013 if (bRet && aHeader.nXPelsPerMeter && aHeader.nYPelsPerMeter)
1018 Fraction(1000, aHeader.nXPelsPerMeter),
1019 Fraction(1000, aHeader.nYPelsPerMeter));
1021 aNewBmp.SetPrefMapMode(aMapMode);
1022 aNewBmp.SetPrefSize(
Size(aHeader.nWidth, aHeader.nHeight));
1033 bAlphaPossible =
false;
1043 *pBmpAlpha = aNewBmpAlpha;
1054 const sal_uInt64 nStreamLength = rIStm.
TellEnd();
1056 sal_uInt16 nTmp16 = 0;
1059 if ( ( 0x4D42 == nTmp16 ) || ( 0x4142 == nTmp16 ) )
1061 sal_uInt32 nTmp32(0);
1062 if ( 0x4142 == nTmp16 )
1068 rOffset = nTmp32 - 28;
1069 bRet = ( 0x4D42 == nTmp16 );
1075 rOffset = nTmp32 - 14;
1079 if ( rOffset >= nStreamLength )
1083 rIStm.
SetError( SVSTREAM_FILEFORMAT_ERROR );
1088 rIStm.
SetError( SVSTREAM_FILEFORMAT_ERROR );
1096 const sal_uLong nPalSize = nColors * 4UL;
1097 std::unique_ptr<sal_uInt8[]> pEntries(
new sal_uInt8[ nPalSize ]);
1100 for( sal_uInt16 i = 0;
i < nColors;
i++ )
1104 *pTmpEntry++ = rPalColor.
GetBlue();
1105 *pTmpEntry++ = rPalColor.
GetGreen();
1106 *pTmpEntry++ = rPalColor.
GetRed();
1110 rOStm.
WriteBytes( pEntries.get(), nPalSize );
1123 std::vector<sal_uInt8>
aBuf(( nWidth << 1 ) + 2);
1128 for (
tools::Long nY = nHeight - 1; nY >= 0; nY-- )
1134 while( nX < nWidth )
1139 while( ( nX < nWidth ) && ( nCount < 255 )
1149 *pTmp++ = ( bRLE4 ? ( ( cPix << 4 ) | cPix ) : cPix );
1155 nSaveIndex = nX - 1;
1158 while( ( nX < nWidth ) && ( nCount < 256 ) )
1197 nBufCount += (
nCount + 3 );
1200 nBufCount += (
nCount + 2 );
1205 *pTmp++ = rAcc.
GetIndexFromData( pScanline, nSaveIndex ) << (bRLE4 ? 4 : 0);
1210 *pTmp++ = rAcc.
GetIndexFromData( pScanline, ++nSaveIndex ) << ( bRLE4 ? 4 : 0 );
1219 aBuf[ nBufCount++ ] = 0;
1220 aBuf[ nBufCount++ ] = 0;
1238 UInt32ToSVBT32( rMask.
GetRedMask(), aVal32 );
1247 rImageSize = rOStm.
Tell();
1257 else if((
RLE_4 == nCompression) || (
RLE_8 == nCompression))
1259 rImageSize = rOStm.
Tell();
1260 ImplWriteRLE( rOStm, rAcc,
RLE_4 == nCompression );
1262 else if(!nCompression)
1272 const auto ePixelFormat(convertToBPP(rAcc.
GetBitCount()));
1274 bool bNative(
false);
1296 rImageSize = rOStm.
Tell();
1306 std::vector<sal_uInt8>
aBuf(nAlignedWidth);
1307 switch(ePixelFormat)
1311 for(
tools::Long nY = nHeight - 1; nY >= 0; nY-- )
1327 size_t nUnusedBytes = nAlignedWidth - nWidth * 3;
1328 memset(
aBuf.data() + nAlignedWidth - nUnusedBytes, 0, nUnusedBytes);
1336 for(
tools::Long nY = nHeight - 1; nY >= 0; nY-- )
1344 aPixelColor = rAcc.
GetColor( nY, nX );
1346 *pTmp++ = aPixelColor.
GetBlue();
1348 *pTmp++ = aPixelColor.
GetRed();
1359 rImageSize = rOStm.
Tell() - rImageSize;
1366 const MapMode aMapPixel(MapUnit::MapPixel);
1367 DIBV5Header aHeader;
1368 sal_uInt64 nImageSizePos(0);
1369 sal_uInt64 nEndPos(0);
1374 aHeader.nWidth = rAcc.
Width();
1375 aHeader.nHeight = rAcc.
Height();
1376 aHeader.nPlanes = 1;
1380 aHeader.nBitCount = 32;
1395 const auto ePixelFormat(convertToBPP(rAcc.
GetBitCount()));
1396 aHeader.nBitCount = sal_uInt16(ePixelFormat);
1402 nCompression =
RLE_8;
1412 aHeader.nCompression = nCompression;
1424 const double fBmpWidthM(
static_cast<double>(rBitmap.
GetPrefSize().
Width()) / aScale100000.Width());
1425 const double fBmpHeightM(
static_cast<double>(rBitmap.
GetPrefSize().
Height()) / aScale100000.Height());
1435 aHeader.nColsImportant = 0;
1444 nImageSizePos = rOStm.
Tell();
1445 rOStm.
SeekRel(
sizeof( aHeader.nSizeImage ) );
1456 sal_uInt64 nCodedPos(rOStm.
Tell());
1457 sal_uInt64 nLastPos(0);
1458 sal_uInt32 nCodedSize(0);
1459 sal_uInt32 nUncodedSize(0);
1462 if(aHeader.nColsUsed)
1464 ImplWriteDIBPalette(aMemStm, rAcc);
1468 bRet = ImplWriteDIBBits(aMemStm, rAcc, nCompression, aHeader.nSizeImage);
1471 nUncodedSize = aMemStm.Tell();
1478 aCodec.
Write(rOStm,
static_cast<sal_uInt8 const *
>(aMemStm.GetData()), nUncodedSize);
1482 nLastPos = rOStm.
Tell();
1483 nCodedSize = nLastPos - nCodedPos - 12;
1484 rOStm.
Seek(nCodedPos);
1486 rOStm.
Seek(nLastPos);
1495 if(aHeader.nColsUsed)
1497 ImplWriteDIBPalette(rOStm, rAcc);
1500 bRet = ImplWriteDIBBits(rOStm, rAcc, aHeader.nCompression, aHeader.nSizeImage);
1503 nEndPos = rOStm.
Tell();
1504 rOStm.
Seek(nImageSizePos);
1506 rOStm.
Seek(nEndPos);
1530 bool bMSOFormat=
false)
1533 const auto nOldPos(rIStm.
Tell());
1537 rIStm.
SetEndian(SvStreamEndian::LITTLE);
1541 if(ImplReadDIBFileHeader(rIStm, nOffset))
1543 bRet = ImplReadDIBBody(rIStm, rTarget, nOffset >=
DIBV5HEADERSIZE ? pTargetAlpha :
nullptr, nOffset, bMSOFormat);
1548 bRet = ImplReadDIBBody(rIStm, rTarget,
nullptr, nOffset, bMSOFormat);
1555 rIStm.
SetError(SVSTREAM_GENERALERROR);
1558 rIStm.
Seek(nOldPos);
1575 if(!aSizePix.Width() || !aSizePix.Height())
1580 const sal_uInt64 nOldPos(rOStm.
Tell());
1582 rOStm.
SetEndian(SvStreamEndian::LITTLE);
1588 if(ImplWriteDIBFileHeader(rOStm, *pAcc))
1590 bRet = ImplWriteDIBBody(rSource, rOStm, *pAcc, bCompressed);
1595 bRet = ImplWriteDIBBody(rSource, rOStm, *pAcc, bCompressed);
1603 rOStm.
SetError(SVSTREAM_GENERALERROR);
1604 rOStm.
Seek(nOldPos);
1620 return ImplReadDIB(
rTarget,
nullptr, rIStm, bFileHeader, bMSOFormat);
1630 bool bRetval(ImplReadDIB(aBmp,
nullptr, rIStm, bFileHeader, bMSOFormat) && !rIStm.
GetError());
1635 const sal_uInt64 nStmPos(rIStm.
Tell());
1636 sal_uInt32 nMagic1(0);
1637 sal_uInt32 nMagic2(0);
1642 bRetval = (0x25091962 == nMagic1) && (0xACB20201 == nMagic2) && !rIStm.
GetError();
1658 bRetval = ImplReadDIB(aMask,
nullptr, rIStm,
true);
1660 if(bRetval && !aMask.
IsEmpty())
1667 Color aTransparentColor;
1670 aSerializer.
readColor(aTransparentColor);
1672 bRetval = rIStm.
good();
1689 rIStm.
Seek(nStmPos);
1702 bool rv = ImplReadDIB(
rTarget, &rTargetAlpha, rIStm,
true);
1711 const unsigned char* pBuf,
1717 for (
int nRow = 0; nRow < nHeight; ++nRow)
1719 pWriteAccess->CopyScanline(nRow, pBuf + (nStride * nRow), nFormat, nStride);
1731 return ImplWriteDIB(rSource, rOStm, bCompressed, bFileHeader);
1739 return ImplWriteDIB(rSource.
GetBitmap(), rOStm, bCompressed,
true);
1746 if(ImplWriteDIB(rSource.
GetBitmap(), rOStm,
true,
true))
1757 return ImplWriteDIB(tmpAlpha, rOStm,
true,
true);
vcl::ScopedBitmapAccess< BitmapWriteAccess, AlphaMask, &AlphaMask::AcquireAlphaWriteAccess > AlphaScopedWriteAccess
Bitmap GetBitmap(Color aTransparentReplaceColor) const
tools::Long Height() const
tools::Long Width() const
ScanlineFormat GetScanlineFormat() const
sal_uInt16 GetPaletteEntryCount() const
sal_uInt16 GetBitCount() const
const ColorMask & GetColorMask() const
const BitmapColor & GetPaletteColor(sal_uInt16 nColor) const
sal_uInt32 GetScanlineSize() const
sal_uInt16 GetEntryCount() const
void SetEntryCount(sal_uInt16 nCount)
Scanline GetBuffer() const
BitmapColor GetColor(tools::Long nY, tools::Long nX) const
void SetPixelOnData(sal_uInt8 *pData, tools::Long nX, const BitmapColor &rBitmapColor)
sal_uInt8 GetIndexFromData(const sal_uInt8 *pData, tools::Long nX) const
Scanline GetScanline(tools::Long nY) const
const MapMode & GetPrefMapMode() const
Size GetSizePixel() const
bool Invert()
Perform the Invert operation on every pixel.
const Size & GetPrefSize() const
sal_uInt32 GetRedMask() const
sal_uInt32 GetGreenMask() const
sal_uInt32 GetBlueMask() const
sal_uInt8 GetBlue() const
void SetGreen(sal_uInt8 nGreen)
void SetRed(sal_uInt8 nRed)
sal_uInt8 GetGreen() const
void SetBlue(sal_uInt8 nBlue)
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
virtual void ResetError()
SvStream & WriteInt32(sal_Int32 nInt32)
void SetEndian(SvStreamEndian SvStreamEndian)
virtual sal_uInt64 TellEnd()
SvStream & ReadInt16(sal_Int16 &rInt16)
SvStreamCompressFlags GetCompressMode() const
std::size_t WriteBytes(const void *pData, std::size_t nSize)
SvStream & WriteUChar(unsigned char nChar)
SvStream & WriteUInt16(sal_uInt16 nUInt16)
sal_Int32 GetVersion() const
SvStream & WriteUInt32(sal_uInt32 nUInt32)
SvStream & ReadUInt32(sal_uInt32 &rUInt32)
SvStreamEndian GetEndian() const
void SetError(ErrCode nErrorCode)
sal_uInt64 Seek(sal_uInt64 nPos)
SvStream & ReadInt32(sal_Int32 &rInt32)
std::size_t ReadBytes(void *pData, std::size_t nSize)
sal_uInt64 SeekRel(sal_Int64 nPos)
SvStream & ReadUInt16(sal_uInt16 &rUInt16)
sal_uInt64 remainingSize()
SvStream & ReadUChar(unsigned char &rChar)
tools::Long Read(SvStream &rIStm, sal_uInt8 *pData, sal_uInt32 nSize)
tools::Long EndCompression()
void BeginCompression(int nCompressLevel=ZCODEC_DEFAULT_COMPRESSION, bool gzLib=false)
void Write(SvStream &rOStm, const sal_uInt8 *pData, sal_uInt32 nSize)
This template handles BitmapAccess the RAII way.
sal_uInt32 AlignedWidth4Bytes(sal_uInt32 nWidthBits)
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
constexpr OUStringLiteral aData
B2IRange fround(const B2DRange &rRange)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
std::enable_if< std::is_signed< T >::value, bool >::type checked_multiply(T a, T b, T &result)
PixelFormat
Pixel format of the bitmap in bits per pixel.
TOOLS_DLLPUBLIC bool checkSeek(SvStream &rSt, sal_uInt64 nOffset)
std::unique_ptr< char[]> aBuffer