diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2018-04-20 22:22:44 +1000 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2018-05-09 05:17:42 +0200 |
commit | b781a6b6b2fc0a6688a6335a9408143fb120aa6e (patch) | |
tree | b3c3eb433001aac650de3ef00e889a901a7ff1ee /include | |
parent | 2af7daa18467cc7c3f4f435c58cd19ee682f754f (diff) |
vcl: get rid of Bitmap{Ex}::Filter() and Animation::Filter()
Change-Id: I510d7b286df732712aa9206b0a7c7910af34c83f
Reviewed-on: https://gerrit.libreoffice.org/53206
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/vcl/BitmapFilter.hxx | 6 | ||||
-rw-r--r-- | include/vcl/BitmapSepiaFilter.hxx | 6 | ||||
-rw-r--r-- | include/vcl/animate.hxx | 5 | ||||
-rw-r--r-- | include/vcl/bitmap.hxx | 102 | ||||
-rw-r--r-- | include/vcl/bitmapex.hxx | 14 |
5 files changed, 10 insertions, 123 deletions
diff --git a/include/vcl/BitmapFilter.hxx b/include/vcl/BitmapFilter.hxx index f8759a1302c2..f1a7e0b6cfff 100644 --- a/include/vcl/BitmapFilter.hxx +++ b/include/vcl/BitmapFilter.hxx @@ -8,10 +8,11 @@ * */ -#ifndef INCLUDED_VCL_INC_BITMAPFILTER_HXX -#define INCLUDED_VCL_INC_BITMAPFILTER_HXX +#ifndef INCLUDED_VCL_BITMAPFILTER_HXX +#define INCLUDED_VCL_BITMAPFILTER_HXX #include <vcl/bitmapex.hxx> +#include <vcl/animate.hxx> class VCL_DLLPUBLIC BitmapFilter { @@ -22,6 +23,7 @@ public: virtual BitmapEx execute(BitmapEx const& rBitmapEx) = 0; static bool Filter(BitmapEx& rBmpEx, BitmapFilter&& rFilter); + static bool Filter(Animation& rBmpEx, BitmapFilter&& rFilter); }; #endif diff --git a/include/vcl/BitmapSepiaFilter.hxx b/include/vcl/BitmapSepiaFilter.hxx index 717f10d1466b..d636ebe6fea6 100644 --- a/include/vcl/BitmapSepiaFilter.hxx +++ b/include/vcl/BitmapSepiaFilter.hxx @@ -19,8 +19,12 @@ class VCL_DLLPUBLIC BitmapSepiaFilter : public BitmapFilter { public: BitmapSepiaFilter(double nSepiaPercent) - : mnSepiaPercent(nSepiaPercent) { + // clamp value to 100% + if (nSepiaPercent <= 100) + mnSepiaPercent = nSepiaPercent; + else + mnSepiaPercent = 100; } virtual BitmapEx execute(BitmapEx const& rBitmapEx) override; diff --git a/include/vcl/animate.hxx b/include/vcl/animate.hxx index 23d7e1e05a44..5cc0cdf0a621 100644 --- a/include/vcl/animate.hxx +++ b/include/vcl/animate.hxx @@ -125,6 +125,7 @@ public: void SetNotifyHdl( const Link<Animation*,void>& rLink ) { maNotifyLink = rLink; } const Link<Animation*,void>& GetNotifyHdl() const { return maNotifyLink; } + std::vector< std::unique_ptr<AnimationBitmap> >& GetAnimationFrames() { return maList; } size_t Count() const { return maList.size(); } bool Insert( const AnimationBitmap& rAnimationBitmap ); const AnimationBitmap& @@ -150,10 +151,6 @@ public: double fGamma = 1.0, bool bInvert = false ); - bool Filter( - BmpFilter eFilter, - const BmpFilterParam* pFilterParam = nullptr ); - friend VCL_DLLPUBLIC SvStream& ReadAnimation( SvStream& rIStream, Animation& rAnimation ); friend VCL_DLLPUBLIC SvStream& WriteAnimation( SvStream& rOStream, const Animation& rAnimation ); diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx index d0fa1a28ea34..9dfca1de0af1 100644 --- a/include/vcl/bitmap.hxx +++ b/include/vcl/bitmap.hxx @@ -89,94 +89,6 @@ enum class BmpCombine Or, And }; -enum class BmpFilter -{ - Smooth = 0, - Sharpen = 1, - RemoveNoise = 2, - SobelGrey = 3, - EmbossGrey = 4, - Solarize = 5, - Sepia = 6, - Mosaic = 7, - PopArt = 8, - DuoTone = 9, - - Unknown = 65535 -}; - -class VCL_DLLPUBLIC BmpFilterParam -{ -public: - - BmpFilterParam( sal_uLong nProgressStart = 0, sal_uLong nProgressEnd = 0 ) : - meFilter( BmpFilter::Unknown ), mnProgressStart( nProgressStart ), mnProgressEnd( nProgressEnd ) {} - - BmpFilterParam( sal_uInt8 cSolarGreyThreshold, sal_uLong nProgressStart = 0, sal_uLong nProgressEnd = 0 ) : - meFilter( BmpFilter::Solarize ), mnProgressStart( nProgressStart ), mnProgressEnd( nProgressEnd ), - mcSolarGreyThreshold( cSolarGreyThreshold ) {} - - BmpFilterParam( double nRadius, sal_uLong nProgressStart = 0, sal_uLong nProgressEnd = 0 ) : - meFilter( BmpFilter::Smooth ), mnProgressStart( nProgressStart ), mnProgressEnd( nProgressEnd ), - mnRadius( nRadius ) {} - - BmpFilterParam( sal_uInt16 nSepiaPercent, sal_uLong nProgressStart = 0, sal_uLong nProgressEnd = 0 ) : - meFilter( BmpFilter::Sepia ), mnProgressStart( nProgressStart ), mnProgressEnd( nProgressEnd ), - mnSepiaPercent( nSepiaPercent ) - { - assert(nSepiaPercent<=100); - } - - BmpFilterParam( const Size& rMosaicTileSize, sal_uLong nProgressStart = 0, sal_uLong nProgressEnd = 0 ) : - meFilter( BmpFilter::Mosaic ), mnProgressStart( nProgressStart ), mnProgressEnd( nProgressEnd ) - { - maMosaicTileSize.mnTileWidth = rMosaicTileSize.Width(); - maMosaicTileSize.mnTileHeight= rMosaicTileSize.Height(); - } - BmpFilterParam( sal_uInt16 nEmbossAzimuthAngle100, sal_uInt16 nEmbossElevationAngle100, - sal_uLong nProgressStart = 0, sal_uLong nProgressEnd = 0 ) : - meFilter( BmpFilter::EmbossGrey ), mnProgressStart( nProgressStart ), mnProgressEnd( nProgressEnd ) - { - maEmbossAngles.mnAzimuthAngle100 = nEmbossAzimuthAngle100; - maEmbossAngles.mnElevationAngle100 = nEmbossElevationAngle100; - } - -private: - friend class ::Bitmap; - friend class BitmapEx; - friend class Animation; - -private: - BmpFilter meFilter; - sal_uLong mnProgressStart; - sal_uLong mnProgressEnd; - -public: - struct MosaicTileSize - { - sal_uLong mnTileWidth; - sal_uLong mnTileHeight; - }; - - struct EmbossAngles - { - sal_uInt16 mnAzimuthAngle100; - sal_uInt16 mnElevationAngle100; - }; - -private: - union - { - sal_uInt16 mnSepiaPercent; - sal_uInt8 mcSolarGreyThreshold; - double mnRadius; - - MosaicTileSize maMosaicTileSize; - EmbossAngles maEmbossAngles; - }; - -}; - class BitmapInfoAccess; class BitmapReadAccess; class BitmapWriteAccess; @@ -626,20 +538,6 @@ public: bool bInvert = false, bool msoBrightness = false ); - /** Apply specified filter to the bitmap - - @param eFilter - The filter algorithm to apply - - @param pFilterParam - Various parameter for the different bitmap filter algorithms - - @return true, if the operation was completed successfully. - */ - bool Filter( - BmpFilter eFilter, - const BmpFilterParam* pFilterParam = nullptr ); - public: /** ReassignWithSize and recalculate bitmap. diff --git a/include/vcl/bitmapex.hxx b/include/vcl/bitmapex.hxx index d7c2560485c4..f52a8dba5fb0 100644 --- a/include/vcl/bitmapex.hxx +++ b/include/vcl/bitmapex.hxx @@ -332,20 +332,6 @@ public: bool bInvert = false, bool msoBrightness = false ); - /** Apply specified filter to the bitmap - - @param eFilter - The filter algorithm to apply - - @param pFilterParam - Various parameter for the different bitmap filter algorithms - - @return true, if the operation was completed successfully. - */ - bool Filter( - BmpFilter eFilter, - const BmpFilterParam* pFilterParam = nullptr ); - /** Get transparency at given position @param nX |