diff options
author | Muthu Subramanian <sumuthu@suse.com> | 2013-07-17 12:59:40 +0530 |
---|---|---|
committer | Muthu Subramanian <sumuthu@suse.com> | 2013-07-17 13:02:07 +0530 |
commit | 8b716072410bcfd252739fb953d5ac198e27a895 (patch) | |
tree | 64c119dbc0db723bce6a205aaf8f189a128f7415 /svtools | |
parent | 09fb28de3b29c426afa4c37e36268e883aa55923 (diff) |
n#820077: Import images with duotone filter.
Also, contains implementation for a simple duotone filter.
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/graphic/transformer.cxx | 19 | ||||
-rw-r--r-- | svtools/source/graphic/transformer.hxx | 5 |
2 files changed, 24 insertions, 0 deletions
diff --git a/svtools/source/graphic/transformer.cxx b/svtools/source/graphic/transformer.cxx index 1b8e3c2eef1e..18b47212793b 100644 --- a/svtools/source/graphic/transformer.cxx +++ b/svtools/source/graphic/transformer.cxx @@ -139,6 +139,25 @@ uno::Reference< graphic::XGraphic > SAL_CALL GraphicTransformer::colorChange( return xRet; } +uno::Reference< graphic::XGraphic > SAL_CALL GraphicTransformer::applyDuotone( + const uno::Reference< graphic::XGraphic >& rxGraphic, sal_Int32 nColorOne, sal_Int32 nColorTwo ) + throw ( lang::IllegalArgumentException, uno::RuntimeException) +{ + const uno::Reference< uno::XInterface > xIFace( rxGraphic, uno::UNO_QUERY ); + ::Graphic aGraphic( *::unographic::Graphic::getImplementation( xIFace ) ); + + BitmapEx aBitmapEx( aGraphic.GetBitmapEx() ); + Bitmap aBitmap( aBitmapEx.GetBitmap() ); + BmpFilterParam aFilter( (sal_uLong) nColorOne, (sal_uLong) nColorTwo ); + aBitmap.Filter( BMP_FILTER_DUOTONE, &aFilter ); + aGraphic = ::Graphic( BitmapEx( aBitmap ) ); + + ::unographic::Graphic* pUnoGraphic = new ::unographic::Graphic(); + pUnoGraphic->init( aGraphic ); + uno::Reference< graphic::XGraphic > xRet( pUnoGraphic ); + return xRet; +} + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/graphic/transformer.hxx b/svtools/source/graphic/transformer.hxx index 6abef364deb2..4c83662eb111 100644 --- a/svtools/source/graphic/transformer.hxx +++ b/svtools/source/graphic/transformer.hxx @@ -46,6 +46,11 @@ class GraphicTransformer : public GraphicTransformer_UnoImplHelper1 sal_Int32 nColorFrom, sal_Int8 nTolerance, sal_Int32 nColorTo, sal_Int8 nAlphaTo ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > SAL_CALL applyDuotone( + const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& rGraphic, + sal_Int32 nColorOne, sal_Int32 nColorTwo ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + }; } |