Kaydet (Commit) 70306e5a authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl Kaydeden (comit) Tomaž Vajngerl

oox: adapt graphic transformer, cleanup, remove try catch

Change-Id: I96862c571f1e1de901e0d4d3fd167e418d0f6dea
Reviewed-on: https://gerrit.libreoffice.org/50869Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarTomaž Vajngerl <quikee@gmail.com>
üst 584454ce
...@@ -59,56 +59,46 @@ namespace drawingml { ...@@ -59,56 +59,46 @@ namespace drawingml {
namespace { namespace {
Reference< XGraphic > lclCheckAndApplyDuotoneTransform( const BlipFillProperties& aBlipProps, Reference< XGraphic > const & xGraphic, Reference< XGraphic > lclCheckAndApplyDuotoneTransform(const BlipFillProperties& aBlipProps, uno::Reference<graphic::XGraphic> const & xGraphic,
const GraphicHelper& rGraphicHelper, const ::Color nPhClr ) const GraphicHelper& rGraphicHelper, const ::Color nPhClr)
{ {
if( aBlipProps.maDuotoneColors[0].isUsed() && aBlipProps.maDuotoneColors[1].isUsed() ) if (aBlipProps.maDuotoneColors[0].isUsed() && aBlipProps.maDuotoneColors[1].isUsed())
{ {
::Color nColor1 = aBlipProps.maDuotoneColors[0].getColor( rGraphicHelper, nPhClr ); ::Color nColor1 = aBlipProps.maDuotoneColors[0].getColor( rGraphicHelper, nPhClr );
::Color nColor2 = aBlipProps.maDuotoneColors[1].getColor( rGraphicHelper, nPhClr ); ::Color nColor2 = aBlipProps.maDuotoneColors[1].getColor( rGraphicHelper, nPhClr );
try
{ uno::Reference<graphic::XGraphicTransformer> xTransformer(aBlipProps.mxFillGraphic, uno::UNO_QUERY);
Reference< XGraphicTransformer > xTransformer( aBlipProps.mxFillGraphic, UNO_QUERY_THROW ); if (xTransformer.is())
return xTransformer->applyDuotone( xGraphic, sal_Int32(nColor1), sal_Int32(nColor2) ); return xTransformer->applyDuotone(xGraphic, sal_Int32(nColor1), sal_Int32(nColor2));
}
catch( Exception& )
{
}
} }
return xGraphic; return xGraphic;
} }
Reference< XGraphic > lclCheckAndApplyChangeColorTransform( const BlipFillProperties &aBlipProps, Reference< XGraphic > const & xGraphic, Reference< XGraphic > lclCheckAndApplyChangeColorTransform(const BlipFillProperties &aBlipProps, uno::Reference<graphic::XGraphic> const & xGraphic,
const GraphicHelper& rGraphicHelper, const ::Color nPhClr ) const GraphicHelper& rGraphicHelper, const ::Color nPhClr)
{ {
if( aBlipProps.maColorChangeFrom.isUsed() && aBlipProps.maColorChangeTo.isUsed() ) if( aBlipProps.maColorChangeFrom.isUsed() && aBlipProps.maColorChangeTo.isUsed() )
{ {
::Color nFromColor = aBlipProps.maColorChangeFrom.getColor( rGraphicHelper, nPhClr ); ::Color nFromColor = aBlipProps.maColorChangeFrom.getColor( rGraphicHelper, nPhClr );
::Color nToColor = aBlipProps.maColorChangeTo.getColor( rGraphicHelper, nPhClr ); ::Color nToColor = aBlipProps.maColorChangeTo.getColor( rGraphicHelper, nPhClr );
if ( (nFromColor != nToColor) || aBlipProps.maColorChangeTo.hasTransparency() ) try if ( (nFromColor != nToColor) || aBlipProps.maColorChangeTo.hasTransparency() )
{ {
sal_Int16 nToTransparence = aBlipProps.maColorChangeTo.getTransparency(); sal_Int16 nToTransparence = aBlipProps.maColorChangeTo.getTransparency();
sal_Int8 nToAlpha = static_cast< sal_Int8 >( (100 - nToTransparence) * 2.55 ); sal_Int8 nToAlpha = static_cast< sal_Int8 >( (100 - nToTransparence) * 2.55 );
Reference< XGraphicTransformer > xTransformer( aBlipProps.mxFillGraphic, UNO_QUERY_THROW );
return xTransformer->colorChange( xGraphic, sal_Int32(nFromColor), 9, sal_Int32(nToColor), nToAlpha ); uno::Reference<graphic::XGraphicTransformer> xTransformer(aBlipProps.mxFillGraphic, uno::UNO_QUERY);
} if (xTransformer.is())
catch( Exception& ) return xTransformer->colorChange(xGraphic, sal_Int32(nFromColor), 9, sal_Int32(nToColor), nToAlpha);
{
} }
} }
return xGraphic; return xGraphic;
} }
Reference< XGraphic > applyBrightnessContrast( Reference< XGraphic > const & xGraphic, sal_Int32 brightness, sal_Int32 contrast ) uno::Reference<graphic::XGraphic> applyBrightnessContrast(uno::Reference<graphic::XGraphic> const & xGraphic, sal_Int32 brightness, sal_Int32 contrast)
{ {
try uno::Reference<graphic::XGraphicTransformer> xTransformer(xGraphic, uno::UNO_QUERY);
{ if (xTransformer.is())
Reference< XGraphicTransformer > xTransformer( xGraphic, UNO_QUERY_THROW ); return xTransformer->applyBrightnessContrast(xGraphic, brightness, contrast, true);
return xTransformer->applyBrightnessContrast( xGraphic, brightness, contrast, true );
}
catch( Exception& )
{
}
return xGraphic; return xGraphic;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment