diff options
author | Muthu Subramanian <sumuthu@suse.com> | 2013-07-17 13:13:30 +0530 |
---|---|---|
committer | Muthu Subramanian <sumuthu@suse.com> | 2013-07-17 13:13:30 +0530 |
commit | ad4604428dc98686d00637b06fe09078873c9acf (patch) | |
tree | a0a7ff54f6c18fb13fd556644266e413925e06a1 /svtools/source/graphic/transformer.cxx | |
parent | b8bcfade5731297dc64c02afd64ba0ea3b4f5132 (diff) |
n#820077: Import images with duotone filter.suse-4.0-8
Also, contains implementation for a simple duotone filter.
(Port from commit: 8b716072410bcfd252739fb953d5ac198e27a895)
Diffstat (limited to 'svtools/source/graphic/transformer.cxx')
-rw-r--r-- | svtools/source/graphic/transformer.cxx | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/svtools/source/graphic/transformer.cxx b/svtools/source/graphic/transformer.cxx index 874bb346e59d..684c75c80451 100644 --- a/svtools/source/graphic/transformer.cxx +++ b/svtools/source/graphic/transformer.cxx @@ -141,6 +141,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: */ |