add PixelFormat enum that replaces bit count in Bitmap/BitmapEx
Bit count for the image is a numeric value (sal_uInt16) but only a handful of values make sense - namely 1,4,8,24 and 32. This replaces the numeric value with an enum, which only accepts those values and checks the correct values are used at compile time. Change-Id: I0fc137c62bce3b0d021f05019a1648da628521bc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112408 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
This commit is contained in:
committed by
Tomaž Vajngerl
parent
a73f24f47a
commit
68bc6a5dd6
@@ -147,7 +147,7 @@ uno::Reference< graphic::XGraphic > SAL_CALL FrameGrabber::grabFrame( double fMe
|
||||
pData = aMapInfo.data;
|
||||
|
||||
int nStride = GST_ROUND_UP_4( nWidth * 3 );
|
||||
BitmapEx aBmp = vcl::bitmap::CreateFromData(pData, nWidth, nHeight, nStride, 24 );
|
||||
BitmapEx aBmp = vcl::bitmap::CreateFromData(pData, nWidth, nHeight, nStride, vcl::PixelFormat::N24_BPP);
|
||||
|
||||
gst_buffer_unmap( pBuf, &aMapInfo );
|
||||
xRet = Graphic( aBmp ).GetXGraphic();
|
||||
|
||||
@@ -39,10 +39,7 @@ namespace vclcanvas
|
||||
{
|
||||
// create bitmap for given reference device
|
||||
// ========================================
|
||||
const sal_uInt16 nBitCount( sal_uInt16(24U) );
|
||||
const BitmapPalette* pPalette = nullptr;
|
||||
|
||||
Bitmap aBitmap( rSize, nBitCount, pPalette );
|
||||
Bitmap aBitmap(rSize, vcl::PixelFormat::N24_BPP);
|
||||
|
||||
// only create alpha channel bitmap, if factory requested
|
||||
// that. Providing alpha-channeled bitmaps by default has,
|
||||
|
||||
@@ -208,7 +208,7 @@ namespace
|
||||
|
||||
Bitmap aMask( rBitmap.CreateMask( aWhite ));
|
||||
Bitmap aSolid( rBitmap.GetSizePixel(),
|
||||
1,
|
||||
vcl::PixelFormat::N1_BPP,
|
||||
&aBiLevelPalette );
|
||||
aSolid.Erase( rMaskColor );
|
||||
|
||||
|
||||
@@ -676,7 +676,7 @@ namespace wmfemfhelper
|
||||
aBiLevelPalette[1] = rMaskColor;
|
||||
|
||||
Bitmap aMask(rBitmap.CreateMask(aWhite));
|
||||
Bitmap aSolid(rBitmap.GetSizePixel(), 1, &aBiLevelPalette);
|
||||
Bitmap aSolid(rBitmap.GetSizePixel(), vcl::PixelFormat::N1_BPP, &aBiLevelPalette);
|
||||
|
||||
aSolid.Erase(rMaskColor);
|
||||
|
||||
|
||||
@@ -376,7 +376,7 @@ void ImageProducer::ImplUpdateConsumer( const Graphic& rGraphic )
|
||||
|
||||
if( !pMskAcc )
|
||||
{
|
||||
aMask = Bitmap( aBmp.GetSizePixel(), 1 );
|
||||
aMask = Bitmap(aBmp.GetSizePixel(), vcl::PixelFormat::N1_BPP);
|
||||
aMask.Erase( COL_BLACK );
|
||||
pMskAcc = aMask.AcquireReadAccess();
|
||||
}
|
||||
|
||||
@@ -44,9 +44,9 @@ void loadFromSvg(SvStream& rStream, const OUString& sPath, BitmapEx& rBitmapEx,
|
||||
@param pData
|
||||
The block of data to copy
|
||||
@param nStride
|
||||
The number of bytes in a scanline, must be >= (width * nBitCount / 8)
|
||||
The number of bytes in a scanline, must be >= (width * bitcount / 8)
|
||||
*/
|
||||
BitmapEx VCL_DLLPUBLIC CreateFromData( sal_uInt8 const *pData, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int32 nStride, sal_uInt16 nBitCount );
|
||||
BitmapEx VCL_DLLPUBLIC CreateFromData( sal_uInt8 const *pData, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int32 nStride, vcl::PixelFormat ePixelFormat);
|
||||
|
||||
BitmapEx VCL_DLLPUBLIC CreateFromData( RawBitmap && data );
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <vcl/mapmod.hxx>
|
||||
#include <vcl/region.hxx>
|
||||
#include <vcl/scopedbitmapaccess.hxx>
|
||||
#include <vcl/bitmap/BitmapTypes.hxx>
|
||||
|
||||
#include <o3tl/typed_flags_set.hxx>
|
||||
|
||||
@@ -114,7 +115,7 @@ public:
|
||||
|
||||
Bitmap();
|
||||
Bitmap( const Bitmap& rBitmap );
|
||||
Bitmap( const Size& rSizePixel, sal_uInt16 nBitCount, const BitmapPalette* pPal = nullptr );
|
||||
Bitmap( const Size& rSizePixel, vcl::PixelFormat ePixelFormat, const BitmapPalette* pPal = nullptr );
|
||||
explicit Bitmap( std::shared_ptr<SalBitmap> const & xSalBitmap );
|
||||
virtual ~Bitmap();
|
||||
|
||||
@@ -135,6 +136,7 @@ public:
|
||||
|
||||
Size GetSizePixel() const;
|
||||
|
||||
vcl::PixelFormat getPixelFormat() const;
|
||||
sal_uInt16 GetBitCount() const;
|
||||
inline sal_Int64 GetColorCount() const;
|
||||
inline sal_uLong GetSizeBytes() const;
|
||||
@@ -538,8 +540,8 @@ public:
|
||||
typedef vcl::ScopedBitmapAccess<BitmapInfoAccess, Bitmap, &Bitmap::AcquireInfoAccess> ScopedInfoAccess;
|
||||
|
||||
private:
|
||||
SAL_DLLPRIVATE bool ImplConvertUp(sal_uInt16 nBitCount, Color const* pExtColor = nullptr);
|
||||
SAL_DLLPRIVATE bool ImplConvertDown(sal_uInt16 nBitCount, Color const* pExtColor = nullptr);
|
||||
SAL_DLLPRIVATE bool ImplConvertUp(vcl::PixelFormat ePixelFormat, Color const* pExtColor = nullptr);
|
||||
SAL_DLLPRIVATE bool ImplConvertDown(vcl::PixelFormat ePixelFormat, Color const* pExtColor = nullptr);
|
||||
|
||||
private:
|
||||
std::shared_ptr<SalBitmap> mxSalBmp;
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace vcl
|
||||
{
|
||||
/** Pixel format of the bitmap in bits per pixel */
|
||||
enum class PixelFormat
|
||||
{
|
||||
INVALID = 0,
|
||||
N1_BPP = 1,
|
||||
N4_BPP = 4,
|
||||
N8_BPP = 8,
|
||||
N24_BPP = 24,
|
||||
N32_BPP = 32
|
||||
};
|
||||
|
||||
/** Is it a pixel format that forces creation of a palette */
|
||||
constexpr bool isPalettePixelFormat(PixelFormat ePixelFormat)
|
||||
{
|
||||
assert(ePixelFormat != PixelFormat::INVALID);
|
||||
return sal_uInt16(ePixelFormat) <= 8;
|
||||
}
|
||||
|
||||
constexpr PixelFormat bitDepthToPixelFormat(sal_uInt16 nBitDepth)
|
||||
{
|
||||
switch (nBitDepth)
|
||||
{
|
||||
case 1:
|
||||
return PixelFormat::N1_BPP;
|
||||
case 4:
|
||||
return PixelFormat::N4_BPP;
|
||||
case 8:
|
||||
return PixelFormat::N8_BPP;
|
||||
case 24:
|
||||
return PixelFormat::N24_BPP;
|
||||
case 32:
|
||||
return PixelFormat::N32_BPP;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return PixelFormat::INVALID;
|
||||
}
|
||||
|
||||
} // end namespace vcl
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
explicit BitmapEx( const OUString& rIconName );
|
||||
BitmapEx( const BitmapEx& rBitmapEx );
|
||||
BitmapEx( const BitmapEx& rBitmapEx, Point aSrc, Size aSize );
|
||||
BitmapEx( Size aSize, sal_uInt16 nBitCount );
|
||||
BitmapEx(Size aSize, vcl::PixelFormat ePixelFormat);
|
||||
explicit BitmapEx( const Bitmap& rBmp );
|
||||
BitmapEx( const Bitmap& rBmp, const Bitmap& rMask );
|
||||
BitmapEx( const Bitmap& rBmp, const AlphaMask& rAlphaMask );
|
||||
@@ -90,7 +90,16 @@ public:
|
||||
const MapMode& GetPrefMapMode() const { return maBitmap.GetPrefMapMode(); }
|
||||
void SetPrefMapMode( const MapMode& rPrefMapMode ) { maBitmap.SetPrefMapMode( rPrefMapMode ); }
|
||||
|
||||
sal_uInt16 GetBitCount() const { return maBitmap.GetBitCount(); }
|
||||
sal_uInt16 GetBitCount() const
|
||||
{
|
||||
return maBitmap.GetBitCount();
|
||||
}
|
||||
|
||||
vcl::PixelFormat getPixelFormat() const
|
||||
{
|
||||
return maBitmap.getPixelFormat();
|
||||
}
|
||||
|
||||
sal_uLong GetSizeBytes() const;
|
||||
BitmapChecksum GetChecksum() const;
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ std::unique_ptr<XFBGImage> LwpBackgroundStuff::GetFillPattern()
|
||||
GetPattern(m_nID, aPttnArray);
|
||||
|
||||
// create bitmap object from the pattern array
|
||||
BitmapEx aBmp = vcl::bitmap::CreateFromData(aPttnArray, 8, 8, 1, 1);
|
||||
BitmapEx aBmp = vcl::bitmap::CreateFromData(aPttnArray, 8, 8, 1, vcl::PixelFormat::N1_BPP);
|
||||
|
||||
// create XOBitmap object from bitmap object
|
||||
XOBitmap aXOBitmap(aBmp);
|
||||
|
||||
@@ -2503,7 +2503,7 @@ void DrawingML::WriteParagraphNumbering(const Reference< XPropertySet >& rXPropS
|
||||
BitmapEx aSourceBitmap(aGraphic.GetBitmapEx());
|
||||
aSourceBitmap.Scale(aDestRect.GetSize());
|
||||
tools::Rectangle aSourceRect(Point(0, 0), aDestRect.GetSize());
|
||||
BitmapEx aDestBitmap(Bitmap(aDestSize, 24), aMask);
|
||||
BitmapEx aDestBitmap(Bitmap(aDestSize, vcl::PixelFormat::N24_BPP), aMask);
|
||||
aDestBitmap.CopyPixel(aDestRect, aSourceRect, &aSourceBitmap);
|
||||
Graphic aDestGraphic(aDestBitmap);
|
||||
sRelationId = WriteImage(aDestGraphic);
|
||||
|
||||
@@ -167,7 +167,7 @@ void SdDrawDocument::CreateLayoutTemplates()
|
||||
rISet.Put( XFillGradientItem( aNullGrad) );
|
||||
rISet.Put(XFillHatchItem(aNullHatch));
|
||||
Size aNullSize( 32, 32 );
|
||||
Bitmap aNullBmp( aNullSize, 8 );
|
||||
Bitmap aNullBmp(aNullSize, vcl::PixelFormat::N8_BPP);
|
||||
aNullBmp.Erase( COL_WHITE );
|
||||
rISet.Put(XFillBitmapItem(Graphic(BitmapEx(aNullBmp))));
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ RecentDocsViewItem::RecentDocsViewItem(sfx2::RecentDocsView &rView, const OUStri
|
||||
|
||||
// create empty, and copy the default thumbnail in
|
||||
sal_uInt8 nAlpha = 255;
|
||||
aThumbnail = BitmapEx(Bitmap(aThumbnailSize, 24), AlphaMask(aThumbnailSize, &nAlpha));
|
||||
aThumbnail = BitmapEx(Bitmap(aThumbnailSize, vcl::PixelFormat::N24_BPP), AlphaMask(aThumbnailSize, &nAlpha));
|
||||
|
||||
aThumbnail.CopyPixel(
|
||||
::tools::Rectangle(Point((aThumbnailSize.Width() - aExtSize.Width()) / 2, (aThumbnailSize.Height() - aExtSize.Height()) / 2), aExtSize),
|
||||
|
||||
@@ -45,7 +45,7 @@ CPPUNIT_TEST_FIXTURE(XTableImportExportTest, testImportExport)
|
||||
uno::Reference<container::XNameContainer> xNameContainer(xBitmapList->createInstance());
|
||||
CPPUNIT_ASSERT(xNameContainer.is());
|
||||
|
||||
Bitmap aBitmap(Size(5, 5), 24);
|
||||
Bitmap aBitmap(Size(5, 5), vcl::PixelFormat::N24_BPP);
|
||||
aBitmap.Erase(COL_RED);
|
||||
BitmapEx aBitmapEx(aBitmap);
|
||||
Graphic aGraphic(aBitmapEx);
|
||||
|
||||
@@ -304,7 +304,7 @@ SgaObjectSound::SgaObjectSound( const INetURLObject& rURL ) :
|
||||
if( FileExists( rURL ) )
|
||||
{
|
||||
aURL = rURL;
|
||||
aThumbBmp = Bitmap( Size( 1, 1 ), 1 );
|
||||
aThumbBmp = Bitmap(Size(1, 1), vcl::PixelFormat::N1_BPP);
|
||||
bIsValid = true;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace drawinglayer::primitive2d
|
||||
r, g, b, 0, r, g, b, 0, r, g, b, 0,
|
||||
0, 0, 0, a, r, g, b, 0, 0, 0, 0, a
|
||||
};
|
||||
BitmapEx aBitmap = vcl::bitmap::CreateFromData(cross, 3, 3, 12, 32);
|
||||
BitmapEx aBitmap = vcl::bitmap::CreateFromData(cross, 3, 3, 12, vcl::PixelFormat::N32_BPP);
|
||||
|
||||
// create and exchange at aRetVal
|
||||
aRetVal.set(std::make_unique<BitmapEx>(aBitmap));
|
||||
|
||||
@@ -895,7 +895,7 @@ std::unique_ptr<sdr::overlay::OverlayObject> SdrHdl::CreateOverlayObject(
|
||||
// so that the hit test works for this case.
|
||||
if (aBmpEx.IsEmpty())
|
||||
{
|
||||
aBmpEx = BitmapEx(Size(13, 13), 24);
|
||||
aBmpEx = BitmapEx(Size(13, 13), vcl::PixelFormat::N24_BPP);
|
||||
aBmpEx.Erase(COL_BLACK);
|
||||
}
|
||||
|
||||
|
||||
@@ -882,7 +882,7 @@ void ImpSdrPdfImport::ImportImage(std::unique_ptr<vcl::pdf::PDFiumPageObject> co
|
||||
const int nWidth = bitmap->getWidth();
|
||||
const int nHeight = bitmap->getHeight();
|
||||
const int nStride = bitmap->getStride();
|
||||
BitmapEx aBitmap(Size(nWidth, nHeight), 24);
|
||||
BitmapEx aBitmap(Size(nWidth, nHeight), vcl::PixelFormat::N24_BPP);
|
||||
|
||||
switch (format)
|
||||
{
|
||||
|
||||
@@ -5909,42 +5909,42 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext *pOut, const Point& aPoin
|
||||
aShadowColor = SwViewOption::GetShadowColor();
|
||||
|
||||
AlphaMask aMask( shadowMask.getBottomRight().GetBitmap() );
|
||||
Bitmap aFilledSquare( aMask.GetSizePixel(), 24 );
|
||||
Bitmap aFilledSquare(aMask.GetSizePixel(), vcl::PixelFormat::N24_BPP);
|
||||
aFilledSquare.Erase( aShadowColor );
|
||||
aPageBottomRightShadow = BitmapEx( aFilledSquare, aMask );
|
||||
|
||||
aMask = AlphaMask( shadowMask.getBottomLeft().GetBitmap() );
|
||||
aFilledSquare = Bitmap( aMask.GetSizePixel(), 24 );
|
||||
aFilledSquare = Bitmap(aMask.GetSizePixel(), vcl::PixelFormat::N24_BPP);
|
||||
aFilledSquare.Erase( aShadowColor );
|
||||
aPageBottomLeftShadow = BitmapEx( aFilledSquare, aMask );
|
||||
|
||||
aMask = AlphaMask( shadowMask.getBottom().GetBitmap() );
|
||||
aFilledSquare = Bitmap( aMask.GetSizePixel(), 24 );
|
||||
aFilledSquare = Bitmap(aMask.GetSizePixel(), vcl::PixelFormat::N24_BPP);
|
||||
aFilledSquare.Erase( aShadowColor );
|
||||
aPageBottomShadow = BitmapEx( aFilledSquare, aMask );
|
||||
|
||||
aMask = AlphaMask( shadowMask.getTop().GetBitmap() );
|
||||
aFilledSquare = Bitmap( aMask.GetSizePixel(), 24 );
|
||||
aFilledSquare = Bitmap(aMask.GetSizePixel(), vcl::PixelFormat::N24_BPP);
|
||||
aFilledSquare.Erase( aShadowColor );
|
||||
aPageTopShadow = BitmapEx( aFilledSquare, aMask );
|
||||
|
||||
aMask = AlphaMask( shadowMask.getTopRight().GetBitmap() );
|
||||
aFilledSquare = Bitmap( aMask.GetSizePixel(), 24 );
|
||||
aFilledSquare = Bitmap(aMask.GetSizePixel(), vcl::PixelFormat::N24_BPP);
|
||||
aFilledSquare.Erase( aShadowColor );
|
||||
aPageTopRightShadow = BitmapEx( aFilledSquare, aMask );
|
||||
|
||||
aMask = AlphaMask( shadowMask.getRight().GetBitmap() );
|
||||
aFilledSquare = Bitmap( aMask.GetSizePixel(), 24 );
|
||||
aFilledSquare = Bitmap(aMask.GetSizePixel(), vcl::PixelFormat::N24_BPP);
|
||||
aFilledSquare.Erase( aShadowColor );
|
||||
aPageRightShadow = BitmapEx( aFilledSquare, aMask );
|
||||
|
||||
aMask = AlphaMask( shadowMask.getTopLeft().GetBitmap() );
|
||||
aFilledSquare = Bitmap( aMask.GetSizePixel(), 24 );
|
||||
aFilledSquare = Bitmap(aMask.GetSizePixel(), vcl::PixelFormat::N24_BPP);
|
||||
aFilledSquare.Erase( aShadowColor );
|
||||
aPageTopLeftShadow = BitmapEx( aFilledSquare, aMask );
|
||||
|
||||
aMask = AlphaMask( shadowMask.getLeft().GetBitmap() );
|
||||
aFilledSquare = Bitmap( aMask.GetSizePixel(), 24 );
|
||||
aFilledSquare = Bitmap(aMask.GetSizePixel(), vcl::PixelFormat::N24_BPP);
|
||||
aFilledSquare.Erase( aShadowColor );
|
||||
aPageLeftShadow = BitmapEx( aFilledSquare, aMask );
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace vcl::test {
|
||||
Bitmap OutputDeviceTestBitmap::setupDrawTransformedBitmap()
|
||||
{
|
||||
Size aBitmapSize(9, 9);
|
||||
Bitmap aBitmap(aBitmapSize, 24);
|
||||
Bitmap aBitmap(aBitmapSize, vcl::PixelFormat::N24_BPP);
|
||||
{
|
||||
BitmapScopedWriteAccess aWriteAccess(aBitmap);
|
||||
aWriteAccess->Erase(constFillColor);
|
||||
@@ -43,7 +43,7 @@ Bitmap OutputDeviceTestBitmap::setupDrawTransformedBitmap()
|
||||
Bitmap OutputDeviceTestBitmap::setupDrawBitmap()
|
||||
{
|
||||
Size aBitmapSize(9, 9);
|
||||
Bitmap aBitmap(aBitmapSize, 24);
|
||||
Bitmap aBitmap(aBitmapSize, vcl::PixelFormat::N24_BPP);
|
||||
{
|
||||
BitmapScopedWriteAccess aWriteAccess(aBitmap);
|
||||
aWriteAccess->Erase(constFillColor);
|
||||
@@ -65,7 +65,7 @@ Bitmap OutputDeviceTestBitmap::setupDrawBitmap()
|
||||
Bitmap OutputDeviceTestBitmap::setupDrawBitmapExWithAlpha()
|
||||
{
|
||||
Size aBitmapSize(9, 9);
|
||||
Bitmap aBitmap(aBitmapSize, 24);
|
||||
Bitmap aBitmap(aBitmapSize, vcl::PixelFormat::N24_BPP);
|
||||
{
|
||||
BitmapScopedWriteAccess aWriteAccess(aBitmap);
|
||||
aWriteAccess->Erase(COL_WHITE);
|
||||
@@ -95,7 +95,7 @@ Bitmap OutputDeviceTestBitmap::setupDrawBitmapExWithAlpha()
|
||||
Bitmap OutputDeviceTestBitmap::setupDrawMask()
|
||||
{
|
||||
Size aBitmapSize(9, 9);
|
||||
Bitmap aBitmap(aBitmapSize, 24);
|
||||
Bitmap aBitmap(aBitmapSize, vcl::PixelFormat::N24_BPP);
|
||||
{
|
||||
BitmapScopedWriteAccess aWriteAccess(aBitmap);
|
||||
aWriteAccess->Erase(COL_WHITE);
|
||||
@@ -114,7 +114,7 @@ Bitmap OutputDeviceTestBitmap::setupDrawMask()
|
||||
BitmapEx OutputDeviceTestBitmap::setupDrawBlend()
|
||||
{
|
||||
Size aBitmapSize(9, 9);
|
||||
Bitmap aBitmap(aBitmapSize, 24);
|
||||
Bitmap aBitmap(aBitmapSize, vcl::PixelFormat::N24_BPP);
|
||||
{
|
||||
BitmapScopedWriteAccess aWriteAccess(aBitmap);
|
||||
aWriteAccess->Erase(COL_WHITE);
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
|
||||
BitmapEx createBitmap()
|
||||
{
|
||||
Bitmap aBitmap(Size(100, 50), 24);
|
||||
Bitmap aBitmap(Size(100, 50), vcl::PixelFormat::N24_BPP);
|
||||
aBitmap.Erase(COL_LIGHTRED);
|
||||
|
||||
return BitmapEx(aBitmap);
|
||||
|
||||
@@ -473,7 +473,7 @@ public:
|
||||
device->SetOutputSizePixel(Size(16, 16));
|
||||
device->SetBackground(Wallpaper(COL_WHITE));
|
||||
device->Erase();
|
||||
Bitmap aBitmap(Size(16, 16), 24);
|
||||
Bitmap aBitmap(Size(16, 16), vcl::PixelFormat::N24_BPP);
|
||||
{
|
||||
// Fill the top left quarter with black.
|
||||
BitmapScopedWriteAccess pWriteAccess(aBitmap);
|
||||
@@ -719,7 +719,7 @@ public:
|
||||
device->SetOutputSizePixel(Size(10, 10));
|
||||
device->SetBackground(Wallpaper(COL_WHITE));
|
||||
device->Erase();
|
||||
Bitmap bitmap(Size(5, 5), 24);
|
||||
Bitmap bitmap(Size(5, 5), vcl::PixelFormat::N24_BPP);
|
||||
bitmap.Erase(COL_BLUE);
|
||||
// No alpha, this will actually call SalGraphics::DrawBitmap(), but still check
|
||||
// the alpha of the device is handled correctly.
|
||||
@@ -776,7 +776,7 @@ public:
|
||||
alphaDevice->SetOutputSizePixel(Size(20, 20));
|
||||
alphaDevice->SetBackground(Wallpaper(COL_BLACK));
|
||||
alphaDevice->Erase();
|
||||
Bitmap bitmap(Size(4, 4), 24);
|
||||
Bitmap bitmap(Size(4, 4), vcl::PixelFormat::N24_BPP);
|
||||
AlphaMask alpha(Size(4, 4));
|
||||
bitmap.Erase(COL_LIGHTBLUE);
|
||||
{
|
||||
@@ -867,7 +867,7 @@ public:
|
||||
device->SetOutputSizePixel(Size(10, 10));
|
||||
device->SetBackground(Wallpaper(COL_WHITE));
|
||||
device->Erase();
|
||||
Bitmap bitmap(Size(10, 10), 24);
|
||||
Bitmap bitmap(Size(10, 10), vcl::PixelFormat::N24_BPP);
|
||||
bitmap.Erase(COL_BLUE);
|
||||
basegfx::B2DHomMatrix matrix;
|
||||
matrix.scale(bitmap.GetSizePixel().Width(),
|
||||
|
||||
@@ -34,7 +34,7 @@ class BitmapExTest : public CppUnit::TestFixture
|
||||
|
||||
void BitmapExTest::testGetPixelColor24_8()
|
||||
{
|
||||
Bitmap aBitmap(Size(3, 3), 24);
|
||||
Bitmap aBitmap(Size(3, 3), vcl::PixelFormat::N24_BPP);
|
||||
{
|
||||
BitmapScopedWriteAccess pWriteAccess(aBitmap);
|
||||
pWriteAccess->Erase(Color(ColorTransparency, 0x00, 0x00, 0xFF, 0x00));
|
||||
@@ -59,7 +59,7 @@ void BitmapExTest::testGetPixelColor32()
|
||||
if (!pBackendCapabilities->mbSupportsBitmap32)
|
||||
return;
|
||||
|
||||
Bitmap aBitmap(Size(3, 3), 32);
|
||||
Bitmap aBitmap(Size(3, 3), vcl::PixelFormat::N32_BPP);
|
||||
{
|
||||
BitmapScopedWriteAccess pWriteAccess(aBitmap);
|
||||
pWriteAccess->Erase(Color(ColorTransparency, 0xAA, 0x00, 0xFF, 0x00));
|
||||
@@ -73,7 +73,7 @@ void BitmapExTest::testGetPixelColor32()
|
||||
|
||||
void BitmapExTest::testTransformBitmapEx()
|
||||
{
|
||||
Bitmap aBitmap(Size(16, 16), 24);
|
||||
Bitmap aBitmap(Size(16, 16), vcl::PixelFormat::N24_BPP);
|
||||
{
|
||||
BitmapScopedWriteAccess pWriteAccess(aBitmap);
|
||||
pWriteAccess->Erase(COL_WHITE);
|
||||
|
||||
@@ -77,7 +77,7 @@ void BitmapFilterTest::testBlurCorrectness()
|
||||
{
|
||||
// Setup test bitmap
|
||||
Size aSize(41, 31);
|
||||
Bitmap aBitmap24Bit(aSize, 24);
|
||||
Bitmap aBitmap24Bit(aSize, vcl::PixelFormat::N24_BPP);
|
||||
|
||||
ScanlineFormat scanlineFormat = ScanlineFormat::NONE;
|
||||
sal_uInt16 nBPP = aBitmap24Bit.GetBitCount();
|
||||
@@ -174,7 +174,7 @@ void BitmapFilterTest::testPerformance()
|
||||
Size aSize(4000, 3000); // A rather common picture size
|
||||
|
||||
// Prepare bitmap
|
||||
Bitmap aBigBitmap(aSize, 24);
|
||||
Bitmap aBigBitmap(aSize, vcl::PixelFormat::N24_BPP);
|
||||
{
|
||||
tools::Long aMargin = 500;
|
||||
BitmapScopedWriteAccess aWriteAccess(aBigBitmap);
|
||||
|
||||
@@ -32,7 +32,7 @@ class BitmapProcessorTest : public CppUnit::TestFixture
|
||||
void BitmapProcessorTest::testDisabledImage()
|
||||
{
|
||||
{
|
||||
Bitmap aBitmap(Size(3, 3), 24);
|
||||
Bitmap aBitmap(Size(3, 3), vcl::PixelFormat::N24_BPP);
|
||||
{
|
||||
BitmapScopedWriteAccess pWriteAccess(aBitmap);
|
||||
pWriteAccess->Erase(Color(ColorTransparency, 0x00, 0x00, 0xFF, 0x00));
|
||||
@@ -49,7 +49,7 @@ void BitmapProcessorTest::testDisabledImage()
|
||||
}
|
||||
|
||||
{
|
||||
Bitmap aBitmap(Size(3, 3), 24);
|
||||
Bitmap aBitmap(Size(3, 3), vcl::PixelFormat::N24_BPP);
|
||||
{
|
||||
BitmapScopedWriteAccess pWriteAccess(aBitmap);
|
||||
pWriteAccess->Erase(Color(ColorTransparency, 0x00, 0x00, 0xFF, 0x00));
|
||||
|
||||
@@ -121,7 +121,7 @@ void BitmapScaleTest::testScale()
|
||||
+ scaleSize.destSize.toString() + "), method "
|
||||
+ OString::number(static_cast<int>(scaleMethod));
|
||||
fprintf(stderr, "%s\n", testStr.getStr());
|
||||
Bitmap bitmap(scaleSize.srcSize, 24);
|
||||
Bitmap bitmap(scaleSize.srcSize, vcl::PixelFormat::N24_BPP);
|
||||
{
|
||||
// Fill each quarter of the source bitmap with a different color,
|
||||
// and center with yet another color.
|
||||
@@ -202,7 +202,7 @@ void BitmapScaleTest::testScale2()
|
||||
{
|
||||
const bool bExportBitmap(false);
|
||||
|
||||
Bitmap aBitmap24Bit(Size(4096, 4096), 24);
|
||||
Bitmap aBitmap24Bit(Size(4096, 4096), vcl::PixelFormat::N24_BPP);
|
||||
CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(24), aBitmap24Bit.GetBitCount());
|
||||
Color aBitmapColor = COL_YELLOW;
|
||||
{
|
||||
@@ -273,7 +273,7 @@ void BitmapScaleTest::testScaleSymmetry()
|
||||
{
|
||||
const bool bExportBitmap(false);
|
||||
|
||||
Bitmap aBitmap24Bit(Size(10, 10), 24);
|
||||
Bitmap aBitmap24Bit(Size(10, 10), vcl::PixelFormat::N24_BPP);
|
||||
CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(24), aBitmap24Bit.GetBitCount());
|
||||
|
||||
{
|
||||
|
||||
@@ -99,7 +99,7 @@ void BitmapTest::testCreation()
|
||||
}
|
||||
|
||||
{
|
||||
Bitmap aBmp(Size(10, 10), 1);
|
||||
Bitmap aBmp(Size(10, 10), vcl::PixelFormat::N1_BPP);
|
||||
Size aSize = aBmp.GetSizePixel();
|
||||
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong width", static_cast<tools::Long>(10), aSize.Width());
|
||||
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong height", static_cast<tools::Long>(10), aSize.Height());
|
||||
@@ -113,7 +113,7 @@ void BitmapTest::testCreation()
|
||||
}
|
||||
|
||||
{
|
||||
Bitmap aBmp(Size(10, 10), 4);
|
||||
Bitmap aBmp(Size(10, 10), vcl::PixelFormat::N4_BPP);
|
||||
Size aSize = aBmp.GetSizePixel();
|
||||
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong width", static_cast<tools::Long>(10), aSize.Width());
|
||||
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong height", static_cast<tools::Long>(10), aSize.Height());
|
||||
@@ -127,7 +127,7 @@ void BitmapTest::testCreation()
|
||||
}
|
||||
|
||||
{
|
||||
Bitmap aBmp(Size(10, 10), 8);
|
||||
Bitmap aBmp(Size(10, 10), vcl::PixelFormat::N8_BPP);
|
||||
Size aSize = aBmp.GetSizePixel();
|
||||
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong width", static_cast<tools::Long>(10), aSize.Width());
|
||||
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong height", static_cast<tools::Long>(10), aSize.Height());
|
||||
@@ -141,7 +141,7 @@ void BitmapTest::testCreation()
|
||||
}
|
||||
|
||||
{
|
||||
Bitmap aBmp(Size(10, 10), 24);
|
||||
Bitmap aBmp(Size(10, 10), vcl::PixelFormat::N24_BPP);
|
||||
Size aSize = aBmp.GetSizePixel();
|
||||
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong width", static_cast<tools::Long>(10), aSize.Width());
|
||||
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong height", static_cast<tools::Long>(10), aSize.Height());
|
||||
@@ -160,7 +160,7 @@ void BitmapTest::testCreation()
|
||||
auto pBackendCapabilities = ImplGetSVData()->mpDefInst->GetBackendCapabilities();
|
||||
if (pBackendCapabilities->mbSupportsBitmap32)
|
||||
{
|
||||
Bitmap aBmp(Size(10, 10), 32);
|
||||
Bitmap aBmp(Size(10, 10), vcl::PixelFormat::N32_BPP);
|
||||
Size aSize = aBmp.GetSizePixel();
|
||||
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong width", static_cast<tools::Long>(10), aSize.Width());
|
||||
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong height", static_cast<tools::Long>(10), aSize.Height());
|
||||
@@ -176,7 +176,7 @@ void BitmapTest::testCreation()
|
||||
|
||||
void BitmapTest::testEmpty()
|
||||
{
|
||||
Bitmap aBitmap(Size(10, 10), 8);
|
||||
Bitmap aBitmap(Size(10, 10), vcl::PixelFormat::N8_BPP);
|
||||
aBitmap.Erase(COL_LIGHTGRAYBLUE);
|
||||
|
||||
CPPUNIT_ASSERT(!aBitmap.IsEmpty());
|
||||
@@ -187,7 +187,7 @@ void BitmapTest::testEmpty()
|
||||
|
||||
Bitmap createTestBitmap()
|
||||
{
|
||||
Bitmap aBmp(Size(4, 4), 24);
|
||||
Bitmap aBmp(Size(4, 4), vcl::PixelFormat::N24_BPP);
|
||||
BitmapWriteAccess aBmpAccess(aBmp);
|
||||
|
||||
// row 1
|
||||
@@ -346,7 +346,7 @@ void BitmapTest::testN8Greyscale()
|
||||
|
||||
void BitmapTest::testConvert()
|
||||
{
|
||||
Bitmap aBitmap(Size(10, 10), 8);
|
||||
Bitmap aBitmap(Size(10, 10), vcl::PixelFormat::N8_BPP);
|
||||
|
||||
aBitmap.Erase(COL_LIGHTGRAYBLUE);
|
||||
|
||||
@@ -434,7 +434,7 @@ void BitmapTest::testCRC()
|
||||
{
|
||||
CRCHash aCRCs;
|
||||
|
||||
Bitmap aBitmap(Size(1023, 759), 24, nullptr);
|
||||
Bitmap aBitmap(Size(1023, 759), vcl::PixelFormat::N24_BPP);
|
||||
aBitmap.Erase(COL_BLACK);
|
||||
checkAndInsert(aCRCs, aBitmap, "black bitmap");
|
||||
aBitmap.Invert();
|
||||
@@ -519,7 +519,7 @@ void BitmapTest::testCustom8BitPalette()
|
||||
{
|
||||
aCustomPalette[i] = BitmapColor(sal_uInt8(i), sal_uInt8(0xCC), sal_uInt8(0x22));
|
||||
}
|
||||
Bitmap aBitmap(Size(3, 2), 8, &aCustomPalette);
|
||||
Bitmap aBitmap(Size(3, 2), vcl::PixelFormat::N8_BPP, &aCustomPalette);
|
||||
|
||||
{
|
||||
BitmapScopedWriteAccess pAccess(aBitmap);
|
||||
@@ -556,7 +556,7 @@ void BitmapTest::testCustom8BitPalette()
|
||||
|
||||
void BitmapTest::testErase()
|
||||
{
|
||||
Bitmap aBitmap(Size(3, 3), 24);
|
||||
Bitmap aBitmap(Size(3, 3), vcl::PixelFormat::N24_BPP);
|
||||
{
|
||||
BitmapScopedWriteAccess pWriteAccess(aBitmap);
|
||||
pWriteAccess->Erase(Color(0x11, 0x22, 0x33));
|
||||
@@ -576,7 +576,7 @@ void BitmapTest::testBitmap32()
|
||||
if (!pBackendCapabilities->mbSupportsBitmap32)
|
||||
return;
|
||||
|
||||
Bitmap aBitmap(Size(3, 3), 32);
|
||||
Bitmap aBitmap(Size(3, 3), vcl::PixelFormat::N32_BPP);
|
||||
{
|
||||
BitmapScopedWriteAccess pWriteAccess(aBitmap);
|
||||
pWriteAccess->Erase(Color(ColorTransparency, 0xFF, 0x11, 0x22, 0x33));
|
||||
@@ -599,7 +599,7 @@ void BitmapTest::testBitmap32()
|
||||
void BitmapTest::testOctree()
|
||||
{
|
||||
Size aSize(1000, 100);
|
||||
Bitmap aBitmap(aSize, 24);
|
||||
Bitmap aBitmap(aSize, vcl::PixelFormat::N24_BPP);
|
||||
{
|
||||
BitmapScopedWriteAccess pWriteAccess(aBitmap);
|
||||
for (tools::Long y = 0; y < aSize.Height(); ++y)
|
||||
@@ -656,37 +656,40 @@ void BitmapTest::testDitherSize()
|
||||
{
|
||||
// no need to do anything for a 1x1 pixel bitmap
|
||||
{
|
||||
Bitmap aBitmap(Size(1, 1), 24);
|
||||
Bitmap aBitmap(Size(1, 1), vcl::PixelFormat::N24_BPP);
|
||||
CPPUNIT_ASSERT(aBitmap.Dither());
|
||||
}
|
||||
|
||||
// cannot dither a bitmap with a width of 2 or 3 pixels
|
||||
{
|
||||
Bitmap aBitmap(Size(2, 4), 24);
|
||||
Bitmap aBitmap(Size(2, 4), vcl::PixelFormat::N24_BPP);
|
||||
CPPUNIT_ASSERT(!aBitmap.Dither());
|
||||
}
|
||||
|
||||
{
|
||||
Bitmap aBitmap(Size(3, 4), 24);
|
||||
Bitmap aBitmap(Size(3, 4), vcl::PixelFormat::N24_BPP);
|
||||
CPPUNIT_ASSERT(!aBitmap.Dither());
|
||||
}
|
||||
|
||||
// cannot dither a bitmap with a height of 2 pixels
|
||||
{
|
||||
Bitmap aBitmap(Size(4, 2), 24);
|
||||
Bitmap aBitmap(Size(4, 2), vcl::PixelFormat::N24_BPP);
|
||||
CPPUNIT_ASSERT(!aBitmap.Dither());
|
||||
}
|
||||
|
||||
// only dither bitmaps with a width > 3 pixels and height > 2 pixels
|
||||
{
|
||||
Bitmap aBitmap(Size(4, 3), 24);
|
||||
Bitmap aBitmap(Size(4, 3), vcl::PixelFormat::N24_BPP);
|
||||
CPPUNIT_ASSERT(aBitmap.Dither());
|
||||
}
|
||||
}
|
||||
|
||||
void BitmapTest::testMirror()
|
||||
{
|
||||
for (int bpp : { 4, 8, 24, 32 })
|
||||
vcl::PixelFormat bppArray[] = { vcl::PixelFormat::N4_BPP, vcl::PixelFormat::N8_BPP,
|
||||
vcl::PixelFormat::N24_BPP, vcl::PixelFormat::N32_BPP };
|
||||
|
||||
for (vcl::PixelFormat bpp : bppArray)
|
||||
{
|
||||
Bitmap bitmap(Size(11, 11), bpp);
|
||||
{
|
||||
|
||||
@@ -46,7 +46,7 @@ class GraphicDescriptorTest : public test::BootstrapFixtureBase
|
||||
|
||||
BitmapEx createBitmap()
|
||||
{
|
||||
Bitmap aBitmap(Size(100, 100), 24);
|
||||
Bitmap aBitmap(Size(100, 100), vcl::PixelFormat::N24_BPP);
|
||||
aBitmap.Erase(COL_LIGHTRED);
|
||||
|
||||
return BitmapEx(aBitmap);
|
||||
|
||||
@@ -126,7 +126,7 @@ GraphicTest::~GraphicTest()
|
||||
|
||||
BitmapEx createBitmap(bool alpha = false)
|
||||
{
|
||||
Bitmap aBitmap(Size(120, 100), 24);
|
||||
Bitmap aBitmap(Size(120, 100), vcl::PixelFormat::N24_BPP);
|
||||
aBitmap.Erase(COL_LIGHTRED);
|
||||
|
||||
aBitmap.SetPrefSize(Size(6000, 5000));
|
||||
|
||||
@@ -189,7 +189,7 @@ void TypeSerializerTest::testGraphic_Vector()
|
||||
|
||||
void TypeSerializerTest::testGraphic_Bitmap_NoGfxLink()
|
||||
{
|
||||
Bitmap aBitmap(Size(10, 10), 24);
|
||||
Bitmap aBitmap(Size(10, 10), vcl::PixelFormat::N24_BPP);
|
||||
aBitmap.Erase(COL_LIGHTGRAYBLUE);
|
||||
BitmapEx aBitmapEx(aBitmap);
|
||||
Graphic aGraphic(aBitmapEx);
|
||||
|
||||
@@ -633,14 +633,20 @@ public:
|
||||
|
||||
void CanvasBitmapTest::runTest()
|
||||
{
|
||||
static const sal_Int8 lcl_depths[]={1,4,8,24};
|
||||
static vcl::PixelFormat ePixelFormatArray[] =
|
||||
{
|
||||
vcl::PixelFormat::N1_BPP,
|
||||
vcl::PixelFormat::N4_BPP,
|
||||
vcl::PixelFormat::N8_BPP,
|
||||
vcl::PixelFormat::N24_BPP
|
||||
};
|
||||
|
||||
// Testing VclCanvasBitmap wrapper
|
||||
|
||||
for( size_t i=0; i<SAL_N_ELEMENTS(lcl_depths); ++i )
|
||||
for (auto const pixelFormat : ePixelFormatArray)
|
||||
{
|
||||
const sal_Int8 nDepth( lcl_depths[i] );
|
||||
Bitmap aBitmap(Size(200,200),nDepth);
|
||||
const sal_uInt16 nDepth = sal_uInt16(pixelFormat);
|
||||
Bitmap aBitmap(Size(200,200), pixelFormat);
|
||||
aBitmap.Erase(COL_WHITE);
|
||||
{
|
||||
BitmapScopedWriteAccess pAcc(aBitmap);
|
||||
@@ -670,7 +676,7 @@ void CanvasBitmapTest::runTest()
|
||||
|
||||
checkCanvasBitmap( xBmp, "single bitmap", nDepth );
|
||||
|
||||
Bitmap aMask(Size(200,200),1);
|
||||
Bitmap aMask(Size(200,200), vcl::PixelFormat::N1_BPP);
|
||||
aMask.Erase(COL_WHITE);
|
||||
{
|
||||
BitmapScopedWriteAccess pAcc(aMask);
|
||||
|
||||
@@ -92,7 +92,7 @@ void VclFiltersTest::testScaling()
|
||||
{
|
||||
for (BmpScaleFlag i = BmpScaleFlag::Default; i <= BmpScaleFlag::BiLinear; i = static_cast<BmpScaleFlag>(static_cast<int>(i) + 1))
|
||||
{
|
||||
Bitmap aBitmap( Size( 413, 409 ), 24 );
|
||||
Bitmap aBitmap(Size(413, 409), vcl::PixelFormat::N24_BPP);
|
||||
BitmapEx aBitmapEx( aBitmap );
|
||||
|
||||
fprintf( stderr, "scale with type %d\n", int( i ) );
|
||||
@@ -105,7 +105,7 @@ void VclFiltersTest::testScaling()
|
||||
|
||||
void VclFiltersTest::checkExportImport(std::u16string_view aFilterShortName)
|
||||
{
|
||||
Bitmap aBitmap( Size( 100, 100 ), 24 );
|
||||
Bitmap aBitmap(Size(100, 100), vcl::PixelFormat::N24_BPP);
|
||||
aBitmap.Erase(COL_WHITE);
|
||||
|
||||
SvMemoryStream aStream;
|
||||
|
||||
@@ -126,7 +126,7 @@ void TiffFilterTest::testTdf138818()
|
||||
|
||||
void TiffFilterTest::testRoundtrip()
|
||||
{
|
||||
Bitmap aBitmap(Size(2, 2), 24);
|
||||
Bitmap aBitmap(Size(2, 2), vcl::PixelFormat::N24_BPP);
|
||||
{
|
||||
BitmapScopedWriteAccess pAccess(aBitmap);
|
||||
pAccess->SetPixel(0, 0, COL_WHITE);
|
||||
|
||||
@@ -156,7 +156,7 @@ void VclOutdevTest::testDrawTransformedBitmapEx()
|
||||
// Create a virtual device, and connect a metafile to it.
|
||||
// Also create a 16x16 bitmap.
|
||||
ScopedVclPtrInstance<VirtualDevice> pVDev;
|
||||
Bitmap aBitmap(Size(16, 16), 24);
|
||||
Bitmap aBitmap(Size(16, 16), vcl::PixelFormat::N24_BPP);
|
||||
{
|
||||
// Fill the top left quarter with black.
|
||||
BitmapScopedWriteAccess pWriteAccess(aBitmap);
|
||||
@@ -220,7 +220,7 @@ void VclOutdevTest::testDrawTransformedBitmapExFlip()
|
||||
// Create a virtual device, and connect a metafile to it.
|
||||
// Also create a 16x16 bitmap.
|
||||
ScopedVclPtrInstance<VirtualDevice> pVDev;
|
||||
Bitmap aBitmap(Size(16, 16), 24);
|
||||
Bitmap aBitmap(Size(16, 16), vcl::PixelFormat::N24_BPP);
|
||||
{
|
||||
// Fill the top left quarter with black.
|
||||
BitmapScopedWriteAccess pWriteAccess(aBitmap);
|
||||
|
||||
@@ -73,7 +73,7 @@ void SkiaTest::testBitmapErase()
|
||||
{
|
||||
if (!SkiaHelper::isVCLSkiaEnabled())
|
||||
return;
|
||||
Bitmap bitmap(Size(10, 10), 24);
|
||||
Bitmap bitmap(Size(10, 10), vcl::PixelFormat::N24_BPP);
|
||||
SkiaSalBitmap* skiaBitmap = dynamic_cast<SkiaSalBitmap*>(bitmap.ImplGetSalBitmap().get());
|
||||
CPPUNIT_ASSERT(skiaBitmap);
|
||||
// Uninitialized bitmap.
|
||||
@@ -106,7 +106,7 @@ void SkiaTest::testDrawShaders()
|
||||
device->SetOutputSizePixel(Size(20, 20));
|
||||
device->SetBackground(Wallpaper(COL_WHITE));
|
||||
device->Erase();
|
||||
Bitmap bitmap(Size(10, 10), 24);
|
||||
Bitmap bitmap(Size(10, 10), vcl::PixelFormat::N24_BPP);
|
||||
bitmap.Erase(COL_RED);
|
||||
SkiaSalBitmap* skiaBitmap = dynamic_cast<SkiaSalBitmap*>(bitmap.ImplGetSalBitmap().get());
|
||||
CPPUNIT_ASSERT(skiaBitmap->PreferSkShader());
|
||||
@@ -149,7 +149,7 @@ void SkiaTest::testDrawShaders()
|
||||
deviceLarge->SetOutputSizePixel(Size(200, 200));
|
||||
deviceLarge->SetBackground(Wallpaper(COL_WHITE));
|
||||
deviceLarge->Erase();
|
||||
Bitmap bitmapLarge(Size(100, 100), 24);
|
||||
Bitmap bitmapLarge(Size(100, 100), vcl::PixelFormat::N24_BPP);
|
||||
bitmapLarge.Erase(COL_RED);
|
||||
SkiaSalBitmap* skiaBitmapLarge
|
||||
= dynamic_cast<SkiaSalBitmap*>(bitmapLarge.ImplGetSalBitmap().get());
|
||||
@@ -184,7 +184,7 @@ void SkiaTest::testInterpretAs8Bit()
|
||||
{
|
||||
if (!SkiaHelper::isVCLSkiaEnabled())
|
||||
return;
|
||||
Bitmap bitmap(Size(10, 10), 24);
|
||||
Bitmap bitmap(Size(10, 10), vcl::PixelFormat::N24_BPP);
|
||||
// Test with erase color.
|
||||
bitmap.Erase(Color(33, 33, 33));
|
||||
SkiaSalBitmap* skiaBitmap = dynamic_cast<SkiaSalBitmap*>(bitmap.ImplGetSalBitmap().get());
|
||||
@@ -197,7 +197,7 @@ void SkiaTest::testInterpretAs8Bit()
|
||||
CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(33), BitmapReadAccess(bitmap).GetPixelIndex(0, 0));
|
||||
|
||||
// Test with image.
|
||||
bitmap = Bitmap(Size(10, 10), 24);
|
||||
bitmap = Bitmap(Size(10, 10), vcl::PixelFormat::N24_BPP);
|
||||
bitmap.Erase(Color(34, 34, 34));
|
||||
BitmapReadAccess(bitmap).GetColor(0, 0); // Create pixel data, reset erase color.
|
||||
skiaBitmap = dynamic_cast<SkiaSalBitmap*>(bitmap.ImplGetSalBitmap().get());
|
||||
@@ -217,7 +217,7 @@ void SkiaTest::testAlphaBlendWith()
|
||||
if (!SkiaHelper::isVCLSkiaEnabled())
|
||||
return;
|
||||
AlphaMask alpha(Size(10, 10));
|
||||
Bitmap bitmap(Size(10, 10), 24);
|
||||
Bitmap bitmap(Size(10, 10), vcl::PixelFormat::N24_BPP);
|
||||
// Test with erase colors set.
|
||||
alpha.Erase(64);
|
||||
SkiaSalBitmap* skiaAlpha = dynamic_cast<SkiaSalBitmap*>(alpha.ImplGetSalBitmap().get());
|
||||
|
||||
@@ -939,17 +939,17 @@ void SvmTest::testBitmaps()
|
||||
ScopedVclPtrInstance<VirtualDevice> pVirtualDev;
|
||||
setupBaseVirtualDevice(*pVirtualDev, aGDIMetaFile);
|
||||
|
||||
Bitmap aBitmap1(Size(4,4), 24);
|
||||
Bitmap aBitmap1(Size(4,4), vcl::PixelFormat::N24_BPP);
|
||||
{
|
||||
BitmapScopedWriteAccess pAccess(aBitmap1);
|
||||
pAccess->Erase(COL_RED);
|
||||
}
|
||||
Bitmap aBitmap2(Size(4,4), 24);
|
||||
Bitmap aBitmap2(Size(4,4), vcl::PixelFormat::N24_BPP);
|
||||
{
|
||||
BitmapScopedWriteAccess pAccess(aBitmap2);
|
||||
pAccess->Erase(COL_GREEN);
|
||||
}
|
||||
Bitmap aBitmap3(Size(4,4), 24);
|
||||
Bitmap aBitmap3(Size(4,4), vcl::PixelFormat::N24_BPP);
|
||||
{
|
||||
BitmapScopedWriteAccess pAccess(aBitmap3);
|
||||
pAccess->Erase(COL_BLUE);
|
||||
@@ -1030,7 +1030,7 @@ void SvmTest::testBitmapExs()
|
||||
|
||||
// DrawBitmapEx
|
||||
{
|
||||
Bitmap aBitmap(Size(4,4), 24);
|
||||
Bitmap aBitmap(Size(4,4), vcl::PixelFormat::N24_BPP);
|
||||
{
|
||||
BitmapScopedWriteAccess pAccess(aBitmap);
|
||||
pAccess->Erase(COL_YELLOW);
|
||||
@@ -1041,7 +1041,7 @@ void SvmTest::testBitmapExs()
|
||||
|
||||
// DrawBitmapEx - Scale
|
||||
{
|
||||
Bitmap aBitmap(Size(4,4), 24);
|
||||
Bitmap aBitmap(Size(4,4), vcl::PixelFormat::N24_BPP);
|
||||
{
|
||||
BitmapScopedWriteAccess pAccess(aBitmap);
|
||||
pAccess->Erase(COL_GREEN);
|
||||
@@ -1051,7 +1051,7 @@ void SvmTest::testBitmapExs()
|
||||
|
||||
// DrawBitmapEx - Scale - Part
|
||||
{
|
||||
Bitmap aBitmap(Size(4,4), 24);
|
||||
Bitmap aBitmap(Size(4,4), vcl::PixelFormat::N24_BPP);
|
||||
{
|
||||
BitmapScopedWriteAccess pAccess(aBitmap);
|
||||
pAccess->Erase(COL_BLUE);
|
||||
@@ -1061,7 +1061,7 @@ void SvmTest::testBitmapExs()
|
||||
|
||||
// DrawBitmapEx - 50% transparent
|
||||
{
|
||||
Bitmap aBitmap(Size(4, 4), 24);
|
||||
Bitmap aBitmap(Size(4, 4), vcl::PixelFormat::N24_BPP);
|
||||
AlphaMask aAlpha(Size(4, 4));
|
||||
{
|
||||
BitmapScopedWriteAccess pAccess(aBitmap);
|
||||
@@ -1075,7 +1075,7 @@ void SvmTest::testBitmapExs()
|
||||
|
||||
// DrawBitmapEx - 1-bit
|
||||
{
|
||||
Bitmap aBitmap(Size(2, 2), 24);
|
||||
Bitmap aBitmap(Size(2, 2), vcl::PixelFormat::N24_BPP);
|
||||
{
|
||||
BitmapScopedWriteAccess pAccess(aBitmap);
|
||||
pAccess->Erase(COL_MAGENTA);
|
||||
@@ -1086,7 +1086,7 @@ void SvmTest::testBitmapExs()
|
||||
|
||||
// DrawBitmapEx - 4-bit
|
||||
{
|
||||
Bitmap aBitmap(Size(2, 2), 24);
|
||||
Bitmap aBitmap(Size(2, 2), vcl::PixelFormat::N24_BPP);
|
||||
{
|
||||
BitmapScopedWriteAccess pAccess(aBitmap);
|
||||
pAccess->Erase(COL_MAGENTA);
|
||||
@@ -1097,7 +1097,7 @@ void SvmTest::testBitmapExs()
|
||||
|
||||
// DrawBitmapEx - 8-bit Color
|
||||
{
|
||||
Bitmap aBitmap(Size(2, 2), 24);
|
||||
Bitmap aBitmap(Size(2, 2), vcl::PixelFormat::N24_BPP);
|
||||
{
|
||||
BitmapScopedWriteAccess pAccess(aBitmap);
|
||||
pAccess->Erase(COL_MAGENTA);
|
||||
@@ -1108,7 +1108,7 @@ void SvmTest::testBitmapExs()
|
||||
|
||||
// DrawBitmapEx - 8-bit Grey
|
||||
{
|
||||
Bitmap aBitmap(Size(2, 2), 24);
|
||||
Bitmap aBitmap(Size(2, 2), vcl::PixelFormat::N24_BPP);
|
||||
{
|
||||
BitmapScopedWriteAccess pAccess(aBitmap);
|
||||
pAccess->Erase(COL_MAGENTA);
|
||||
@@ -1157,17 +1157,17 @@ void SvmTest::testMasks()
|
||||
ScopedVclPtrInstance<VirtualDevice> pVirtualDev;
|
||||
setupBaseVirtualDevice(*pVirtualDev, aGDIMetaFile);
|
||||
|
||||
Bitmap aBitmap1(Size(4,4), 24);
|
||||
Bitmap aBitmap1(Size(4,4), vcl::PixelFormat::N24_BPP);
|
||||
{
|
||||
BitmapScopedWriteAccess pAccess(aBitmap1);
|
||||
pAccess->Erase(COL_RED);
|
||||
}
|
||||
Bitmap aBitmap2(Size(4,4), 24);
|
||||
Bitmap aBitmap2(Size(4,4), vcl::PixelFormat::N24_BPP);
|
||||
{
|
||||
BitmapScopedWriteAccess pAccess(aBitmap2);
|
||||
pAccess->Erase(COL_GREEN);
|
||||
}
|
||||
Bitmap aBitmap3(Size(4,4), 24);
|
||||
Bitmap aBitmap3(Size(4,4), vcl::PixelFormat::N24_BPP);
|
||||
{
|
||||
BitmapScopedWriteAccess pAccess(aBitmap3);
|
||||
pAccess->Erase(COL_BLUE);
|
||||
|
||||
@@ -32,14 +32,14 @@ BitmapEx BitmapColorQuantizationFilter::execute(BitmapEx const& aBitmapEx) const
|
||||
else
|
||||
{
|
||||
Bitmap::ScopedReadAccess pRAcc(aBitmap);
|
||||
sal_uInt16 nBitCount;
|
||||
vcl::PixelFormat ePixelFormat;
|
||||
|
||||
auto const cappedNewColorCount = std::min(mnNewColorCount, sal_uInt16(256));
|
||||
|
||||
if (cappedNewColorCount < 17)
|
||||
nBitCount = 4;
|
||||
ePixelFormat = vcl::PixelFormat::N4_BPP;
|
||||
else
|
||||
nBitCount = 8;
|
||||
ePixelFormat = vcl::PixelFormat::N8_BPP;
|
||||
|
||||
if (pRAcc)
|
||||
{
|
||||
@@ -135,7 +135,7 @@ BitmapEx BitmapColorQuantizationFilter::execute(BitmapEx const& aBitmapEx) const
|
||||
<< nRightShiftBits));
|
||||
}
|
||||
|
||||
Bitmap aNewBmp(aBitmap.GetSizePixel(), nBitCount, &aNewPal);
|
||||
Bitmap aNewBmp(aBitmap.GetSizePixel(), ePixelFormat, &aNewPal);
|
||||
BitmapScopedWriteAccess pWAcc(aNewBmp);
|
||||
|
||||
if (pWAcc)
|
||||
|
||||
@@ -29,7 +29,7 @@ BitmapEx BitmapConvolutionMatrixFilter::execute(BitmapEx const& rBitmapEx) const
|
||||
|
||||
if (pReadAcc)
|
||||
{
|
||||
Bitmap aNewBmp(aBitmap.GetSizePixel(), 24);
|
||||
Bitmap aNewBmp(aBitmap.GetSizePixel(), vcl::PixelFormat::N24_BPP);
|
||||
BitmapScopedWriteAccess pWriteAcc(aNewBmp);
|
||||
|
||||
if (pWriteAcc)
|
||||
|
||||
@@ -17,12 +17,13 @@ BitmapEx BitmapDisabledImageFilter::execute(BitmapEx const& rBitmapEx) const
|
||||
|
||||
// keep disable image at same depth as original where possible, otherwise
|
||||
// use 8 bit
|
||||
sal_uInt16 nBitCount = rBitmapEx.GetBitCount();
|
||||
if (nBitCount < 8)
|
||||
nBitCount = 8;
|
||||
auto ePixelFormat = rBitmapEx.getPixelFormat();
|
||||
if (sal_uInt16(ePixelFormat) < 8)
|
||||
ePixelFormat = vcl::PixelFormat::N8_BPP;
|
||||
|
||||
const BitmapPalette* pPal = nBitCount == 8 ? &Bitmap::GetGreyPalette(256) : nullptr;
|
||||
Bitmap aGrey(aSize, nBitCount, pPal);
|
||||
const BitmapPalette* pPal
|
||||
= vcl::isPalettePixelFormat(ePixelFormat) ? &Bitmap::GetGreyPalette(256) : nullptr;
|
||||
Bitmap aGrey(aSize, ePixelFormat, pPal);
|
||||
BitmapScopedWriteAccess pGrey(aGrey);
|
||||
|
||||
BitmapEx aReturnBitmap;
|
||||
|
||||
@@ -29,7 +29,7 @@ BitmapEx BitmapDuoToneFilter::execute(BitmapEx const& rBitmapEx) const
|
||||
const tools::Long nWidth = aBitmap.GetSizePixel().Width();
|
||||
const tools::Long nHeight = aBitmap.GetSizePixel().Height();
|
||||
|
||||
Bitmap aResultBitmap(aBitmap.GetSizePixel(), 24);
|
||||
Bitmap aResultBitmap(aBitmap.GetSizePixel(), vcl::PixelFormat::N24_BPP);
|
||||
Bitmap::ScopedReadAccess pReadAcc(aBitmap);
|
||||
BitmapScopedWriteAccess pWriteAcc(aResultBitmap);
|
||||
const BitmapColor aColorOne(static_cast<sal_uInt8>(mnColorOne >> 16),
|
||||
|
||||
@@ -34,7 +34,8 @@ BitmapEx BitmapEmbossGreyFilter::execute(BitmapEx const& rBitmapEx) const
|
||||
|
||||
if (pReadAcc)
|
||||
{
|
||||
Bitmap aNewBmp(aBitmap.GetSizePixel(), 8, &pReadAcc->GetPalette());
|
||||
Bitmap aNewBmp(aBitmap.GetSizePixel(), vcl::PixelFormat::N8_BPP,
|
||||
&pReadAcc->GetPalette());
|
||||
BitmapScopedWriteAccess pWriteAcc(aNewBmp);
|
||||
|
||||
if (pWriteAcc)
|
||||
|
||||
@@ -62,7 +62,7 @@ BitmapEx::BitmapEx( const BitmapEx& rBitmapEx, Point aSrc, Size aSize )
|
||||
if( rBitmapEx.IsEmpty() )
|
||||
return;
|
||||
|
||||
maBitmap = Bitmap( aSize, rBitmapEx.maBitmap.GetBitCount() );
|
||||
maBitmap = Bitmap(aSize, rBitmapEx.maBitmap.getPixelFormat());
|
||||
SetSizePixel(aSize);
|
||||
if( rBitmapEx.IsAlpha() )
|
||||
{
|
||||
@@ -70,18 +70,18 @@ BitmapEx::BitmapEx( const BitmapEx& rBitmapEx, Point aSrc, Size aSize )
|
||||
maMask = AlphaMask( aSize ).ImplGetBitmap();
|
||||
}
|
||||
else if( rBitmapEx.IsTransparent() )
|
||||
maMask = Bitmap( aSize, rBitmapEx.maMask.GetBitCount() );
|
||||
maMask = Bitmap(aSize, rBitmapEx.maMask.getPixelFormat());
|
||||
|
||||
tools::Rectangle aDestRect( Point( 0, 0 ), aSize );
|
||||
tools::Rectangle aSrcRect( aSrc, aSize );
|
||||
CopyPixel( aDestRect, aSrcRect, &rBitmapEx );
|
||||
}
|
||||
|
||||
BitmapEx::BitmapEx( Size aSize, sal_uInt16 nBitCount )
|
||||
BitmapEx::BitmapEx(Size aSize, vcl::PixelFormat ePixelFormat)
|
||||
: meTransparent(TransparentType::NONE)
|
||||
, mbAlpha(false)
|
||||
{
|
||||
maBitmap = Bitmap( aSize, nBitCount );
|
||||
maBitmap = Bitmap(aSize, ePixelFormat);
|
||||
SetSizePixel(aSize);
|
||||
}
|
||||
|
||||
@@ -383,7 +383,7 @@ bool BitmapEx::Rotate( Degree10 nAngle10, const Color& rFillColor )
|
||||
|
||||
if( meTransparent == TransparentType::NONE )
|
||||
{
|
||||
maMask = Bitmap(GetSizePixel(), 1);
|
||||
maMask = Bitmap(GetSizePixel(), vcl::PixelFormat::N1_BPP);
|
||||
maMask.Erase( COL_BLACK );
|
||||
meTransparent = TransparentType::Bitmap;
|
||||
}
|
||||
@@ -516,7 +516,7 @@ bool BitmapEx::CopyPixel( const tools::Rectangle& rRectDst, const tools::Rectang
|
||||
}
|
||||
else
|
||||
{
|
||||
maMask = Bitmap(GetSizePixel(), 1);
|
||||
maMask = Bitmap(GetSizePixel(), vcl::PixelFormat::N1_BPP);
|
||||
maMask.Erase(COL_BLACK);
|
||||
meTransparent = TransparentType::Bitmap;
|
||||
maMask.CopyPixel( rRectDst, rRectSrc, &pBmpExSrc->maMask );
|
||||
@@ -531,7 +531,7 @@ bool BitmapEx::CopyPixel( const tools::Rectangle& rRectDst, const tools::Rectang
|
||||
}
|
||||
else if (IsTransparent())
|
||||
{
|
||||
Bitmap aMaskSrc(pBmpExSrc->GetSizePixel(), 1);
|
||||
Bitmap aMaskSrc(pBmpExSrc->GetSizePixel(), vcl::PixelFormat::N1_BPP);
|
||||
|
||||
aMaskSrc.Erase( COL_BLACK );
|
||||
maMask.CopyPixel( rRectDst, rRectSrc, &aMaskSrc );
|
||||
@@ -779,7 +779,7 @@ namespace
|
||||
const basegfx::B2DHomMatrix& rTransform,
|
||||
bool bSmooth)
|
||||
{
|
||||
Bitmap aDestination(rDestinationSize, 24);
|
||||
Bitmap aDestination(rDestinationSize, vcl::PixelFormat::N24_BPP);
|
||||
BitmapScopedWriteAccess xWrite(aDestination);
|
||||
|
||||
if(xWrite)
|
||||
@@ -1006,7 +1006,7 @@ BitmapEx BitmapEx::ModifyBitmapEx(const basegfx::BColorModifierStack& rBColorMod
|
||||
aNewPalette[0] = BitmapColor(Color(pReplace->getBColor()));
|
||||
aChangedBitmap = Bitmap(
|
||||
aChangedBitmap.GetSizePixel(),
|
||||
aChangedBitmap.GetBitCount(),
|
||||
aChangedBitmap.getPixelFormat(),
|
||||
&aNewPalette);
|
||||
}
|
||||
}
|
||||
@@ -1185,7 +1185,7 @@ BitmapEx createBlendFrame(
|
||||
if(nW > 1 && nH > 1)
|
||||
{
|
||||
sal_uInt8 aEraseTrans(0xff);
|
||||
Bitmap aContent(rSize, 24);
|
||||
Bitmap aContent(rSize, vcl::PixelFormat::N24_BPP);
|
||||
AlphaMask aAlpha(rSize, &aEraseTrans);
|
||||
|
||||
aContent.Erase(COL_BLACK);
|
||||
|
||||
@@ -44,7 +44,7 @@ BitmapEx BitmapFastScaleFilter::execute(BitmapEx const& rBitmapEx) const
|
||||
|
||||
if (pReadAcc)
|
||||
{
|
||||
Bitmap aNewBmp(Size(nNewWidth, nNewHeight), aBitmap.GetBitCount(),
|
||||
Bitmap aNewBmp(Size(nNewWidth, nNewHeight), aBitmap.getPixelFormat(),
|
||||
&pReadAcc->GetPalette());
|
||||
BitmapScopedWriteAccess pWriteAcc(aNewBmp);
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ BitmapEx BitmapGaussianSeparableBlurFilter::execute(BitmapEx const& rBitmapEx) c
|
||||
Bitmap::ScopedReadAccess pReadAcc(aBitmap);
|
||||
|
||||
// switch coordinates as convolution pass transposes result
|
||||
Bitmap aNewBitmap(Size(nHeight, nWidth), 24);
|
||||
Bitmap aNewBitmap(Size(nHeight, nWidth), vcl::PixelFormat::N24_BPP);
|
||||
|
||||
bool bResult = convolutionPass(aBitmap, aNewBitmap, pReadAcc.get(), aNumberOfContributions,
|
||||
aWeights.data(), aPixels.data(), aCounts.data());
|
||||
@@ -60,7 +60,7 @@ BitmapEx BitmapGaussianSeparableBlurFilter::execute(BitmapEx const& rBitmapEx) c
|
||||
blurContributions(nHeight, aNumberOfContributions, aBlurVector, aWeights, aPixels, aCounts);
|
||||
|
||||
pReadAcc = Bitmap::ScopedReadAccess(aBitmap);
|
||||
aNewBitmap = Bitmap(Size(nWidth, nHeight), 24);
|
||||
aNewBitmap = Bitmap(Size(nWidth, nHeight), vcl::PixelFormat::N24_BPP);
|
||||
bResult = convolutionPass(aBitmap, aNewBitmap, pReadAcc.get(), aNumberOfContributions,
|
||||
aWeights.data(), aPixels.data(), aCounts.data());
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ BitmapEx BitmapInterpolateScaleFilter::execute(BitmapEx const& rBitmapEx) const
|
||||
{
|
||||
tools::Long nWidth = pReadAcc->Width();
|
||||
tools::Long nHeight = pReadAcc->Height();
|
||||
Bitmap aNewBmp(Size(nNewWidth, nHeight), 24);
|
||||
Bitmap aNewBmp(Size(nNewWidth, nHeight), vcl::PixelFormat::N24_BPP);
|
||||
BitmapScopedWriteAccess pWriteAcc(aNewBmp);
|
||||
|
||||
if (pWriteAcc)
|
||||
@@ -137,7 +137,7 @@ BitmapEx BitmapInterpolateScaleFilter::execute(BitmapEx const& rBitmapEx) const
|
||||
bRet = false;
|
||||
const Bitmap aOriginal(aBitmap);
|
||||
aBitmap = aNewBmp;
|
||||
aNewBmp = Bitmap(Size(nNewWidth, nNewHeight), 24);
|
||||
aNewBmp = Bitmap(Size(nNewWidth, nNewHeight), vcl::PixelFormat::N24_BPP);
|
||||
pReadAcc = Bitmap::ScopedReadAccess(aBitmap);
|
||||
pWriteAcc = BitmapScopedWriteAccess(aNewBmp);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ BitmapEx BitmapLightenFilter::execute(BitmapEx const& rBitmapEx) const
|
||||
const Size aSize(rBitmapEx.GetSizePixel());
|
||||
|
||||
Bitmap aBitmap(rBitmapEx.GetBitmap());
|
||||
Bitmap aDarkBitmap(aSize, 24);
|
||||
Bitmap aDarkBitmap(aSize, vcl::PixelFormat::N24_BPP);
|
||||
|
||||
Bitmap::ScopedReadAccess pRead(aBitmap);
|
||||
BitmapScopedWriteAccess pWrite(aDarkBitmap);
|
||||
|
||||
@@ -58,7 +58,7 @@ BitmapEx BitmapMedianFilter::execute(BitmapEx const& rBitmapEx) const
|
||||
|
||||
if (pReadAcc)
|
||||
{
|
||||
Bitmap aNewBmp(aBitmap.GetSizePixel(), 24);
|
||||
Bitmap aNewBmp(aBitmap.GetSizePixel(), vcl::PixelFormat::N24_BPP);
|
||||
BitmapScopedWriteAccess pWriteAcc(aNewBmp);
|
||||
|
||||
if (pWriteAcc)
|
||||
|
||||
@@ -22,7 +22,7 @@ BitmapEx BitmapMonochromeFilter::execute(BitmapEx const& aBitmapEx) const
|
||||
|
||||
if (pReadAcc)
|
||||
{
|
||||
Bitmap aNewBmp(aBitmap.GetSizePixel(), 1);
|
||||
Bitmap aNewBmp(aBitmap.GetSizePixel(), vcl::PixelFormat::N1_BPP);
|
||||
BitmapScopedWriteAccess pWriteAcc(aNewBmp);
|
||||
|
||||
if (pWriteAcc)
|
||||
|
||||
@@ -32,7 +32,7 @@ BitmapEx BitmapMosaicFilter::execute(BitmapEx const& rBitmapEx) const
|
||||
}
|
||||
else
|
||||
{
|
||||
pNewBmp.reset(new Bitmap(aBitmap.GetSizePixel(), 24));
|
||||
pNewBmp.reset(new Bitmap(aBitmap.GetSizePixel(), vcl::PixelFormat::N24_BPP));
|
||||
pReadAcc = aBitmap.AcquireReadAccess();
|
||||
pWriteAcc = pNewBmp->AcquireWriteAccess();
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ bool ImplScaleConvolutionHor(Bitmap& rSource, Bitmap& rTarget, const double& rSc
|
||||
|
||||
const tools::Long nHeight(rSource.GetSizePixel().Height());
|
||||
ImplCalculateContributions(nWidth, nNewWidth, aNumberOfContributions, aWeights, aPixels, aCounts, aKernel);
|
||||
rTarget = Bitmap(Size(nNewWidth, nHeight), 24);
|
||||
rTarget = Bitmap(Size(nNewWidth, nHeight), vcl::PixelFormat::N24_BPP);
|
||||
BitmapScopedWriteAccess pWriteAcc(rTarget);
|
||||
bool bResult(pWriteAcc);
|
||||
|
||||
@@ -198,7 +198,7 @@ bool ImplScaleConvolutionVer(Bitmap& rSource, Bitmap& rTarget, const double& rSc
|
||||
|
||||
const tools::Long nWidth(rSource.GetSizePixel().Width());
|
||||
ImplCalculateContributions(nHeight, nNewHeight, aNumberOfContributions, aWeights, aPixels, aCounts, aKernel);
|
||||
rTarget = Bitmap(Size(nWidth, nNewHeight), 24);
|
||||
rTarget = Bitmap(Size(nWidth, nNewHeight), vcl::PixelFormat::N24_BPP);
|
||||
BitmapScopedWriteAccess pWriteAcc(rTarget);
|
||||
bool bResult(pWriteAcc);
|
||||
|
||||
|
||||
@@ -882,11 +882,15 @@ BitmapEx BitmapScaleSuperFilter::execute(BitmapEx const& rBitmap) const
|
||||
{
|
||||
Bitmap::ScopedReadAccess pReadAccess(aBitmap);
|
||||
|
||||
sal_uInt16 nSourceBitcount = aBitmap.GetBitCount();
|
||||
// If source format is less than 24BPP, use 24BPP
|
||||
auto eSourcePixelFormat = aBitmap.getPixelFormat();
|
||||
auto ePixelFormat = eSourcePixelFormat;
|
||||
if (sal_uInt16(eSourcePixelFormat) < 24)
|
||||
ePixelFormat = vcl::PixelFormat::N24_BPP;
|
||||
|
||||
Bitmap aOutBmp(Size(nDstW, nDstH), std::max(nSourceBitcount, sal_uInt16(24)));
|
||||
Bitmap aOutBmp(Size(nDstW, nDstH), ePixelFormat);
|
||||
Size aOutSize = aOutBmp.GetSizePixel();
|
||||
sal_uInt16 nTargetBitcount = aOutBmp.GetBitCount();
|
||||
auto eTargetPixelFormat = aOutBmp.getPixelFormat();
|
||||
|
||||
if (!aOutSize.Width() || !aOutSize.Height())
|
||||
{
|
||||
@@ -932,7 +936,7 @@ BitmapEx BitmapScaleSuperFilter::execute(BitmapEx const& rBitmap) const
|
||||
// the capabilities of the backend. If for some reason the destination
|
||||
// is not the same bit-depth as the source, then we can't use
|
||||
// a fast path, so we always need to process with a general scaler.
|
||||
else if (nSourceBitcount != nTargetBitcount)
|
||||
else if (eSourcePixelFormat != eTargetPixelFormat)
|
||||
{
|
||||
pScaleRangeFn = bScaleUp ? scaleUpNonPaletteGeneral : scaleDownNonPaletteGeneral;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ BitmapEx BitmapSeparableUnsharpenFilter::execute(BitmapEx const& rBitmapEx) cons
|
||||
// Amount of unsharpening effect on image - currently set to a fixed value
|
||||
double aAmount = 2.0;
|
||||
|
||||
Bitmap aResultBitmap(Size(nWidth, nHeight), 24);
|
||||
Bitmap aResultBitmap(Size(nWidth, nHeight), vcl::PixelFormat::N24_BPP);
|
||||
|
||||
Bitmap::ScopedReadAccess pReadAccBlur(aBlur);
|
||||
Bitmap::ScopedReadAccess pReadAcc(aBitmap);
|
||||
|
||||
@@ -40,7 +40,7 @@ BitmapEx BitmapSepiaFilter::execute(BitmapEx const& rBitmapEx) const
|
||||
rCol.SetBlue(cSepiaValue);
|
||||
}
|
||||
|
||||
Bitmap aNewBmp(aBitmap.GetSizePixel(), 8, &aSepiaPal);
|
||||
Bitmap aNewBmp(aBitmap.GetSizePixel(), vcl::PixelFormat::N8_BPP, &aSepiaPal);
|
||||
BitmapScopedWriteAccess pWriteAcc(aNewBmp);
|
||||
|
||||
if (pWriteAcc)
|
||||
|
||||
@@ -30,21 +30,21 @@ BitmapEx BitmapSimpleColorQuantizationFilter::execute(BitmapEx const& aBitmapEx)
|
||||
Bitmap aNewBmp;
|
||||
Bitmap::ScopedReadAccess pRAcc(aBitmap);
|
||||
const sal_uInt16 nColorCount = std::min(mnNewColorCount, sal_uInt16(256));
|
||||
sal_uInt16 nBitCount = 0;
|
||||
auto ePixelFormat = vcl::PixelFormat::INVALID;
|
||||
|
||||
if (nColorCount <= 2)
|
||||
nBitCount = 1;
|
||||
ePixelFormat = vcl::PixelFormat::N1_BPP;
|
||||
else if (nColorCount <= 16)
|
||||
nBitCount = 4;
|
||||
ePixelFormat = vcl::PixelFormat::N4_BPP;
|
||||
else
|
||||
nBitCount = 8;
|
||||
ePixelFormat = vcl::PixelFormat::N8_BPP;
|
||||
|
||||
if (pRAcc)
|
||||
{
|
||||
Octree aOct(*pRAcc, nColorCount);
|
||||
const BitmapPalette& rPal = aOct.GetPalette();
|
||||
|
||||
aNewBmp = Bitmap(aBitmap.GetSizePixel(), nBitCount, &rPal);
|
||||
aNewBmp = Bitmap(aBitmap.GetSizePixel(), ePixelFormat, &rPal);
|
||||
BitmapScopedWriteAccess pWAcc(aNewBmp);
|
||||
|
||||
if (pWAcc)
|
||||
|
||||
@@ -32,7 +32,8 @@ BitmapEx BitmapSobelGreyFilter::execute(BitmapEx const& rBitmapEx) const
|
||||
|
||||
if (pReadAcc)
|
||||
{
|
||||
Bitmap aNewBmp(aBitmap.GetSizePixel(), 8, &pReadAcc->GetPalette());
|
||||
Bitmap aNewBmp(aBitmap.GetSizePixel(), vcl::PixelFormat::N8_BPP,
|
||||
&pReadAcc->GetPalette());
|
||||
BitmapScopedWriteAccess pWriteAcc(aNewBmp);
|
||||
|
||||
if (pWriteAcc)
|
||||
|
||||
@@ -121,11 +121,14 @@ void loadFromSvg(SvStream& rStream, const OUString& sPath, BitmapEx& rBitmapEx,
|
||||
@param nStride
|
||||
The number of bytes in a scanline, must >= (width * nBitCount / 8)
|
||||
*/
|
||||
BitmapEx CreateFromData( sal_uInt8 const *pData, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int32 nStride, sal_uInt16 nBitCount )
|
||||
BitmapEx CreateFromData( sal_uInt8 const *pData, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int32 nStride, vcl::PixelFormat ePixelFormat)
|
||||
{
|
||||
auto nBitCount = sal_uInt16(ePixelFormat);
|
||||
|
||||
assert(nStride >= (nWidth * nBitCount / 8));
|
||||
assert( nBitCount == 1 || nBitCount == 24 || nBitCount == 32);
|
||||
Bitmap aBmp( Size( nWidth, nHeight ), nBitCount );
|
||||
assert(nBitCount == 1 || nBitCount == 24 || nBitCount == 32);
|
||||
|
||||
Bitmap aBmp(Size(nWidth, nHeight), ePixelFormat);
|
||||
|
||||
BitmapScopedWriteAccess pWrite(aBmp);
|
||||
assert(pWrite.get());
|
||||
@@ -188,7 +191,17 @@ BitmapEx CreateFromData( RawBitmap&& rawBitmap )
|
||||
{
|
||||
auto nBitCount = rawBitmap.GetBitCount();
|
||||
assert( nBitCount == 24 || nBitCount == 32);
|
||||
Bitmap aBmp( rawBitmap.maSize, nBitCount );
|
||||
|
||||
auto ePixelFormat = vcl::PixelFormat::INVALID;
|
||||
|
||||
if (nBitCount == 24)
|
||||
ePixelFormat = vcl::PixelFormat::N24_BPP;
|
||||
else if (nBitCount == 32)
|
||||
ePixelFormat = vcl::PixelFormat::N32_BPP;
|
||||
|
||||
assert(ePixelFormat != vcl::PixelFormat::INVALID);
|
||||
|
||||
Bitmap aBmp(rawBitmap.maSize, ePixelFormat);
|
||||
|
||||
BitmapScopedWriteAccess pWrite(aBmp);
|
||||
assert(pWrite.get());
|
||||
@@ -255,7 +268,7 @@ BitmapEx* CreateFromCairoSurface(Size aSize, cairo_surface_t * pSurface)
|
||||
cairo_set_operator( pCairo, CAIRO_OPERATOR_SOURCE );
|
||||
cairo_paint( pCairo );
|
||||
|
||||
::Bitmap aRGB( aSize, 24 );
|
||||
Bitmap aRGB(aSize, vcl::PixelFormat::N24_BPP);
|
||||
::AlphaMask aMask( aSize );
|
||||
|
||||
BitmapScopedWriteAccess pRGBWrite(aRGB);
|
||||
@@ -382,7 +395,7 @@ BitmapEx CanvasTransformBitmap( const BitmapEx& rBitmap,
|
||||
if( aDestBmpSize.IsEmpty() )
|
||||
return BitmapEx();
|
||||
|
||||
Bitmap aDstBitmap( aDestBmpSize, aSrcBitmap.GetBitCount(), &pReadAccess->GetPalette() );
|
||||
Bitmap aDstBitmap(aDestBmpSize, aSrcBitmap.getPixelFormat(), &pReadAccess->GetPalette());
|
||||
Bitmap aDstAlpha( AlphaMask( aDestBmpSize ).GetBitmap() );
|
||||
|
||||
{
|
||||
@@ -964,7 +977,7 @@ void CanvasCairoExtractBitmapData( BitmapEx const & aBmpEx, Bitmap & aBitmap, un
|
||||
aPalette[0] = BitmapColor(aColorBack);
|
||||
aPalette[1] = BitmapColor(aColorPix);
|
||||
|
||||
Bitmap aBitmap(Size(8, 8), 1, &aPalette);
|
||||
Bitmap aBitmap(Size(8, 8), vcl::PixelFormat::N1_BPP, &aPalette);
|
||||
BitmapScopedWriteAccess pContent(aBitmap);
|
||||
|
||||
for(sal_uInt16 a(0); a < 8; a++)
|
||||
@@ -1071,7 +1084,7 @@ bool convertBitmap32To24Plus8(BitmapEx const & rInput, BitmapEx & rResult)
|
||||
return false;
|
||||
|
||||
Size aSize = aBitmap.GetSizePixel();
|
||||
Bitmap aResultBitmap(aSize, 24);
|
||||
Bitmap aResultBitmap(aSize, vcl::PixelFormat::N24_BPP);
|
||||
AlphaMask aResultAlpha(aSize);
|
||||
{
|
||||
BitmapScopedWriteAccess pResultBitmapAccess(aResultBitmap);
|
||||
|
||||
@@ -39,8 +39,8 @@ AlphaMask::AlphaMask( const AlphaMask& ) = default;
|
||||
|
||||
AlphaMask::AlphaMask( AlphaMask&& ) = default;
|
||||
|
||||
AlphaMask::AlphaMask( const Size& rSizePixel, const sal_uInt8* pEraseTransparency ) :
|
||||
Bitmap( rSizePixel, 8, &Bitmap::GetGreyPalette( 256 ) )
|
||||
AlphaMask::AlphaMask( const Size& rSizePixel, const sal_uInt8* pEraseTransparency )
|
||||
: Bitmap(rSizePixel, vcl::PixelFormat::N8_BPP, &Bitmap::GetGreyPalette(256))
|
||||
{
|
||||
if( pEraseTransparency )
|
||||
Bitmap::Erase( Color( *pEraseTransparency, *pEraseTransparency, *pEraseTransparency ) );
|
||||
|
||||
@@ -74,7 +74,7 @@ Bitmap::Bitmap(std::shared_ptr<SalBitmap> const & pSalBitmap)
|
||||
{
|
||||
}
|
||||
|
||||
Bitmap::Bitmap( const Size& rSizePixel, sal_uInt16 nBitCount, const BitmapPalette* pPal )
|
||||
Bitmap::Bitmap( const Size& rSizePixel, vcl::PixelFormat ePixelFormat, const BitmapPalette* pPal )
|
||||
{
|
||||
if (!(rSizePixel.Width() && rSizePixel.Height()))
|
||||
return;
|
||||
@@ -82,19 +82,20 @@ Bitmap::Bitmap( const Size& rSizePixel, sal_uInt16 nBitCount, const BitmapPalett
|
||||
BitmapPalette aPal;
|
||||
BitmapPalette* pRealPal = nullptr;
|
||||
|
||||
if( nBitCount <= 8 )
|
||||
if (vcl::isPalettePixelFormat(ePixelFormat))
|
||||
{
|
||||
if( !pPal )
|
||||
{
|
||||
if( 1 == nBitCount )
|
||||
if (ePixelFormat == vcl::PixelFormat::N1_BPP)
|
||||
{
|
||||
aPal.SetEntryCount( 2 );
|
||||
aPal[ 0 ] = COL_BLACK;
|
||||
aPal[ 1 ] = COL_WHITE;
|
||||
}
|
||||
else if( ( 4 == nBitCount ) || ( 8 == nBitCount ) )
|
||||
else if (ePixelFormat == vcl::PixelFormat::N4_BPP ||
|
||||
ePixelFormat == vcl::PixelFormat::N8_BPP)
|
||||
{
|
||||
aPal.SetEntryCount( 1 << nBitCount );
|
||||
aPal.SetEntryCount(1 << sal_uInt16(ePixelFormat));
|
||||
aPal[ 0 ] = COL_BLACK;
|
||||
aPal[ 1 ] = COL_BLUE;
|
||||
aPal[ 2 ] = COL_GREEN;
|
||||
@@ -113,7 +114,7 @@ Bitmap::Bitmap( const Size& rSizePixel, sal_uInt16 nBitCount, const BitmapPalett
|
||||
aPal[ 15 ] = COL_WHITE;
|
||||
|
||||
// Create dither palette
|
||||
if( 8 == nBitCount )
|
||||
if (ePixelFormat == vcl::PixelFormat::N8_BPP)
|
||||
{
|
||||
sal_uInt16 nActCol = 16;
|
||||
|
||||
@@ -132,7 +133,7 @@ Bitmap::Bitmap( const Size& rSizePixel, sal_uInt16 nBitCount, const BitmapPalett
|
||||
}
|
||||
|
||||
mxSalBmp = ImplGetSVData()->mpDefInst->CreateSalBitmap();
|
||||
mxSalBmp->Create( rSizePixel, nBitCount, pRealPal ? *pRealPal : aPal );
|
||||
mxSalBmp->Create( rSizePixel, sal_uInt16(ePixelFormat), pRealPal ? *pRealPal : aPal );
|
||||
}
|
||||
|
||||
#ifdef DBG_UTIL
|
||||
@@ -320,6 +321,21 @@ Size Bitmap::GetSizePixel() const
|
||||
return( mxSalBmp ? mxSalBmp->GetSize() : Size() );
|
||||
}
|
||||
|
||||
vcl::PixelFormat Bitmap::getPixelFormat() const
|
||||
{
|
||||
switch (GetBitCount())
|
||||
{
|
||||
case 1: return vcl::PixelFormat::N1_BPP;
|
||||
case 4: return vcl::PixelFormat::N4_BPP;
|
||||
case 8: return vcl::PixelFormat::N8_BPP;
|
||||
case 24: return vcl::PixelFormat::N24_BPP;
|
||||
case 32: return vcl::PixelFormat::N32_BPP;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return vcl::PixelFormat::INVALID;
|
||||
}
|
||||
|
||||
sal_uInt16 Bitmap::GetBitCount() const
|
||||
{
|
||||
if (!mxSalBmp)
|
||||
@@ -427,7 +443,6 @@ void Bitmap::ReassignWithSize(const Bitmap& rBitmap)
|
||||
maPrefMapMode = aOldMapMode;
|
||||
}
|
||||
|
||||
|
||||
void Bitmap::ImplSetSalBitmap(const std::shared_ptr<SalBitmap>& xImpBmp)
|
||||
{
|
||||
mxSalBmp = xImpBmp;
|
||||
@@ -489,7 +504,7 @@ bool Bitmap::Crop( const tools::Rectangle& rRectPixel )
|
||||
if( pReadAcc )
|
||||
{
|
||||
const tools::Rectangle aNewRect( Point(), aRect.GetSize() );
|
||||
Bitmap aNewBmp( aNewRect.GetSize(), GetBitCount(), &pReadAcc->GetPalette() );
|
||||
Bitmap aNewBmp(aNewRect.GetSize(), getPixelFormat(), &pReadAcc->GetPalette());
|
||||
BitmapScopedWriteAccess pWriteAcc(aNewBmp);
|
||||
|
||||
if( pWriteAcc )
|
||||
@@ -869,7 +884,7 @@ bool Bitmap::Expand( sal_uLong nDX, sal_uLong nDY, const Color* pInitColor )
|
||||
if( pReadAcc )
|
||||
{
|
||||
BitmapPalette aBmpPal( pReadAcc->GetPalette() );
|
||||
Bitmap aNewBmp( aNewSize, GetBitCount(), &aBmpPal );
|
||||
Bitmap aNewBmp(aNewSize, getPixelFormat(), &aBmpPal);
|
||||
BitmapScopedWriteAccess pWriteAcc(aNewBmp);
|
||||
|
||||
if( pWriteAcc )
|
||||
@@ -990,9 +1005,9 @@ bool Bitmap::Convert( BmpConversion eConversion )
|
||||
case BmpConversion::N4BitColors:
|
||||
{
|
||||
if( nBitCount < 4 )
|
||||
bRet = ImplConvertUp( 4 );
|
||||
bRet = ImplConvertUp(vcl::PixelFormat::N4_BPP);
|
||||
else if( nBitCount > 4 )
|
||||
bRet = ImplConvertDown( 4 );
|
||||
bRet = ImplConvertDown(vcl::PixelFormat::N4_BPP);
|
||||
else
|
||||
bRet = true;
|
||||
}
|
||||
@@ -1006,9 +1021,9 @@ bool Bitmap::Convert( BmpConversion eConversion )
|
||||
case BmpConversion::N8BitColors:
|
||||
{
|
||||
if( nBitCount < 8 )
|
||||
bRet = ImplConvertUp( 8 );
|
||||
bRet = ImplConvertUp(vcl::PixelFormat::N8_BPP);
|
||||
else if( nBitCount > 8 )
|
||||
bRet = ImplConvertDown( 8 );
|
||||
bRet = ImplConvertDown(vcl::PixelFormat::N8_BPP);
|
||||
else
|
||||
bRet = true;
|
||||
}
|
||||
@@ -1019,16 +1034,16 @@ bool Bitmap::Convert( BmpConversion eConversion )
|
||||
Color aTrans( BMP_COL_TRANS );
|
||||
|
||||
if( nBitCount < 8 )
|
||||
bRet = ImplConvertUp( 8, &aTrans );
|
||||
bRet = ImplConvertUp(vcl::PixelFormat::N8_BPP, &aTrans );
|
||||
else
|
||||
bRet = ImplConvertDown( 8, &aTrans );
|
||||
bRet = ImplConvertDown(vcl::PixelFormat::N8_BPP, &aTrans );
|
||||
}
|
||||
break;
|
||||
|
||||
case BmpConversion::N24Bit:
|
||||
{
|
||||
if( nBitCount < 24 )
|
||||
bRet = ImplConvertUp( 24 );
|
||||
bRet = ImplConvertUp(vcl::PixelFormat::N24_BPP);
|
||||
else
|
||||
bRet = true;
|
||||
}
|
||||
@@ -1037,7 +1052,7 @@ bool Bitmap::Convert( BmpConversion eConversion )
|
||||
case BmpConversion::N32Bit:
|
||||
{
|
||||
if( nBitCount < 32 )
|
||||
bRet = ImplConvertUp( 32 );
|
||||
bRet = ImplConvertUp(vcl::PixelFormat::N32_BPP);
|
||||
else
|
||||
bRet = true;
|
||||
}
|
||||
@@ -1069,7 +1084,9 @@ bool Bitmap::ImplMakeGreyscales( sal_uInt16 nGreys )
|
||||
|
||||
if( bPalDiffers )
|
||||
{
|
||||
Bitmap aNewBmp( GetSizePixel(), ( nGreys == 16 ) ? 4 : 8, &rPal );
|
||||
auto ePixelFormat = nGreys == 16 ? vcl::PixelFormat::N4_BPP
|
||||
: vcl::PixelFormat::N8_BPP;
|
||||
Bitmap aNewBmp(GetSizePixel(), ePixelFormat, &rPal );
|
||||
BitmapScopedWriteAccess pWriteAcc(aNewBmp);
|
||||
|
||||
if( pWriteAcc )
|
||||
@@ -1169,9 +1186,9 @@ bool Bitmap::ImplMakeGreyscales( sal_uInt16 nGreys )
|
||||
return bRet;
|
||||
}
|
||||
|
||||
bool Bitmap::ImplConvertUp(sal_uInt16 nBitCount, Color const * pExtColor)
|
||||
bool Bitmap::ImplConvertUp(vcl::PixelFormat ePixelFormat, Color const * pExtColor)
|
||||
{
|
||||
SAL_WARN_IF( nBitCount <= GetBitCount(), "vcl", "New BitCount must be greater!" );
|
||||
SAL_WARN_IF(sal_Int32(ePixelFormat) <= GetBitCount(), "vcl", "New BitCount must be greater!" );
|
||||
|
||||
Bitmap::ScopedReadAccess pReadAcc(*this);
|
||||
bool bRet = false;
|
||||
@@ -1179,7 +1196,7 @@ bool Bitmap::ImplConvertUp(sal_uInt16 nBitCount, Color const * pExtColor)
|
||||
if (pReadAcc)
|
||||
{
|
||||
BitmapPalette aPalette;
|
||||
Bitmap aNewBmp(GetSizePixel(), nBitCount, pReadAcc->HasPalette() ? &pReadAcc->GetPalette() : &aPalette);
|
||||
Bitmap aNewBmp(GetSizePixel(), ePixelFormat, pReadAcc->HasPalette() ? &pReadAcc->GetPalette() : &aPalette);
|
||||
BitmapScopedWriteAccess pWriteAcc(aNewBmp);
|
||||
|
||||
if (pWriteAcc)
|
||||
@@ -1192,8 +1209,8 @@ bool Bitmap::ImplConvertUp(sal_uInt16 nBitCount, Color const * pExtColor)
|
||||
const BitmapPalette& rOldPalette = pReadAcc->GetPalette();
|
||||
const sal_uInt16 nOldCount = rOldPalette.GetEntryCount();
|
||||
assert(nOldCount <= (1 << GetBitCount()));
|
||||
|
||||
aPalette.SetEntryCount(1 << nBitCount);
|
||||
sal_Int16 nNewBitCount = sal_Int16(ePixelFormat);
|
||||
aPalette.SetEntryCount(1 << nNewBitCount);
|
||||
|
||||
for (sal_uInt16 i = 0; i < nOldCount; i++)
|
||||
aPalette[i] = rOldPalette[i];
|
||||
@@ -1258,9 +1275,9 @@ bool Bitmap::ImplConvertUp(sal_uInt16 nBitCount, Color const * pExtColor)
|
||||
return bRet;
|
||||
}
|
||||
|
||||
bool Bitmap::ImplConvertDown(sal_uInt16 nBitCount, Color const * pExtColor)
|
||||
bool Bitmap::ImplConvertDown(vcl::PixelFormat ePixelFormat, Color const * pExtColor)
|
||||
{
|
||||
SAL_WARN_IF(nBitCount > GetBitCount(), "vcl", "New BitCount must be lower ( or equal when pExtColor is set )!");
|
||||
SAL_WARN_IF(sal_Int32(ePixelFormat) > GetBitCount(), "vcl", "New BitCount must be lower ( or equal when pExtColor is set )!");
|
||||
|
||||
Bitmap::ScopedReadAccess pReadAcc(*this);
|
||||
bool bRet = false;
|
||||
@@ -1268,12 +1285,13 @@ bool Bitmap::ImplConvertDown(sal_uInt16 nBitCount, Color const * pExtColor)
|
||||
if (pReadAcc)
|
||||
{
|
||||
BitmapPalette aPalette;
|
||||
Bitmap aNewBmp(GetSizePixel(), nBitCount, &aPalette);
|
||||
Bitmap aNewBmp(GetSizePixel(), ePixelFormat, &aPalette);
|
||||
BitmapScopedWriteAccess pWriteAcc(aNewBmp);
|
||||
|
||||
if (pWriteAcc)
|
||||
{
|
||||
const sal_uInt16 nCount = 1 << nBitCount;
|
||||
sal_Int16 nNewBitCount = sal_Int16(ePixelFormat);
|
||||
const sal_uInt16 nCount = 1 << nNewBitCount;
|
||||
const tools::Long nWidth = pWriteAcc->Width();
|
||||
const tools::Long nWidth1 = nWidth - 1;
|
||||
const tools::Long nHeight = pWriteAcc->Height();
|
||||
@@ -1581,7 +1599,7 @@ bool Bitmap::Dither()
|
||||
if( ( aSize.Width() > 3 ) && ( aSize.Height() > 2 ) )
|
||||
{
|
||||
ScopedReadAccess pReadAcc(*this);
|
||||
Bitmap aNewBmp( GetSizePixel(), 8 );
|
||||
Bitmap aNewBmp(GetSizePixel(), vcl::PixelFormat::N8_BPP);
|
||||
BitmapScopedWriteAccess pWriteAcc(aNewBmp);
|
||||
if( pReadAcc && pWriteAcc )
|
||||
{
|
||||
|
||||
@@ -308,7 +308,7 @@ bool Bitmap::Rotate(Degree10 nAngle10, const Color& rFillColor)
|
||||
if (nAngle10 == 900_deg10 || nAngle10 == 2700_deg10)
|
||||
{
|
||||
const Size aNewSizePix(aSizePix.Height(), aSizePix.Width());
|
||||
Bitmap aNewBmp(aNewSizePix, GetBitCount(), &pReadAcc->GetPalette());
|
||||
Bitmap aNewBmp(aNewSizePix, getPixelFormat(), &pReadAcc->GetPalette());
|
||||
BitmapScopedWriteAccess pWriteAcc(aNewBmp);
|
||||
|
||||
if (pWriteAcc)
|
||||
@@ -360,7 +360,7 @@ bool Bitmap::Rotate(Degree10 nAngle10, const Color& rFillColor)
|
||||
|
||||
tools::Rectangle aNewBound(aPoly.GetBoundRect());
|
||||
const Size aNewSizePix(aNewBound.GetSize());
|
||||
Bitmap aNewBmp(aNewSizePix, GetBitCount(), &pReadAcc->GetPalette());
|
||||
Bitmap aNewBmp(aNewSizePix, getPixelFormat(), &pReadAcc->GetPalette());
|
||||
BitmapScopedWriteAccess pWriteAcc(aNewBmp);
|
||||
|
||||
if (pWriteAcc)
|
||||
@@ -460,7 +460,8 @@ Bitmap Bitmap::CreateMask(const Color& rTransColor, sal_uInt8 nTol) const
|
||||
return *this;
|
||||
}
|
||||
|
||||
Bitmap aNewBmp(GetSizePixel(), use8BitMask ? 8 : 1,
|
||||
auto ePixelFormat = use8BitMask ? vcl::PixelFormat::N8_BPP : vcl::PixelFormat::N1_BPP;
|
||||
Bitmap aNewBmp(GetSizePixel(), ePixelFormat,
|
||||
use8BitMask ? &Bitmap::GetGreyPalette(256) : nullptr);
|
||||
BitmapScopedWriteAccess pWriteAcc(aNewBmp);
|
||||
bool bRet = false;
|
||||
@@ -869,7 +870,7 @@ bool Bitmap::Replace(const Bitmap& rMask, const Color& rReplaceColor)
|
||||
|
||||
bool Bitmap::Replace(const AlphaMask& rAlpha, const Color& rMergeColor)
|
||||
{
|
||||
Bitmap aNewBmp(GetSizePixel(), 24);
|
||||
Bitmap aNewBmp(GetSizePixel(), vcl::PixelFormat::N24_BPP);
|
||||
ScopedReadAccess pAcc(*this);
|
||||
AlphaMask::ScopedReadAccess pAlphaAcc(const_cast<AlphaMask&>(rAlpha));
|
||||
BitmapScopedWriteAccess pNewAcc(aNewBmp);
|
||||
|
||||
@@ -136,11 +136,12 @@ struct DIBV5Header : public DIBInfoHeader
|
||||
{}
|
||||
};
|
||||
|
||||
sal_uInt16 discretizeBitcount( sal_uInt16 nInputCount )
|
||||
vcl::PixelFormat convertToBPP(sal_uInt16 nCount)
|
||||
{
|
||||
return ( nInputCount <= 1 ) ? 1 :
|
||||
( nInputCount <= 4 ) ? 4 :
|
||||
( nInputCount <= 8 ) ? 8 : 24;
|
||||
return (nCount <= 1) ? vcl::PixelFormat::N1_BPP :
|
||||
(nCount <= 4) ? vcl::PixelFormat::N4_BPP :
|
||||
(nCount <= 8) ? vcl::PixelFormat::N8_BPP :
|
||||
vcl::PixelFormat::N24_BPP;
|
||||
}
|
||||
|
||||
bool isBitfieldCompression( ScanlineFormat nScanlineFormat )
|
||||
@@ -998,20 +999,21 @@ bool ImplReadDIBBody(SvStream& rIStm, Bitmap& rBmp, AlphaMask* pBmpAlpha, sal_uL
|
||||
pAccAlpha = AlphaScopedWriteAccess(aNewBmpAlpha);
|
||||
}
|
||||
|
||||
sal_uInt16 nBitCount(discretizeBitcount(aHeader.nBitCount));
|
||||
vcl::PixelFormat ePixelFormat(convertToBPP(aHeader.nBitCount));
|
||||
const BitmapPalette* pPal = &aPalette;
|
||||
//ofz#948 match the surrounding logic of case TransparentType::Bitmap of
|
||||
//ReadDIBBitmapEx but do it while reading for performance
|
||||
const bool bIsAlpha = (nBitCount == 8 && !!aPalette && aPalette.IsGreyPalette8Bit());
|
||||
const bool bForceToMonoWhileReading = (bIsMask && !bIsAlpha && nBitCount != 1);
|
||||
const bool bIsAlpha = (ePixelFormat == vcl::PixelFormat::N8_BPP &&
|
||||
!!aPalette && aPalette.IsGreyPalette8Bit());
|
||||
const bool bForceToMonoWhileReading = (bIsMask && !bIsAlpha && ePixelFormat != vcl::PixelFormat::N1_BPP);
|
||||
if (bForceToMonoWhileReading)
|
||||
{
|
||||
pPal = nullptr;
|
||||
nBitCount = 1;
|
||||
ePixelFormat = vcl::PixelFormat::N1_BPP;
|
||||
SAL_WARN( "vcl", "forcing mask to monochrome");
|
||||
}
|
||||
|
||||
Bitmap aNewBmp(aSizePixel, nBitCount, pPal);
|
||||
Bitmap aNewBmp(aSizePixel, ePixelFormat, pPal);
|
||||
BitmapScopedWriteAccess pAcc(aNewBmp);
|
||||
if (!pAcc)
|
||||
return false;
|
||||
@@ -1283,8 +1285,8 @@ bool ImplWriteDIBBits(SvStream& rOStm, BitmapReadAccess const & rAcc, BitmapRead
|
||||
// bitmaps is relatively recent.
|
||||
// #i59239# discretize bitcount for aligned width to 1,4,8,24
|
||||
// (other cases are not written below)
|
||||
const sal_uInt16 nBitCount(pAccAlpha ? 32 : discretizeBitcount(rAcc.GetBitCount()));
|
||||
const sal_uLong nAlignedWidth(AlignedWidth4Bytes(rAcc.Width() * nBitCount));
|
||||
const auto ePixelFormat(pAccAlpha ? vcl::PixelFormat::N32_BPP : convertToBPP(rAcc.GetBitCount()));
|
||||
const sal_uLong nAlignedWidth(AlignedWidth4Bytes(rAcc.Width() * sal_Int32(ePixelFormat)));
|
||||
bool bNative(false);
|
||||
|
||||
switch(rAcc.GetScanlineFormat())
|
||||
@@ -1319,9 +1321,9 @@ bool ImplWriteDIBBits(SvStream& rOStm, BitmapReadAccess const & rAcc, BitmapRead
|
||||
const tools::Long nWidth(rAcc.Width());
|
||||
const tools::Long nHeight(rAcc.Height());
|
||||
std::vector<sal_uInt8> aBuf(nAlignedWidth);
|
||||
switch( nBitCount )
|
||||
switch(ePixelFormat)
|
||||
{
|
||||
case 1:
|
||||
case vcl::PixelFormat::N1_BPP:
|
||||
{
|
||||
//valgrind, zero out the trailing unused alignment bytes
|
||||
size_t nUnusedBytes = nAlignedWidth - ((nWidth+7) / 8);
|
||||
@@ -1351,7 +1353,7 @@ bool ImplWriteDIBBits(SvStream& rOStm, BitmapReadAccess const & rAcc, BitmapRead
|
||||
}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
case vcl::PixelFormat::N4_BPP:
|
||||
{
|
||||
//valgrind, zero out the trailing unused alignment bytes
|
||||
size_t nUnusedBytes = nAlignedWidth - ((nWidth+1) / 2);
|
||||
@@ -1380,7 +1382,7 @@ bool ImplWriteDIBBits(SvStream& rOStm, BitmapReadAccess const & rAcc, BitmapRead
|
||||
}
|
||||
break;
|
||||
|
||||
case 8:
|
||||
case vcl::PixelFormat::N8_BPP:
|
||||
{
|
||||
for( tools::Long nY = nHeight - 1; nY >= 0; nY-- )
|
||||
{
|
||||
@@ -1395,7 +1397,7 @@ bool ImplWriteDIBBits(SvStream& rOStm, BitmapReadAccess const & rAcc, BitmapRead
|
||||
}
|
||||
break;
|
||||
|
||||
case 24:
|
||||
case vcl::PixelFormat::N24_BPP:
|
||||
{
|
||||
//valgrind, zero out the trailing unused alignment bytes
|
||||
size_t nUnusedBytes = nAlignedWidth - nWidth * 3;
|
||||
@@ -1406,7 +1408,7 @@ bool ImplWriteDIBBits(SvStream& rOStm, BitmapReadAccess const & rAcc, BitmapRead
|
||||
default:
|
||||
{
|
||||
BitmapColor aPixelColor;
|
||||
const bool bWriteAlpha(32 == nBitCount && pAccAlpha);
|
||||
const bool bWriteAlpha(ePixelFormat == vcl::PixelFormat::N32_BPP && pAccAlpha);
|
||||
|
||||
for( tools::Long nY = nHeight - 1; nY >= 0; nY-- )
|
||||
{
|
||||
@@ -1473,20 +1475,16 @@ bool ImplWriteDIBBody(const Bitmap& rBitmap, SvStream& rOStm, BitmapReadAccess c
|
||||
// recent.
|
||||
// #i59239# discretize bitcount to 1,4,8,24 (other cases
|
||||
// are not written below)
|
||||
const sal_uInt16 nBitCount(pAccAlpha ? 32 : discretizeBitcount(rAcc.GetBitCount()));
|
||||
aHeader.nBitCount = nBitCount;
|
||||
const auto ePixelFormat(pAccAlpha ? vcl::PixelFormat::N32_BPP : convertToBPP(rAcc.GetBitCount()));
|
||||
aHeader.nBitCount = sal_uInt16(ePixelFormat);
|
||||
aHeader.nSizeImage = rAcc.Height() * AlignedWidth4Bytes(rAcc.Width() * aHeader.nBitCount);
|
||||
|
||||
if(bCompressed)
|
||||
{
|
||||
if(4 == nBitCount)
|
||||
{
|
||||
if (ePixelFormat == vcl::PixelFormat::N4_BPP)
|
||||
nCompression = RLE_4;
|
||||
}
|
||||
else if(8 == nBitCount)
|
||||
{
|
||||
else if (ePixelFormat == vcl::PixelFormat::N8_BPP)
|
||||
nCompression = RLE_8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -219,7 +219,7 @@ void GIFReader::CreateBitmaps(tools::Long nWidth, tools::Long nHeight, BitmapPal
|
||||
{
|
||||
const Color aWhite(COL_WHITE);
|
||||
|
||||
aBmp1 = Bitmap(aSize, 1);
|
||||
aBmp1 = Bitmap(aSize, vcl::PixelFormat::N1_BPP);
|
||||
|
||||
if (!aAnimation.Count())
|
||||
aBmp1.Erase(aWhite);
|
||||
@@ -239,7 +239,7 @@ void GIFReader::CreateBitmaps(tools::Long nWidth, tools::Long nHeight, BitmapPal
|
||||
|
||||
if (bStatus)
|
||||
{
|
||||
aBmp8 = Bitmap(aSize, 8, pPal);
|
||||
aBmp8 = Bitmap(aSize, vcl::PixelFormat::N8_BPP, pPal);
|
||||
|
||||
if (!!aBmp8 && bWatchForBackgroundColor && aAnimation.Count())
|
||||
aBmp8.Erase((*pPal)[nBackgroundColor]);
|
||||
|
||||
@@ -182,7 +182,7 @@ size_t RenderPDFBitmaps(const void* pBuffer, int nSize, std::vector<BitmapEx>& r
|
||||
/*start_y=*/0, nPageWidth, nPageHeight);
|
||||
|
||||
// Save the buffer as a bitmap.
|
||||
Bitmap aBitmap(Size(nPageWidth, nPageHeight), 24);
|
||||
Bitmap aBitmap(Size(nPageWidth, nPageHeight), vcl::PixelFormat::N24_BPP);
|
||||
AlphaMask aMask(Size(nPageWidth, nPageHeight));
|
||||
{
|
||||
BitmapScopedWriteAccess pWriteAccess(aBitmap);
|
||||
|
||||
@@ -1675,7 +1675,7 @@ bool TIFFReader::ReadTIFF(SvStream & rTIFF, Graphic & rGraphic )
|
||||
{
|
||||
BitmapEx aImage = vcl::bitmap::CreateFromData(maBitmap.data(), nImageWidth, nImageLength,
|
||||
nImageWidth * (HasAlphaChannel() ? 4 : 3), // scanline bytes
|
||||
HasAlphaChannel() ? 32 : 24);
|
||||
HasAlphaChannel() ? vcl::PixelFormat::N32_BPP : vcl::PixelFormat::N24_BPP);
|
||||
aImage.SetPrefMapMode(maBitmapPrefMapMode);
|
||||
aImage.SetPrefSize(maBitmapPrefSize);
|
||||
|
||||
|
||||
@@ -330,7 +330,7 @@ ReadState XBMReader::ReadXBM( Graphic& rGraphic )
|
||||
|
||||
if ( bStatus && nWidth && nHeight )
|
||||
{
|
||||
aBmp1 = Bitmap( Size( nWidth, nHeight ), 1 );
|
||||
aBmp1 = Bitmap(Size(nWidth, nHeight), vcl::PixelFormat::N1_BPP);
|
||||
pAcc1 = BitmapScopedWriteAccess(aBmp1);
|
||||
|
||||
if( pAcc1 )
|
||||
@@ -349,7 +349,7 @@ ReadState XBMReader::ReadXBM( Graphic& rGraphic )
|
||||
|
||||
if (bStatus && pAcc1)
|
||||
{
|
||||
Bitmap aBlackBmp( Size( pAcc1->Width(), pAcc1->Height() ), 1 );
|
||||
Bitmap aBlackBmp(Size(pAcc1->Width(), pAcc1->Height()), vcl::PixelFormat::N1_BPP);
|
||||
|
||||
pAcc1.reset();
|
||||
aBlackBmp.Erase( COL_BLACK );
|
||||
|
||||
@@ -193,23 +193,23 @@ ReadState XPMReader::ReadXPM( Graphic& rGraphic )
|
||||
if ( mbStatus )
|
||||
{
|
||||
// create a 24bit graphic when more as 256 colours present
|
||||
sal_uInt16 nBits = 1;
|
||||
auto ePixelFormat = vcl::PixelFormat::INVALID;
|
||||
if ( mnColors > 256 )
|
||||
nBits = 24;
|
||||
ePixelFormat = vcl::PixelFormat::N24_BPP;
|
||||
else if ( mnColors > 16 )
|
||||
nBits = 8;
|
||||
ePixelFormat = vcl::PixelFormat::N8_BPP;
|
||||
else if ( mnColors > 2 )
|
||||
nBits = 4;
|
||||
ePixelFormat = vcl::PixelFormat::N4_BPP;
|
||||
else
|
||||
nBits = 1;
|
||||
ePixelFormat = vcl::PixelFormat::N1_BPP;
|
||||
|
||||
maBmp = Bitmap( Size( mnWidth, mnHeight ), nBits );
|
||||
maBmp = Bitmap(Size(mnWidth, mnHeight), ePixelFormat);
|
||||
mpAcc = BitmapScopedWriteAccess(maBmp);
|
||||
|
||||
// mbTransparent is TRUE if at least one colour is transparent
|
||||
if ( mbTransparent )
|
||||
{
|
||||
maMaskBmp = Bitmap( Size( mnWidth, mnHeight ), 1 );
|
||||
maMaskBmp = Bitmap(Size(mnWidth, mnHeight), vcl::PixelFormat::N1_BPP);
|
||||
mpMaskAcc = BitmapScopedWriteAccess(maMaskBmp);
|
||||
if ( !mpMaskAcc )
|
||||
mbStatus = false;
|
||||
|
||||
@@ -216,11 +216,11 @@ bool JPEGReader::CreateBitmap(JPEGCreateBitmapParam const & rParam)
|
||||
aGrayPal[ n ] = BitmapColor( cGray, cGray, cGray );
|
||||
}
|
||||
|
||||
mpBitmap.reset(new Bitmap(aSize, 8, &aGrayPal));
|
||||
mpBitmap.reset(new Bitmap(aSize, vcl::PixelFormat::N8_BPP, &aGrayPal));
|
||||
}
|
||||
else
|
||||
{
|
||||
mpBitmap.reset(new Bitmap(aSize, 24));
|
||||
mpBitmap.reset(new Bitmap(aSize, vcl::PixelFormat::N24_BPP));
|
||||
}
|
||||
|
||||
if (mbSetLogSize)
|
||||
@@ -249,7 +249,7 @@ Graphic JPEGReader::CreateIntermediateGraphic(tools::Long nLines)
|
||||
|
||||
if (!mnLastLines)
|
||||
{
|
||||
mpIncompleteAlpha.reset(new Bitmap(aSizePixel, 1));
|
||||
mpIncompleteAlpha.reset(new Bitmap(aSizePixel, vcl::PixelFormat::N1_BPP));
|
||||
mpIncompleteAlpha->Erase(COL_WHITE);
|
||||
}
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@ bool reader(SvStream& rStream, BitmapEx& rBitmapEx, bool bUseBitmap32)
|
||||
{
|
||||
size_t aRowSizeBytes = png_get_rowbytes(pPng, pInfo);
|
||||
|
||||
aBitmap = Bitmap(Size(width, height), 24);
|
||||
aBitmap = Bitmap(Size(width, height), vcl::PixelFormat::N24_BPP);
|
||||
{
|
||||
pWriteAccess = BitmapScopedWriteAccess(aBitmap);
|
||||
ScanlineFormat eFormat = pWriteAccess->GetScanlineFormat();
|
||||
@@ -224,7 +224,7 @@ bool reader(SvStream& rStream, BitmapEx& rBitmapEx, bool bUseBitmap32)
|
||||
|
||||
if (bUseBitmap32)
|
||||
{
|
||||
aBitmap = Bitmap(Size(width, height), 32);
|
||||
aBitmap = Bitmap(Size(width, height), vcl::PixelFormat::N32_BPP);
|
||||
{
|
||||
pWriteAccess = BitmapScopedWriteAccess(aBitmap);
|
||||
ScanlineFormat eFormat = pWriteAccess->GetScanlineFormat();
|
||||
@@ -271,7 +271,7 @@ bool reader(SvStream& rStream, BitmapEx& rBitmapEx, bool bUseBitmap32)
|
||||
}
|
||||
else
|
||||
{
|
||||
aBitmap = Bitmap(Size(width, height), 24);
|
||||
aBitmap = Bitmap(Size(width, height), vcl::PixelFormat::N24_BPP);
|
||||
aBitmapAlpha = AlphaMask(Size(width, height), nullptr);
|
||||
{
|
||||
pWriteAccess = BitmapScopedWriteAccess(aBitmap);
|
||||
@@ -314,7 +314,8 @@ bool reader(SvStream& rStream, BitmapEx& rBitmapEx, bool bUseBitmap32)
|
||||
{
|
||||
size_t aRowSizeBytes = png_get_rowbytes(pPng, pInfo);
|
||||
|
||||
aBitmap = Bitmap(Size(width, height), 8, &Bitmap::GetGreyPalette(256));
|
||||
aBitmap = Bitmap(Size(width, height), vcl::PixelFormat::N8_BPP,
|
||||
&Bitmap::GetGreyPalette(256));
|
||||
aBitmap.Erase(COL_WHITE);
|
||||
{
|
||||
pWriteAccess = BitmapScopedWriteAccess(aBitmap);
|
||||
|
||||
@@ -1776,7 +1776,7 @@ BitmapEx GDIMetaFile::ImplBmpMonoFnc( const BitmapEx& rBmpEx, const void* pBmpPa
|
||||
aPal[ 1 ] = COL_WHITE;
|
||||
aPal[ 2 ] = static_cast<const ImplBmpMonoParam*>(pBmpParam)->aColor;
|
||||
|
||||
Bitmap aBmp( rBmpEx.GetSizePixel(), 4, &aPal );
|
||||
Bitmap aBmp(rBmpEx.GetSizePixel(), vcl::PixelFormat::N4_BPP, &aPal);
|
||||
aBmp.Erase( static_cast<const ImplBmpMonoParam*>(pBmpParam)->aColor );
|
||||
|
||||
if( rBmpEx.IsAlpha() )
|
||||
|
||||
@@ -233,7 +233,7 @@ void Printer::ImplPrintTransparent( const Bitmap& rBmp, const Bitmap& rMask,
|
||||
// we always want to have a mask
|
||||
if( aMask.IsEmpty() )
|
||||
{
|
||||
aMask = Bitmap( aSrcRect.GetSize(), 1 );
|
||||
aMask = Bitmap(aSrcRect.GetSize(), vcl::PixelFormat::N1_BPP);
|
||||
aMask.Erase( COL_BLACK );
|
||||
}
|
||||
|
||||
|
||||
@@ -465,7 +465,7 @@ void GraphicObject::ImplTransformBitmap( BitmapEx& rBmpEx,
|
||||
else
|
||||
{
|
||||
// #104115# Generate mask bitmap and init to zero
|
||||
Bitmap aMask( aBmpSize, 1 );
|
||||
Bitmap aMask(aBmpSize, vcl::PixelFormat::N1_BPP);
|
||||
aMask.Erase( Color(0,0,0) );
|
||||
|
||||
// #104115# Always generate transparent bitmap, we need the border transparent
|
||||
|
||||
@@ -265,19 +265,24 @@ namespace vcl::unotools
|
||||
sizeFromIntegerSize2D(xInputBitmap->getSize()));
|
||||
|
||||
// normalize bitcount
|
||||
nDepth =
|
||||
( nDepth <= 1 ) ? 1 :
|
||||
( nDepth <= 4 ) ? 4 :
|
||||
( nDepth <= 8 ) ? 8 : 24;
|
||||
auto ePixelFormat =
|
||||
( nDepth <= 1 ) ? vcl::PixelFormat::N1_BPP :
|
||||
( nDepth <= 4 ) ? vcl::PixelFormat::N4_BPP :
|
||||
( nDepth <= 8 ) ? vcl::PixelFormat::N8_BPP :
|
||||
vcl::PixelFormat::N24_BPP;
|
||||
auto eAlphaPixelFormat =
|
||||
( nAlphaDepth <= 1 ) ? vcl::PixelFormat::N1_BPP :
|
||||
( nAlphaDepth <= 4 ) ? vcl::PixelFormat::N4_BPP :
|
||||
vcl::PixelFormat::N8_BPP;
|
||||
|
||||
::Bitmap aBitmap( aPixelSize,
|
||||
sal::static_int_cast<sal_uInt16>(nDepth),
|
||||
ePixelFormat,
|
||||
aLayout.Palette.is() ? &aPalette : nullptr );
|
||||
::Bitmap aAlpha;
|
||||
if( nAlphaDepth )
|
||||
aAlpha = ::Bitmap( aPixelSize,
|
||||
sal::static_int_cast<sal_uInt16>(nAlphaDepth),
|
||||
&::Bitmap::GetGreyPalette(
|
||||
aAlpha = Bitmap(aPixelSize,
|
||||
eAlphaPixelFormat,
|
||||
&Bitmap::GetGreyPalette(
|
||||
sal::static_int_cast<sal_uInt16>(1 << nAlphaDepth)) );
|
||||
|
||||
{ // limit scoped access
|
||||
|
||||
@@ -563,8 +563,8 @@ GLenum OpenGLHelper::OptimalBufferFormat()
|
||||
BitmapEx OpenGLHelper::ConvertBufferToBitmapEx(const sal_uInt8* const pBuffer, tools::Long nWidth, tools::Long nHeight)
|
||||
{
|
||||
assert(pBuffer);
|
||||
Bitmap aBitmap( Size(nWidth, nHeight), 24 );
|
||||
AlphaMask aAlpha( Size(nWidth, nHeight) );
|
||||
Bitmap aBitmap(Size(nWidth, nHeight), vcl::PixelFormat::N24_BPP);
|
||||
AlphaMask aAlpha(Size(nWidth, nHeight));
|
||||
|
||||
{
|
||||
BitmapScopedWriteAccess pWriteAccess( aBitmap );
|
||||
|
||||
@@ -322,7 +322,7 @@ void OutputDevice::DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
|
||||
{
|
||||
if ( mnDrawMode & ( DrawModeFlags::BlackBitmap | DrawModeFlags::WhiteBitmap ) )
|
||||
{
|
||||
Bitmap aColorBmp( aBmpEx.GetSizePixel(), 1 );
|
||||
Bitmap aColorBmp(aBmpEx.GetSizePixel(), vcl::PixelFormat::N1_BPP);
|
||||
sal_uInt8 cCmpVal;
|
||||
|
||||
if ( mnDrawMode & DrawModeFlags::BlackBitmap )
|
||||
@@ -1568,7 +1568,7 @@ Bitmap OutputDevice::BlendBitmapWithAlpha(
|
||||
|
||||
if( GetBitCount() <= 8 )
|
||||
{
|
||||
Bitmap aDither( aBmp.GetSizePixel(), 8 );
|
||||
Bitmap aDither(aBmp.GetSizePixel(), vcl::PixelFormat::N8_BPP);
|
||||
BitmapColor aIndex( 0 );
|
||||
Bitmap::ScopedReadAccess pB(aBmp);
|
||||
BitmapScopedWriteAccess pW(aDither);
|
||||
@@ -1661,7 +1661,7 @@ Bitmap OutputDevice::BlendBitmap(
|
||||
|
||||
if( GetBitCount() <= 8 )
|
||||
{
|
||||
Bitmap aDither( aBmp.GetSizePixel(), 8 );
|
||||
Bitmap aDither(aBmp.GetSizePixel(), vcl::PixelFormat::N8_BPP);
|
||||
BitmapColor aIndex( 0 );
|
||||
Bitmap::ScopedReadAccess pB(aBmp);
|
||||
BitmapScopedWriteAccess pW(aDither);
|
||||
|
||||
@@ -946,7 +946,7 @@ BitmapChecksum PDFiumPageImpl::getChecksum(int nMDPPerm)
|
||||
FPDF_RenderPageBitmap(pPdfBitmap->getPointer(), mpPage, /*start_x=*/0, /*start_y=*/0,
|
||||
nPageWidth, nPageHeight,
|
||||
/*rotate=*/0, nFlags);
|
||||
Bitmap aBitmap(Size(nPageWidth, nPageHeight), 24);
|
||||
Bitmap aBitmap(Size(nPageWidth, nPageHeight), vcl::PixelFormat::N24_BPP);
|
||||
{
|
||||
BitmapScopedWriteAccess pWriteAccess(aBitmap);
|
||||
const auto pPdfBuffer
|
||||
|
||||
@@ -105,7 +105,7 @@ void Main()
|
||||
|
||||
MyWin::MyWin( vcl::Window* pParent, WinBits nWinStyle ) :
|
||||
WorkWindow( pParent, nWinStyle ),
|
||||
m_aBitmap( Size( 256, 256 ), 32 )
|
||||
m_aBitmap(Size(256, 256), vcl::PixelFormat::N32_BPP)
|
||||
{
|
||||
// prepare an alpha mask
|
||||
BitmapWriteAccess* pAcc = m_aBitmap.AcquireWriteAccess();
|
||||
|
||||
@@ -855,7 +855,7 @@ public:
|
||||
aRight.Crop(tools::Rectangle(Point((nSlice * 3) + 3, (nSlice * 2) + 1),
|
||||
Size(nSlice, 1)));
|
||||
AlphaMask aAlphaMask(aRight.GetBitmap());
|
||||
Bitmap aBlockColor(aAlphaMask.GetSizePixel(), 24);
|
||||
Bitmap aBlockColor(aAlphaMask.GetSizePixel(), vcl::PixelFormat::N24_BPP);
|
||||
aBlockColor.Erase(COL_RED);
|
||||
BitmapEx aShadowStretch(aBlockColor, aAlphaMask);
|
||||
|
||||
@@ -874,7 +874,7 @@ public:
|
||||
}
|
||||
|
||||
AlphaMask aWholeMask(aPageShadowMask.GetBitmap());
|
||||
aBlockColor = Bitmap(aPageShadowMask.GetSizePixel(), 24);
|
||||
aBlockColor = Bitmap(aPageShadowMask.GetSizePixel(), vcl::PixelFormat::N24_BPP);
|
||||
aBlockColor.Erase(COL_GREEN);
|
||||
BitmapEx aWhole(aBlockColor, aWholeMask);
|
||||
|
||||
@@ -1300,7 +1300,7 @@ public:
|
||||
Bitmap aWhiteBmp = aWhite->GetBitmap(Point(),aSrc.GetSizePixel());
|
||||
Bitmap aBlackBmp = aBlack->GetBitmap(Point(),aSrc.GetSizePixel());
|
||||
AlphaMask aMask(aSrc.GetSizePixel());
|
||||
Bitmap aRecovered(aSrc.GetSizePixel(), 24);
|
||||
Bitmap aRecovered(aSrc.GetSizePixel(), vcl::PixelFormat::N24_BPP);
|
||||
{
|
||||
AlphaScopedWriteAccess pMaskAcc(aMask);
|
||||
BitmapScopedWriteAccess pRecAcc(aRecovered);
|
||||
|
||||
Reference in New Issue
Block a user