diff options
Diffstat (limited to 'filter/source/graphicfilter')
-rw-r--r-- | filter/source/graphicfilter/eos2met/eos2met.cxx | 79 | ||||
-rw-r--r-- | filter/source/graphicfilter/epict/epict.cxx | 24 | ||||
-rw-r--r-- | filter/source/graphicfilter/eps/eps.cxx | 25 |
3 files changed, 101 insertions, 27 deletions
diff --git a/filter/source/graphicfilter/eos2met/eos2met.cxx b/filter/source/graphicfilter/eos2met/eos2met.cxx index 1c34d7a28d09..8d1fd7449300 100644 --- a/filter/source/graphicfilter/eos2met/eos2met.cxx +++ b/filter/source/graphicfilter/eos2met/eos2met.cxx @@ -45,8 +45,10 @@ #include <vcl/virdev.hxx> #include <vcl/svapp.hxx> #include <vcl/msgbox.hxx> +#include <vcl/rendergraphicrasterizer.hxx> #include <svl/solar.hrc> + // -----------------------------Feld-Typen------------------------------- #define BegDocumnMagic 0xA8A8 /* Begin Document */ @@ -165,6 +167,9 @@ private: sal_uLong nWrittenBitmaps; // Anzahl der bereits geschriebenen Bitmaps sal_uLong nActBitmapPercent; // Wieviel Prozent die naechste Bitmap schon geschrieben ist. + ::std::auto_ptr< VirtualDevice > apDummyVDev; + OutputDevice* pCompDev; + com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator; void MayCallback(); @@ -204,7 +209,7 @@ private: void METSetAndPushLineInfo( const LineInfo& rLineInfo ); void METPopLineInfo( const LineInfo& rLineInfo ); - void METBitBlt(Point aPt, Size aSize, const Bitmap & rBitmap); + void METBitBlt(Point aPt, Size aSize, const Size& rSizePixel); void METBeginArea(sal_Bool bBoundaryLine); void METEndArea(); void METBeginPath(sal_uInt32 nPathId); @@ -243,7 +248,18 @@ private: public: - METWriter() {} + METWriter() : + pCompDev( NULL ) + { +#ifndef NO_GETAPPWINDOW + pCompDev = reinterpret_cast< OutputDevice* >( Application::GetAppWindow() ); +#endif + if( !pCompDev ) + { + apDummyVDev.reset( new VirtualDevice ); + pCompDev = apDummyVDev.get(); + } + } sal_Bool WriteMET( const GDIMetaFile & rMTF, SvStream & rTargetStream, FilterConfigItem* pConfigItem ); @@ -312,6 +328,7 @@ void METWriter::CountActionsAndBitmaps(const GDIMetaFile * pMTF) case META_BMPEX_ACTION: case META_BMPEXSCALE_ACTION: case META_BMPEXSCALEPART_ACTION: + case META_RENDERGRAPHIC_ACTION: nNumberOfBitmaps++; break; } @@ -335,7 +352,7 @@ void METWriter::WriteBigEndianLong(sal_uLong nLong) void METWriter::WritePoint(Point aPt) { - Point aNewPt = OutputDevice::LogicToLogic( aPt, aPictureMapMode, aTargetMapMode ); + Point aNewPt = pCompDev->LogicToLogic( aPt, aPictureMapMode, aTargetMapMode ); *pMET << (long) ( aNewPt.X() - aPictureRect.Left() ) << (long) ( aPictureRect.Bottom() - aNewPt.Y() ); @@ -784,6 +801,17 @@ void METWriter::WriteImageObjects(const GDIMetaFile * pMTF) } } break; + + case( META_RENDERGRAPHIC_ACTION ): + { + const MetaRenderGraphicAction* pA = (const MetaRenderGraphicAction*) pMA; + const ::vcl::RenderGraphicRasterizer aRasterizer( pA->GetRenderGraphic() ); + const BitmapEx aBmpEx( aRasterizer.Rasterize( pCompDev->LogicToPixel( pA->GetSize() ) ) ); + + METSetMix( eGDIRasterOp ); + WriteImageObject( Graphic( aBmpEx ).GetBitmap() ); + } + break; } if (bStatus==sal_False) @@ -1128,7 +1156,7 @@ void METWriter::WillWriteOrder(sal_uLong nNextOrderMaximumLength) -void METWriter::METBitBlt(Point aPt, Size aSize, const Bitmap & rBitmap) +void METWriter::METBitBlt(Point aPt, Size aSize, const Size& rBmpSizePixel) { WillWriteOrder(46); *pMET << (sal_uInt8)0xd6 << (sal_uInt8)44 << (sal_uInt16)0 << (sal_uInt16) 0x00cc; @@ -1137,13 +1165,13 @@ void METWriter::METBitBlt(Point aPt, Size aSize, const Bitmap & rBitmap) WritePoint(Point(aPt.X(),aPt.Y()+aSize.Height())); WritePoint(Point(aPt.X()+aSize.Width(),aPt.Y())); *pMET << (sal_uInt32)0 << (sal_uInt32)0 - << (sal_uInt32)(rBitmap.GetSizePixel().Width()) - << (sal_uInt32)(rBitmap.GetSizePixel().Height()); + << (sal_uInt32)(rBmpSizePixel.Width()) + << (sal_uInt32)(rBmpSizePixel.Height()); } void METWriter::METSetAndPushLineInfo( const LineInfo& rLineInfo ) { - sal_Int32 nWidth = OutputDevice::LogicToLogic( Size( rLineInfo.GetWidth(),0 ), aPictureMapMode, aTargetMapMode ).Width(); + sal_Int32 nWidth = pCompDev->LogicToLogic( Size( rLineInfo.GetWidth(),0 ), aPictureMapMode, aTargetMapMode ).Width(); WillWriteOrder( 8 ); // set stroke linewidth *pMET << (sal_uInt8)0x15 @@ -1969,10 +1997,11 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF ) case META_BMP_ACTION: { - const MetaBmpAction* pA = (const MetaBmpAction*) pMA; + const MetaBmpAction* pA = (const MetaBmpAction*) pMA; + const Size aSizePixel( pA->GetBitmap().GetSizePixel() ); METSetMix(eGDIRasterOp); - METBitBlt( pA->GetPoint(), pA->GetBitmap().GetSizePixel(), pA->GetBitmap() ); + METBitBlt( pA->GetPoint(), pCompDev->PixelToLogic( aSizePixel, aPictureMapMode ), aSizePixel ); } break; @@ -1981,7 +2010,7 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF ) const MetaBmpScaleAction* pA = (const MetaBmpScaleAction*) pMA; METSetMix(eGDIRasterOp); - METBitBlt( pA->GetPoint(), pA->GetSize(), pA->GetBitmap() ); + METBitBlt( pA->GetPoint(), pA->GetSize(), pA->GetBitmap().GetSizePixel() ); } break; @@ -1992,27 +2021,27 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF ) aTmp.Crop( Rectangle( pA->GetSrcPoint(), pA->GetSrcSize() ) ); METSetMix( eGDIRasterOp ); - METBitBlt( pA->GetDestPoint(), pA->GetDestSize(), aTmp ); + METBitBlt( pA->GetDestPoint(), pA->GetDestSize(), pA->GetBitmap().GetSizePixel() ); } break; case META_BMPEX_ACTION: { const MetaBmpExAction* pA = (const MetaBmpExAction*) pMA; - Bitmap aTmp( Graphic( pA->GetBitmapEx() ).GetBitmap() ); + const Size aSizePixel( pA->GetBitmapEx().GetSizePixel() ); - METSetMix(eGDIRasterOp); - METBitBlt( pA->GetPoint(), aTmp.GetSizePixel(), aTmp ); + METSetMix( eGDIRasterOp ); + METBitBlt( pA->GetPoint(), pCompDev->PixelToLogic( aSizePixel, aPictureMapMode ), aSizePixel ); } break; case META_BMPEXSCALE_ACTION: { const MetaBmpExScaleAction* pA = (const MetaBmpExScaleAction*) pMA; - Bitmap aTmp( Graphic( pA->GetBitmapEx() ).GetBitmap() ); + const Size aSizePixel( pA->GetBitmapEx().GetSizePixel() ); - METSetMix(eGDIRasterOp); - METBitBlt( pA->GetPoint(), pA->GetSize(), aTmp ); + METSetMix( eGDIRasterOp ); + METBitBlt( pA->GetPoint(), pA->GetSize(), aSizePixel ); } break; @@ -2022,8 +2051,8 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF ) Bitmap aTmp( Graphic( pA->GetBitmapEx() ).GetBitmap() ); aTmp.Crop( Rectangle( pA->GetSrcPoint(), pA->GetSrcSize() ) ); - METSetMix(eGDIRasterOp); - METBitBlt( pA->GetDestPoint(), pA->GetDestSize(), aTmp ); + METSetMix( eGDIRasterOp ); + METBitBlt( pA->GetDestPoint(), pA->GetDestSize(), aTmp.GetSizePixel() ); } break; @@ -2040,7 +2069,7 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF ) { const MetaBmpScaleAction* pBmpScaleAction = (const MetaBmpScaleAction*)pMetaAct; METSetMix(eGDIRasterOp); - METBitBlt( pA->GetPoint(), pA->GetSize(), pBmpScaleAction->GetBitmap() ); + METBitBlt( pA->GetPoint(), pA->GetSize(), pBmpScaleAction->GetBitmap().GetSizePixel() ); break; } } @@ -2306,6 +2335,15 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF ) WriteOrders( &aTmpMtf ); } break; + + case( META_RENDERGRAPHIC_ACTION ): + { + const MetaRenderGraphicAction* pA = (const MetaRenderGraphicAction*) pMA; + + METSetMix( eGDIRasterOp ); + METBitBlt( pA->GetPoint(), pA->GetSize(), pCompDev->LogicToPixel( pA->GetSize(), pMTF->GetPrefMapMode() ) ); + } + break; } nWrittenActions++; @@ -2569,5 +2607,4 @@ extern "C" sal_Bool __LOADONCALLAPI GraphicExport( SvStream & rStream, Graphic & } } - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/graphicfilter/epict/epict.cxx b/filter/source/graphicfilter/epict/epict.cxx index 2e8488df3fb4..3d48fdb74640 100644 --- a/filter/source/graphicfilter/epict/epict.cxx +++ b/filter/source/graphicfilter/epict/epict.cxx @@ -47,6 +47,7 @@ #include <vcl/svapp.hxx> #include <vcl/msgbox.hxx> #include <vcl/gdimtf.hxx> +#include <vcl/rendergraphicrasterizer.hxx> #include <tools/bigint.hxx> @@ -227,6 +228,7 @@ void PictWriter::CountActionsAndBitmaps(const GDIMetaFile & rMTF) case META_BMPEX_ACTION: case META_BMPEXSCALE_ACTION: case META_BMPEXSCALEPART_ACTION: + case META_RENDERGRAPHIC_ACTION: nNumberOfBitmaps++; break; } @@ -1808,8 +1810,11 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF ) case META_BMP_ACTION: { - const MetaBmpAction* pA = (const MetaBmpAction*) pMA; - WriteOpcode_BitsRect( pA->GetPoint(),pA->GetBitmap().GetSizePixel(), pA->GetBitmap() ); + const MetaBmpAction* pA = (const MetaBmpAction*) pMA; + const Bitmap aBmp( pA->GetBitmap() ); + VirtualDevice aVirDev; + + WriteOpcode_BitsRect( pA->GetPoint(), aVirDev.PixelToLogic( aBmp.GetSizePixel(), aSrcMapMode ), aBmp ); } break; @@ -1834,8 +1839,9 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF ) { const MetaBmpExAction* pA = (const MetaBmpExAction*) pMA; const Bitmap aBmp( Graphic( pA->GetBitmapEx() ).GetBitmap() ); + VirtualDevice aVirDev; - WriteOpcode_BitsRect( pA->GetPoint(), aBmp.GetSizePixel(), aBmp ); + WriteOpcode_BitsRect( pA->GetPoint(), aVirDev.PixelToLogic( aBmp.GetSizePixel(), aSrcMapMode ), aBmp ); } break; @@ -2151,6 +2157,18 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF ) WriteOpcodes( aTmpMtf ); } break; + + case( META_RENDERGRAPHIC_ACTION ): + { + const MetaRenderGraphicAction* pA = (const MetaRenderGraphicAction*) pMA; + const ::vcl::RenderGraphicRasterizer aRasterizer( pA->GetRenderGraphic() ); + VirtualDevice aVirDev; + const Bitmap aBmp( Graphic( aRasterizer.Rasterize( + aVirDev.LogicToPixel( pA->GetSize() ) ) ).GetBitmap() ); + + WriteOpcode_BitsRect( pA->GetPoint(), pA->GetSize(), aBmp ); + } + break; } nWrittenActions++; diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx index 76a904948b34..b277f7000b9b 100644 --- a/filter/source/graphicfilter/eps/eps.cxx +++ b/filter/source/graphicfilter/eps/eps.cxx @@ -49,6 +49,7 @@ #include <svtools/fltcall.hxx> #include <svtools/FilterConfigItem.hxx> #include <vcl/graphictools.hxx> +#include <vcl/rendergraphicrasterizer.hxx> #include "strings.hrc" #include <math.h> @@ -815,7 +816,7 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev ) if ( mbGrayScale ) aBitmap.Convert( BMP_CONVERSION_8BIT_GREYS ); Point aPoint = ( (const MetaBmpAction*) pMA )->GetPoint(); - Size aSize = aBitmap.GetSizePixel(); + Size aSize( rVDev.PixelToLogic( aBitmap.GetSizePixel() ) ); ImplBmp( &aBitmap, NULL, aPoint, aSize.Width(), aSize.Height() ); } break; @@ -851,8 +852,8 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev ) if ( mbGrayScale ) aBitmap.Convert( BMP_CONVERSION_8BIT_GREYS ); Bitmap aMask( aBitmapEx.GetMask() ); - Point aPoint = ( (const MetaBmpExAction*) pMA)->GetPoint(); - Size aSize = ( aBitmap.GetSizePixel() ); + Point aPoint( ( (const MetaBmpExAction*) pMA )->GetPoint() ); + Size aSize( rVDev.PixelToLogic( aBitmap.GetSizePixel() ) ); ImplBmp( &aBitmap, &aMask, aPoint, aSize.Width(), aSize.Height() ); } break; @@ -1365,6 +1366,7 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev ) case META_BMPSCALEPART_ACTION : case META_BMPEXSCALE_ACTION : case META_BMPEXSCALEPART_ACTION : + case META_RENDERGRAPHIC_ACTION : { nBitmapCount++; nBitmapAction = nCurAction; @@ -1423,6 +1425,23 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev ) } } break; + + case( META_RENDERGRAPHIC_ACTION ): + { + const MetaRenderGraphicAction* pA = (const MetaRenderGraphicAction*) pMA; + const ::vcl::RenderGraphicRasterizer aRasterizer( pA->GetRenderGraphic() ); + const BitmapEx aBmpEx( aRasterizer.Rasterize( rVDev.LogicToPixel( pA->GetSize() ) ) ); + Bitmap aBmp( aBmpEx.GetBitmap() ); + + if ( mbGrayScale ) + aBmp.Convert( BMP_CONVERSION_8BIT_GREYS ); + + Bitmap aMask( aBmpEx.GetMask() ); + Size aSize( pA->GetSize() ); + + ImplBmp( &aBmp, &aMask, pA->GetPoint(), aSize.Width(), aSize.Height() ); + } + break; } } } |