Kaydet (Commit) d4442ac1 authored tarafından Noel Grandin's avatar Noel Grandin

drop Graphic::GetBitmap

so that we flush out various code using Bitmap, in favour of using
BitmapEx.
This is part of the process of making Bitmap largely an internal detail
of vcl

Change-Id: Iaf2ead5e3d9960838723fb55b812b97108093d74
Reviewed-on: https://gerrit.libreoffice.org/55062Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst b7939ff8
......@@ -59,7 +59,7 @@ namespace cppcanvas
GraphicFilter filter;
filter.ImportGraphic(graphic, OUString(), s);
SAL_INFO("cppcanvas.emf", "EMF+\tbitmap width: " << graphic.GetBitmap().GetSizePixel().Width() << " height: " << graphic.GetBitmap().GetSizePixel().Height());
SAL_INFO("cppcanvas.emf", "EMF+\tbitmap width: " << graphic.GetSizePixel().Width() << " height: " << graphic.GetSizePixel().Height());
}
}
......
......@@ -436,7 +436,7 @@ void SvxPersonalizationTabPage::LoadDefaultImages()
INetURLObject aURLObj( gallery + aPreviewFile );
aFilter.ImportGraphic( aGraphic, aURLObj );
Bitmap aBmp = aGraphic.GetBitmap();
BitmapEx aBmp = aGraphic.GetBitmapEx();
m_vDefaultPersonaImages[nIndex]->Show();
m_vDefaultPersonaImages[nIndex++]->SetModeImage( Image( aBmp ) );
}
......@@ -531,7 +531,7 @@ IMPL_LINK_NOARG( SvxPersonalizationTabPage, SelectInstalledPersona, ListBox&, vo
Graphic aGraphic;
INetURLObject aURLObj( aPreviewFile );
aFilter.ImportGraphic( aGraphic, aURLObj );
Bitmap aBmp = aGraphic.GetBitmap();
BitmapEx aBmp = aGraphic.GetBitmapEx();
m_pExtensionPersonaPreview->SetModeImage( Image( aBmp ) );
}
......@@ -781,7 +781,7 @@ void SearchAndParseThread::execute()
// for VCL to be able to create bitmaps / do visual changes in the thread
SolarMutexGuard aGuard;
aFilter.ImportGraphic( aGraphic, aURLObj );
Bitmap aBmp = aGraphic.GetBitmap();
BitmapEx aBmp = aGraphic.GetBitmapEx();
if( !m_bExecute )
return;
......
......@@ -685,7 +685,7 @@ bool SvxBackgroundTabPage::FillItemSet( SfxItemSet* rCoreSet )
{
const Graphic* pGraphic = rOldItem.GetGraphic();
if (pGraphic)
bModifyBrush = pGraphic->GetBitmap() != aBgdGraphic.GetBitmap();
bModifyBrush = pGraphic->GetBitmapEx() != aBgdGraphic.GetBitmapEx();
}
if (bModifyBrush)
{
......@@ -1100,7 +1100,7 @@ IMPL_LINK( SvxBackgroundTabPage, FileClickHdl_Impl, Button*, pBox, void )
if ( bIsGraphicValid )
{
Bitmap aBmp = aBgdGraphic.GetBitmap();
Bitmap aBmp = aBgdGraphic.GetBitmapEx().GetBitmap();
m_pPreviewWin2->NotifyChange( &aBmp );
}
else
......@@ -1208,7 +1208,7 @@ IMPL_LINK( SvxBackgroundTabPage, LoadIdleHdl_Impl, Timer*, pIdle, void )
if ( m_pBtnPreview->IsChecked() && bIsGraphicValid )
{
Bitmap aBmp = aBgdGraphic.GetBitmap();
Bitmap aBmp = aBgdGraphic.GetBitmapEx().GetBitmap();
m_pPreviewWin2->NotifyChange( &aBmp );
}
else
......@@ -1415,7 +1415,7 @@ void SvxBackgroundTabPage::FillControls_Impl( const SvxBrushItem& rBgdAttr,
if ( m_pBtnPreview->IsChecked() && bIsGraphicValid )
{
Bitmap aBmp = aBgdGraphic.GetBitmap();
Bitmap aBmp = aBgdGraphic.GetBitmapEx().GetBitmap();
m_pPreviewWin2->NotifyChange( &aBmp );
}
else
......
......@@ -236,8 +236,7 @@ void SvxGrfCropPage::Reset( const SfxItemSet *rSet )
aOrigSize = GetGrfOrigSize( *pGrf );
if (pGrf->GetType() == GraphicType::Bitmap && aOrigSize.Width() && aOrigSize.Height())
{
Bitmap aBitmap = pGrf->GetBitmap();
aOrigPixelSize = aBitmap.GetSizePixel();
aOrigPixelSize = pGrf->GetSizePixel();
}
if( aOrigSize.Width() && aOrigSize.Height() )
......@@ -386,8 +385,7 @@ void SvxGrfCropPage::ActivatePage(const SfxItemSet& rSet)
m_pExampleWN->SetGraphic( *pGrf );
aOrigSize = GetGrfOrigSize( *pGrf );
if (pGrf->GetType() == GraphicType::Bitmap && aOrigSize.Width() > 1 && aOrigSize.Height() > 1) {
Bitmap aBitmap = pGrf->GetBitmap();
aOrigPixelSize = aBitmap.GetSizePixel();
aOrigPixelSize = pGrf->GetSizePixel();
}
m_pExampleWN->SetFrameSize(aOrigSize);
GraphicHasChanged( aOrigSize.Width() && aOrigSize.Height() );
......
......@@ -2007,7 +2007,7 @@ IMPL_LINK_NOARG(SvxNumOptionsTabPage, PopupActivateHdl_Impl, MenuButton *, void)
if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, i, &aGraphic))
{
Bitmap aBitmap(aGraphic.GetBitmap());
BitmapEx aBitmap(aGraphic.GetBitmapEx());
Size aSize(aBitmap.GetSizePixel());
if(aSize.Width() > MAX_BMP_WIDTH ||
aSize.Height() > MAX_BMP_HEIGHT)
......
......@@ -310,7 +310,7 @@ void SvxLineTabPage::InitSymbols(MenuButton const * pButton)
if(pGraphic)
{
Bitmap aBitmap(pGraphic->GetBitmap());
BitmapEx aBitmap(pGraphic->GetBitmapEx());
Size aSize(aBitmap.GetSizePixel());
if(aSize.Width() > MAX_BMP_WIDTH || aSize.Height() > MAX_BMP_HEIGHT)
{
......
......@@ -38,7 +38,7 @@ namespace emfplushelper
// non native formats
GraphicFilter filter;
filter.ImportGraphic(graphic, OUString(), s);
SAL_INFO("drawinglayer", "EMF+\tbitmap width: " << graphic.GetBitmap().GetSizePixel().Width() << " height: " << graphic.GetBitmap().GetSizePixel().Height());
SAL_INFO("drawinglayer", "EMF+\tbitmap width: " << graphic.GetSizePixel().Width() << " height: " << graphic.GetSizePixel().Height());
}
}
else if (ImageDataTypeMetafile == type)
......
......@@ -656,7 +656,7 @@ bool FlashExporter::getMetaFile( Reference< XComponent > const &xComponent, GDIM
GraphicFilter aFilter(false);
aFilter.ImportGraphic( aGraphic, aFile.GetURL(), *aFile.GetStream( StreamMode::READ ) );
BitmapEx rBitmapEx( aGraphic.GetBitmap(), Color(255,255,255) );
BitmapEx rBitmapEx( aGraphic.GetBitmapEx().GetBitmap(), Color(255,255,255) );
tools::Rectangle clipRect;
for( size_t i = 0, nCount = rMtf.GetActionSize(); i < nCount; i++ )
......
......@@ -136,12 +136,7 @@ bool GIFWriter::WriteGIF(const Graphic& rGraphic, FilterConfigItem* pFilterConfi
{
const bool bGrafTrans = rGraphic.IsTransparent();
BitmapEx aBmpEx;
if( bGrafTrans )
aBmpEx = rGraphic.GetBitmapEx();
else
aBmpEx = BitmapEx( rGraphic.GetBitmap() );
BitmapEx aBmpEx = rGraphic.GetBitmapEx();
nMinPercent = 0;
nMaxPercent = 100;
......
......@@ -382,11 +382,11 @@ bool PSWriter::WritePS( const Graphic& rGraphic, SvStream& rTargetStream, Filter
}
else
{
Bitmap aBmp( rGraphic.GetBitmap() );
BitmapEx aBmp( rGraphic.GetBitmapEx() );
pAMTF.reset( new GDIMetaFile );
ScopedVclPtrInstance< VirtualDevice > pTmpVDev;
pAMTF->Record( pTmpVDev );
pTmpVDev->DrawBitmap( Point(), aBmp );
pTmpVDev->DrawBitmapEx( Point(), aBmp );
pAMTF->Stop();
pAMTF->SetPrefSize( aBmp.GetSizePixel() );
pMTF = pAMTF.get();
......@@ -478,7 +478,7 @@ void PSWriter::ImplWriteProlog( const Graphic* pPreview )
if ( pPreview && aSizePoint.Width() && aSizePoint.Height() )
{
Size aSizeBitmap( ( aSizePoint.Width() + 7 ) & ~7, aSizePoint.Height() );
Bitmap aTmpBitmap( pPreview->GetBitmap() );
Bitmap aTmpBitmap( pPreview->GetBitmapEx().GetBitmap() );
aTmpBitmap.Scale( aSizeBitmap, BmpScaleFlag::BestQuality );
aTmpBitmap.Convert( BmpConversion::N1BitThreshold );
BitmapReadAccess* pAcc = aTmpBitmap.AcquireReadAccess();
......
......@@ -130,19 +130,18 @@ static void MakeAsMeta(Graphic &rGraphic)
{
ScopedVclPtrInstance< VirtualDevice > pVDev;
GDIMetaFile aMtf;
Bitmap aBmp( rGraphic.GetBitmap() );
Size aSize = aBmp.GetPrefSize();
Size aSize = rGraphic.GetPrefSize();
if( !aSize.Width() || !aSize.Height() )
aSize = Application::GetDefaultDevice()->PixelToLogic(
aBmp.GetSizePixel(), MapMode(MapUnit::Map100thMM));
rGraphic.GetSizePixel(), MapMode(MapUnit::Map100thMM));
else
aSize = OutputDevice::LogicToLogic( aSize,
aBmp.GetPrefMapMode(), MapMode(MapUnit::Map100thMM));
rGraphic.GetPrefMapMode(), MapMode(MapUnit::Map100thMM));
pVDev->EnableOutput( false );
aMtf.Record( pVDev );
pVDev->DrawBitmap( Point(), aSize, rGraphic.GetBitmap() );
pVDev->DrawBitmapEx( Point(), aSize, rGraphic.GetBitmapEx() );
aMtf.Stop();
aMtf.WindStart();
aMtf.SetPrefMapMode(MapMode(MapUnit::Map100thMM));
......
......@@ -1351,7 +1351,7 @@ void DffPropertyReader::ApplyFillAttributes( SvStream& rIn, SfxItemSet& rSet, co
{
if ( eMSO_FillType == mso_fillPattern )
{
Bitmap aBmp( aGraf.GetBitmap() );
Bitmap aBmp( aGraf.GetBitmapEx().GetBitmap() );
if( aBmp.GetSizePixel().Width() == 8 && aBmp.GetSizePixel().Height() == 8 && aBmp.GetColorCount() == 2)
{
Color aCol1( COL_WHITE ), aCol2( COL_WHITE );
......
......@@ -5685,7 +5685,7 @@ void PPTPortionObj::ApplyTo( SfxItemSet& rSet, SdrPowerPointImport& rManager, T
Graphic aGraf;
if ( rManager.GetBLIP( rManager.GetPropertyValue( DFF_Prop_fillBlip, 0 ), aGraf ) )
{
Bitmap aBmp( aGraf.GetBitmap() );
Bitmap aBmp( aGraf.GetBitmapEx().GetBitmap() );
Size aSize( aBmp.GetSizePixel() );
if ( aSize.Width() && aSize.Height() )
{
......
......@@ -54,16 +54,17 @@ bool VCL_DLLPUBLIC ReadDIBV5(
SvStream& rIStm);
bool VCL_DLLPUBLIC WriteDIB( // WriteDIB(rBitmap, rOStm, false, true);
bool VCL_DLLPUBLIC WriteDIB(
const Bitmap& rSource,
SvStream& rOStm,
bool bCompressed,
bool bFileHeader);
// compressed, with file header
bool VCL_DLLPUBLIC WriteDIB( // WriteDIB(rBitmap, rOStm, false, true);
bool VCL_DLLPUBLIC WriteDIB(
const BitmapEx& rSource,
SvStream& rOStm);
SvStream& rOStm,
bool bCompressed = true);
bool VCL_DLLPUBLIC WriteDIBBitmapEx(
const BitmapEx& rSource,
......
......@@ -152,7 +152,6 @@ public:
// allow giving parameters which control AntiAliasing and LineSnapping of the
// MetaFile when played. Defaults will use a no-AAed, not snapped conversion as
// before.
Bitmap GetBitmap(const GraphicConversionParameters& rParameters = GraphicConversionParameters()) const;
BitmapEx GetBitmapEx(const GraphicConversionParameters& rParameters = GraphicConversionParameters()) const;
/// Gives direct access to the contained BitmapEx.
const BitmapEx& GetBitmapExRef() const;
......
......@@ -401,7 +401,7 @@ XclExpImgData::XclExpImgData( const Graphic& rGraphic, sal_uInt16 nRecId ) :
void XclExpImgData::Save( XclExpStream& rStrm )
{
Bitmap aBmp = maGraphic.GetBitmap();
Bitmap aBmp = maGraphic.GetBitmapEx().GetBitmap();
if( aBmp.GetBitCount() != 24 )
aBmp.Convert( BmpConversion::N24Bit );
......
......@@ -623,7 +623,7 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, SelectHdl, weld::TreeView&, void)
m_pGraphicFilter->ImportGraphic( aGraphic, aURLObj, nFilter, nullptr, nFilterImportFlags );
}
Bitmap aBmp = aGraphic.GetBitmap();
BitmapEx aBmp = aGraphic.GetBitmapEx();
sal_Int32 nBmpWidth = aBmp.GetSizePixel().Width();
sal_Int32 nBmpHeight = aBmp.GetSizePixel().Height();
......
......@@ -62,7 +62,9 @@ void FuVectorize::DoExecute( SfxRequest& )
if( pObj && dynamic_cast< const SdrGrafObj *>( pObj ) != nullptr )
{
SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
ScopedVclPtr<AbstractSdVectorizeDlg> pDlg(pFact ? pFact->CreateSdVectorizeDlg(mpWindow ? mpWindow->GetFrameWeld() : nullptr, static_cast<SdrGrafObj*>( pObj )->GetGraphic().GetBitmap(), mpDocSh ) : nullptr);
ScopedVclPtr<AbstractSdVectorizeDlg> pDlg(
pFact->CreateSdVectorizeDlg(mpWindow ? mpWindow->GetFrameWeld() : nullptr,
static_cast<SdrGrafObj*>( pObj )->GetGraphic().GetBitmapEx().GetBitmap(), mpDocSh ) );
if( pDlg && pDlg->Execute() == RET_OK )
{
const GDIMetaFile& rMtf = pDlg->GetGDIMetaFile();
......
......@@ -690,7 +690,7 @@ IMPL_LINK_NOARG(FileDialogHelper_Impl, TimeOutHdl_Impl, Timer *, void)
// is responsible for placing it at its
// proper position and painting a frame
Bitmap aBmp = maGraphic.GetBitmap();
BitmapEx aBmp = maGraphic.GetBitmapEx();
if ( !aBmp.IsEmpty() )
{
// scale the bitmap to the correct size
......@@ -713,7 +713,7 @@ IMPL_LINK_NOARG(FileDialogHelper_Impl, TimeOutHdl_Impl, Timer *, void)
// and copy it into the Any
SvMemoryStream aData;
WriteDIB(aBmp, aData, false, true);
WriteDIB(aBmp, aData, false);
const Sequence < sal_Int8 > aBuffer(
static_cast< const sal_Int8* >(aData.GetData()),
......
......@@ -517,14 +517,14 @@ void ExportDialog::GetGraphicStream()
}
}
Bitmap ExportDialog::GetGraphicBitmap( SvStream& rInputStream )
BitmapEx ExportDialog::GetGraphicBitmap( SvStream& rInputStream )
{
Bitmap aRet;
BitmapEx aRet;
Graphic aGraphic;
GraphicFilter aFilter( false );
if ( aFilter.ImportGraphic( aGraphic, "", rInputStream, GRFILTER_FORMAT_NOTFOUND, nullptr, GraphicFilterImportFlags::NONE, static_cast<css::uno::Sequence< css::beans::PropertyValue >*>(nullptr) ) == ERRCODE_NONE )
{
aRet = aGraphic.GetBitmap();
aRet = aGraphic.GetBitmapEx();
}
return aRet;
}
......
......@@ -119,7 +119,7 @@ private:
sal_Int32 mnMaxFilesizeForRealtimePreview;
std::unique_ptr<SvMemoryStream> mpTempStream;
Bitmap maBitmap;
BitmapEx maBitmap;
css::awt::Size maOriginalSize; // the original graphic size in 1/100mm
css::awt::Size maSize; // for vector graphics it always contains the logical size in 1/100mm
......@@ -158,7 +158,7 @@ private:
void GetGraphicSource();
void GetGraphicStream();
static Bitmap GetGraphicBitmap( SvStream& rStream );
static BitmapEx GetGraphicBitmap( SvStream& rStream );
css::uno::Sequence< css::beans::PropertyValue >
GetFilterData( bool bUpdateConfig );
......
......@@ -828,7 +828,7 @@ GDIMetaFile SvxBmpMask::ImpMask( const GDIMetaFile& rMtf )
case MetaActionType::BMP:
{
MetaBmpAction* pAct = static_cast<MetaBmpAction*>(pAction);
const Bitmap aBmp( Mask( pAct->GetBitmap() ).GetBitmap() );
const Bitmap aBmp( Mask( pAct->GetBitmap() ).GetBitmapEx().GetBitmap() );
pAct = new MetaBmpAction( pAct->GetPoint(), aBmp );
aMtf.AddAction( pAct );
......@@ -838,7 +838,7 @@ GDIMetaFile SvxBmpMask::ImpMask( const GDIMetaFile& rMtf )
case MetaActionType::BMPSCALE:
{
MetaBmpScaleAction* pAct = static_cast<MetaBmpScaleAction*>(pAction);
const Bitmap aBmp( Mask( pAct->GetBitmap() ).GetBitmap() );
const Bitmap aBmp( Mask( pAct->GetBitmap() ).GetBitmapEx().GetBitmap() );
pAct = new MetaBmpScaleAction( pAct->GetPoint(), pAct->GetSize(), aBmp );
aMtf.AddAction( pAct );
......@@ -848,7 +848,7 @@ GDIMetaFile SvxBmpMask::ImpMask( const GDIMetaFile& rMtf )
case MetaActionType::BMPSCALEPART:
{
MetaBmpScalePartAction* pAct = static_cast<MetaBmpScalePartAction*>(pAction);
const Bitmap aBmp( Mask( pAct->GetBitmap() ).GetBitmap() );
const Bitmap aBmp( Mask( pAct->GetBitmap() ).GetBitmapEx().GetBitmap() );
pAct = new MetaBmpScalePartAction( pAct->GetDestPoint(), pAct->GetDestSize(),
pAct->GetSrcPoint(), pAct->GetSrcSize(), aBmp );
......@@ -1025,7 +1025,7 @@ Graphic SvxBmpMask::Mask( const Graphic& rGraphic )
}
// now replace it again with the normal colors
Bitmap aBitmap( ImpMask( aGraphic.GetBitmap() ) );
Bitmap aBitmap( ImpMask( aGraphic.GetBitmapEx().GetBitmap() ) );
Size aSize( aBitmap.GetSizePixel() );
if ( aSize.Width() && aSize.Height() )
......
......@@ -140,7 +140,7 @@ tools::PolyPolygon SvxContourDlg::CreateAutoContour( const Graphic& rGraphic,
aBmp = rGraphic.GetBitmapEx().GetMask();
else
{
aBmp = rGraphic.GetBitmap();
aBmp = rGraphic.GetBitmapEx().GetBitmap();
nContourFlags |= XOutFlags::ContourEdgeDetect;
}
}
......@@ -689,7 +689,7 @@ IMPL_LINK( SvxSuperContourDlg, PipetteClickHdl, ContourWindow&, rWnd, void )
if( aGraphic.GetType() == GraphicType::Bitmap )
{
Bitmap aBmp( aGraphic.GetBitmap() );
Bitmap aBmp( aGraphic.GetBitmapEx().GetBitmap() );
const long nTol = static_cast<long>(m_pMtfTolerance->GetValue() * 255L / 100L);
aMask = aBmp.CreateMask( rColor, nTol );
......
......@@ -670,7 +670,7 @@ sal_uInt16 OutlineTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 /*m
const Graphic* pGrf2 = pBrsh2->GetGraphic();
if (pGrf1==pGrf2) bIsMatch = true;
if (pGrf1 && pGrf2) {
if ( pGrf1->GetBitmap() == pGrf2->GetBitmap() &&
if ( pGrf1->GetBitmapEx() == pGrf2->GetBitmapEx() &&
_pSet->aSize == aFmt.GetGraphicSize())
bIsMatch = true;
}
......
......@@ -247,7 +247,7 @@ namespace {
aDrawinglayerOpt.IsSnapHorVerLinesToDiscrete());
const Graphic aGraphic(rMtf);
aBmpEx = BitmapEx(aGraphic.GetBitmap(aParameters));
aBmpEx = aGraphic.GetBitmapEx(aParameters);
aBmpEx.SetPrefMapMode( rMtf.GetPrefMapMode() );
aBmpEx.SetPrefSize( rMtf.GetPrefSize() );
}
......
......@@ -96,20 +96,9 @@ Graphic XOutBitmap::MirrorGraphic( const Graphic& rGraphic, const BmpMirrorFlags
}
else
{
if( rGraphic.IsTransparent() )
{
BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
aBmpEx.Mirror( nMirrorFlags );
aRetGraphic = aBmpEx;
}
else
{
Bitmap aBmp( rGraphic.GetBitmap() );
aBmp.Mirror( nMirrorFlags );
aRetGraphic = aBmp;
}
BitmapEx aBmp( rGraphic.GetBitmapEx() );
aBmp.Mirror( nMirrorFlags );
aRetGraphic = aBmp;
}
}
else
......@@ -322,10 +311,10 @@ ErrCode XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileName,
aGraphic = pVDev->GetBitmap( Point(), aSize );
}
else
aGraphic = rGraphic.GetBitmap();
aGraphic = rGraphic.GetBitmapEx();
}
else
aGraphic = rGraphic.GetBitmap();
aGraphic = rGraphic.GetBitmapEx();
}
// mirror?
......
......@@ -989,7 +989,10 @@ inline void assertBorderEqual(
inline std::ostream& operator<<(std::ostream& rStrm, const Color& rColor)
{
rStrm << "Color: R:" << static_cast<int>(rColor.GetRed()) << " G:" << static_cast<int>(rColor.GetGreen()) << " B: " << static_cast<int>(rColor.GetBlue());
rStrm << "Color: R:" << static_cast<int>(rColor.GetRed())
<< " G:" << static_cast<int>(rColor.GetGreen())
<< " B:" << static_cast<int>(rColor.GetBlue())
<< " A:" << static_cast<int>(rColor.GetTransparency());
return rStrm;
}
......
......@@ -359,14 +359,12 @@ DECLARE_OOXMLEXPORT_TEST(testPictureWithSchemeColor, "picture-with-schemecolor.d
uno::Reference<beans::XPropertySet> xImage(getShape(1), uno::UNO_QUERY);
uno::Reference<graphic::XGraphic> xGraphic = getProperty<uno::Reference<graphic::XGraphic> >(xImage, "Graphic");
Graphic aVclGraphic(xGraphic);
Bitmap aBitmap(aVclGraphic.GetBitmap());
Bitmap::ScopedReadAccess pAccess(aBitmap);
CPPUNIT_ASSERT(pAccess);
CPPUNIT_ASSERT_EQUAL(341L, pAccess->Width());
CPPUNIT_ASSERT_EQUAL(181L, pAccess->Height());
Color aColor(pAccess->GetPixel(30, 120).GetColor());
BitmapEx aBitmap(aVclGraphic.GetBitmapEx());
CPPUNIT_ASSERT_EQUAL(341L, aBitmap.GetSizePixel().Width());
CPPUNIT_ASSERT_EQUAL(181L, aBitmap.GetSizePixel().Height());
Color aColor(aBitmap.GetPixelColor(120, 30));
CPPUNIT_ASSERT_EQUAL(aColor, Color( 0xb1, 0xc8, 0xdd ));
aColor = pAccess->GetPixel(130, 260).GetColor();
aColor = aBitmap.GetPixelColor(260, 130);
CPPUNIT_ASSERT_EQUAL(aColor, Color( 0xb1, 0xc8, 0xdd ));
}
......@@ -537,13 +535,11 @@ DECLARE_OOXMLEXPORT_TEST(testMsoBrightnessContrast, "msobrightnesscontrast.docx"
imageProperties->getPropertyValue( "Graphic" ) >>= graphic;
uno::Reference<awt::XBitmap> bitmap(graphic, uno::UNO_QUERY);
Graphic aVclGraphic(graphic);
Bitmap aBitmap(aVclGraphic.GetBitmap());
Bitmap::ScopedReadAccess pAccess(aBitmap);
CPPUNIT_ASSERT(pAccess);
CPPUNIT_ASSERT_EQUAL(58L, pAccess->Width());
CPPUNIT_ASSERT_EQUAL(320L, pAccess->Height());
Color aColor(pAccess->GetPixel(30, 20).GetColor());
CPPUNIT_ASSERT_EQUAL(aColor, Color( 0xce, 0xce, 0xce ));
BitmapEx aBitmap(aVclGraphic.GetBitmapEx());
CPPUNIT_ASSERT_EQUAL(58L, aBitmap.GetSizePixel().Width());
CPPUNIT_ASSERT_EQUAL(320L, aBitmap.GetSizePixel().Height());
Color aColor(aBitmap.GetPixelColor(20, 30));
CPPUNIT_ASSERT_EQUAL(Color( 255, 0xce, 0xce, 0xce ), aColor);
}
DECLARE_OOXMLEXPORT_TEST(testChartSize, "chart-size.docx")
......
......@@ -797,7 +797,7 @@ int SwTransferable::PrepareForCopy( bool bIsCut )
SwDoc *const pDoc = lcl_GetDoc(*m_pClpDocFac);
m_pWrtShell->Copy( pDoc );
if (m_pOrigGraphic && !m_pOrigGraphic->GetBitmap().IsEmpty())
if (m_pOrigGraphic && !m_pOrigGraphic->GetBitmapEx().IsEmpty())
AddFormat( SotClipboardFormatId::SVXB );
PrepareOLE( m_aObjDesc );
......
......@@ -825,7 +825,7 @@ static Graphic ImpGetScaledGraphic( const Graphic& rGraphic, FilterConfigItem& r
// Resolution is set
if( nMode == 1 )
{
Bitmap aBitmap( rGraphic.GetBitmap() );
BitmapEx aBitmap( rGraphic.GetBitmapEx() );
MapMode aMap( MapUnit::Map100thInch );
sal_Int32 nDPI = rConfigItem.ReadInt32( "Resolution", 75 );
......@@ -2213,16 +2213,16 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r
{
if( aFilterName.equalsIgnoreAsciiCase( EXP_BMP ) )
{
Bitmap aBmp( aGraphic.GetBitmap() );
BitmapEx aBmp( aGraphic.GetBitmapEx() );
BmpConversion nColorRes = static_cast<BmpConversion>(aConfigItem.ReadInt32( "Colors", 0 ));
if ( nColorRes != BmpConversion::NNONE && ( nColorRes <= BmpConversion::N24Bit) )
{
if( !aBmp.Convert( nColorRes ) )
aBmp = aGraphic.GetBitmap();
aBmp = aGraphic.GetBitmapEx();
}
bool bRleCoding = aConfigItem.ReadBool( "RLE_Coding", true );
// save RLE encoded?
WriteDIB(aBmp, rOStm, bRleCoding, true);
WriteDIB(aBmp, rOStm, bRleCoding);
if( rOStm.GetError() )
nStatus = ERRCODE_GRFILTER_IOERROR;
......
......@@ -190,12 +190,12 @@ bool JPEGWriter::Write( const Graphic& rGraphic )
mxStatusIndicator->start( OUString(), 100 );
}
Bitmap aGraphicBmp( rGraphic.GetBitmap() );
Bitmap aGraphicBmp( rGraphic.GetBitmapEx().GetBitmap() );
if ( mbGreys )
{
if ( !aGraphicBmp.Convert( BmpConversion::N8BitGreys ) )
aGraphicBmp = rGraphic.GetBitmap();
aGraphicBmp = rGraphic.GetBitmapEx().GetBitmap();
}
mpReadAccess = Bitmap::ScopedReadAccess(aGraphicBmp);
......
......@@ -1830,9 +1830,10 @@ bool WriteDIB(
bool WriteDIB(
const BitmapEx& rSource,
SvStream& rOStm)
SvStream& rOStm,
bool bCompressed)
{
return ImplWriteDIB(rSource.GetBitmapRef(), rOStm, /*bCompressed*/true, /*bFileHeader*/true);
return ImplWriteDIB(rSource.GetBitmapRef(), rOStm, bCompressed, /*bFileHeader*/true);
}
bool WriteDIBBitmapEx(
......
......@@ -348,11 +348,6 @@ bool Graphic::IsEPS() const
return mxImpGraphic->ImplIsEPS();
}
Bitmap Graphic::GetBitmap(const GraphicConversionParameters& rParameters) const
{
return mxImpGraphic->ImplGetBitmap(rParameters);
}
BitmapEx Graphic::GetBitmapEx(const GraphicConversionParameters& rParameters) const
{
return mxImpGraphic->ImplGetBitmapEx(rParameters);
......
......@@ -481,7 +481,7 @@ bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIMtfAc
}
}
rWriter.DrawJPGBitmap( aTmp, aGraphic.GetBitmap().GetBitCount() > 8, aGraphic.GetSizePixel(), aOutputRect, aMask, aGraphic );
rWriter.DrawJPGBitmap( aTmp, aGraphic.GetBitmapEx().GetBitCount() > 8, aGraphic.GetSizePixel(), aOutputRect, aMask, aGraphic );
}
if ( bClippingNeeded )
......
......@@ -9750,7 +9750,7 @@ void PDFWriterImpl::createEmbeddedFile(const Graphic& rGraphic, ReferenceXObject
rEmit.m_aPDFData = rGraphic.getPdfData();
rEmit.m_nFormObject = createObject();
rEmit.m_aPixelSize = rGraphic.GetBitmap().GetPrefSize();
rEmit.m_aPixelSize = rGraphic.GetPrefSize();
}
void PDFWriterImpl::drawJPGBitmap( SvStream& rDCTData, bool bIsTrueColor, const Size& rSizePixel, const tools::Rectangle& rTargetArea, const Bitmap& rMask, const Graphic& rGraphic )
......@@ -9773,14 +9773,14 @@ void PDFWriterImpl::drawJPGBitmap( SvStream& rDCTData, bool bIsTrueColor, const
// load stream to bitmap and draw the bitmap instead
Graphic aGraphic;
GraphicConverter::Import( rDCTData, aGraphic, ConvertDataFormat::JPG );
Bitmap aBmp( aGraphic.GetBitmap() );
if( !!rMask && rMask.GetSizePixel() == aBmp.GetSizePixel() )
if( !!rMask && rMask.GetSizePixel() == aGraphic.GetSizePixel() )
{
Bitmap aBmp( aGraphic.GetBitmapEx().GetBitmap() );
BitmapEx aBmpEx( aBmp, rMask );
drawBitmap( rTargetArea.TopLeft(), rTargetArea.GetSize(), aBmpEx );
}
else
drawBitmap( rTargetArea.TopLeft(), rTargetArea.GetSize(), BitmapEx(aBmp) );
drawBitmap( rTargetArea.TopLeft(), rTargetArea.GetSize(), aGraphic.GetBitmapEx() );
return;
}
......
......@@ -1962,12 +1962,12 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile const & r
case MetaActionType::BMPEX:
{
const MetaBmpExAction* pAct = static_cast<const MetaBmpExAction*>(pAction);
const Bitmap aBmp( Graphic( pAct->GetBitmapEx() ).GetBitmap() );
const BitmapEx aBmp( pAct->GetBitmapEx() );
rOStm.WriteInt16( GDI_BITMAP_ACTION );
rOStm.WriteInt32( 12 );
WritePair( rOStm, pAct->GetPoint() );
WriteDIB(aBmp, rOStm, false, true);
WriteDIB(aBmp, rOStm, false);
nCount++;
}
break;
......@@ -1975,13 +1975,13 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile const & r
case MetaActionType::BMPEXSCALE:
{
const MetaBmpExScaleAction* pAct = static_cast<const MetaBmpExScaleAction*>(pAction);
const Bitmap aBmp( Graphic( pAct->GetBitmapEx() ).GetBitmap() );
const BitmapEx aBmp( pAct->GetBitmapEx() );
rOStm.WriteInt16( GDI_BITMAPSCALE_ACTION );
rOStm.WriteInt32( 20 );
WritePair( rOStm, pAct->GetPoint() );
WritePair( rOStm, pAct->GetSize() );
WriteDIB(aBmp, rOStm, false, true);
WriteDIB(aBmp, rOStm, false);
nCount++;
}
break;
......@@ -1989,7 +1989,7 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile const & r
case MetaActionType::BMPEXSCALEPART:
{
const MetaBmpExScalePartAction* pAct = static_cast<const MetaBmpExScalePartAction*>(pAction);
const Bitmap aBmp( Graphic( pAct->GetBitmapEx() ).GetBitmap() );
const BitmapEx aBmp( pAct->GetBitmapEx() );
rOStm.WriteInt16( GDI_BITMAPSCALEPART_ACTION );
rOStm.WriteInt32( 36 );
......@@ -1997,7 +1997,7 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile const & r
WritePair( rOStm, pAct->GetDestSize() );
WritePair( rOStm, pAct->GetSrcPoint() );
WritePair( rOStm, pAct->GetSrcSize() );
WriteDIB(aBmp, rOStm, false, true);
WriteDIB(aBmp, rOStm, false);
nCount++;
}
break;
......
......@@ -681,12 +681,7 @@ void ImplApplyFilterData( ::Graphic& rGraphic, uno::Sequence< beans::PropertyVal
ImplApplyBitmapResolution( aGraphic, nImageResolution,
aGraphic.GetSizePixel(), awt::Size( aSize100thmm2.Width(), aSize100thmm2.Height() ) );
rtl::Reference<MetaAction> pNewAction;
if ( pAction->GetType() == MetaActionType::BMPSCALE )
pNewAction = new MetaBmpScaleAction ( aPos, aSize, aGraphic.GetBitmap() );
else
pNewAction = new MetaBmpExScaleAction( aPos, aSize, aGraphic.GetBitmapEx() );