diff options
author | Tomaž Vajngerl <quikee@gmail.com> | 2012-06-16 00:05:00 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2012-06-16 00:39:08 +0200 |
commit | ee41193f3e12ea55237f7681e4b53162a0d421d2 (patch) | |
tree | f02ac0b7a6fb8c64df55491152af8eeb4c371c09 /cui | |
parent | Fix wrong variable name in Smooth filter parameters class. (diff) | |
download | core-ee41193f3e12ea55237f7681e4b53162a0d421d2.tar.gz core-ee41193f3e12ea55237f7681e4b53162a0d421d2.zip |
Dialog for Smooth filter
Added dialog for smooth (gaussian blur) filter which now accepts
a parameter for setting the strenth of smoothing (bluring).
Change-Id: Ida6709b060cb5429a63af1994493e716fd0bfebb
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/dialogs/cuigrfflt.cxx | 51 | ||||
-rw-r--r-- | cui/source/dialogs/grfflt.hrc | 7 | ||||
-rw-r--r-- | cui/source/dialogs/grfflt.src | 72 | ||||
-rw-r--r-- | cui/source/factory/dlgfact.cxx | 15 | ||||
-rw-r--r-- | cui/source/factory/dlgfact.hxx | 22 | ||||
-rw-r--r-- | cui/source/inc/cuigrfflt.hxx | 20 |
6 files changed, 172 insertions, 15 deletions
diff --git a/cui/source/dialogs/cuigrfflt.cxx b/cui/source/dialogs/cuigrfflt.cxx index c1b3ad4067d1..f074e1779f66 100644 --- a/cui/source/dialogs/cuigrfflt.cxx +++ b/cui/source/dialogs/cuigrfflt.cxx @@ -245,6 +245,57 @@ Graphic GraphicFilterMosaic::GetFilteredGraphic( const Graphic& rGraphic, } // ------------------ +// - GraphicFilterSmooth - +// ------------------ + +GraphicFilterSmooth::GraphicFilterSmooth( Window* pParent, const Graphic& rGraphic, double nRadius) : + GraphicFilterDialog ( pParent, CUI_RES( RID_SVX_GRFFILTER_DLG_SMOOTH ), rGraphic ), + maFtRadius ( this, CUI_RES( DLG_FILTERSMOOTH_FT_RADIUS ) ), + maMtrRadius ( this, CUI_RES( DLG_FILTERSMOOTH_MTR_RADIUS ) ) +{ + FreeResource(); + + maMtrRadius.SetValue( nRadius* 10 ); + maMtrRadius.SetModifyHdl( GetModifyHdl() ); + maMtrRadius.GrabFocus(); +} + +// ----------------------------------------------------------------------------- + +GraphicFilterSmooth::~GraphicFilterSmooth() +{ +} + +// ----------------------------------------------------------------------------- + +Graphic GraphicFilterSmooth::GetFilteredGraphic( const Graphic& rGraphic, double /*fScaleX*/, double /*fScaleY*/ ) +{ + Graphic aRet; + BmpFilterParam aParam( GetRadius() ); + + if( rGraphic.IsAnimated() ) + { + Animation aAnim( rGraphic.GetAnimation() ); + + if( aAnim.Filter( BMP_FILTER_SMOOTH, &aParam ) ) + { + aRet = aAnim; + } + } + else + { + BitmapEx aBmpEx( rGraphic.GetBitmapEx() ); + + if( aBmpEx.Filter( BMP_FILTER_SMOOTH, &aParam ) ) + { + aRet = aBmpEx; + } + } + + return aRet; +} + +// ------------------ // - GraphicFilterSolarize - // ------------------ diff --git a/cui/source/dialogs/grfflt.hrc b/cui/source/dialogs/grfflt.hrc index 94d7f8fe392f..c0a980f9a8e3 100644 --- a/cui/source/dialogs/grfflt.hrc +++ b/cui/source/dialogs/grfflt.hrc @@ -49,6 +49,13 @@ #define DLG_FILTERMOSAIC_CBX_EDGES 5 // ---------------------- +// - DLG_FILTERSMOOTH - +// ---------------------- + +#define DLG_FILTERSMOOTH_FT_RADIUS 1 +#define DLG_FILTERSMOOTH_MTR_RADIUS 2 + +// ---------------------- // - DLG_FILTERSOLARIZE - // ---------------------- diff --git a/cui/source/dialogs/grfflt.src b/cui/source/dialogs/grfflt.src index c13eaf373b2a..8bb22b9d247e 100644 --- a/cui/source/dialogs/grfflt.src +++ b/cui/source/dialogs/grfflt.src @@ -428,3 +428,75 @@ ModalDialog RID_SVX_GRFFILTER_DLG_EMBOSS TabStop = TRUE ; }; }; + +// -------------------- +// - DLG_FILTERSMOOTH - +// -------------------- + +ModalDialog RID_SVX_GRFFILTER_DLG_SMOOTH +{ + HelpID = CMD_SID_GRFFILTER_SMOOTH; + OutputSize = TRUE ; + Moveable = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 250, 100 ) ; + + Text [ en-US ] = "Smooth" ; + + FixedLine FL_PARAMETER + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 182, RSC_CD_FIXEDLINE_HEIGHT ) ; + Text [ en-US ] = "Parameters"; + }; + Control CTL_PREVIEW + { + Pos = MAP_APPFONT ( 104 , 3 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP ) ; + Size = MAP_APPFONT ( 81, 73 ) ; + }; +#define MA_Y14 3 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP + FixedText DLG_FILTERSMOOTH_FT_RADIUS + { + Pos = MAP_APPFONT ( 12 , MA_Y14 ) ; + Size = MAP_APPFONT ( 77 , 10 ) ; + Text [ en-US ] = "Smooth Radius" ; + }; +#define MA_Y15 MA_Y14 + RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_CTRL_DESC_Y + NumericField DLG_FILTERSMOOTH_MTR_RADIUS + { + HelpID = "cui:NumericField:RID_SVX_GRFFILTER_DLG_SMOOTH:DLG_FILTERSMOOTH_MTR_RADIUS"; + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , MA_Y15 ); + Size = MAP_APPFONT ( 35 , 12 ); + TabStop = TRUE; + Right = TRUE; + Repeat = TRUE; + Spin = TRUE; + Minimum = 0; + Maximum = 1000; + StrictFormat = TRUE; + First = 1; + DecimalDigits = 1; + Last = 1000; + SpinSize = 2; + }; + OKButton BTN_OK + { + Pos = MAP_APPFONT ( 194, 6 ) ; + Size = MAP_APPFONT ( 50, 14 ) ; + TabStop = TRUE ; + DefButton = TRUE ; + }; + CancelButton BTN_CANCEL + { + Pos = MAP_APPFONT ( 194, 23 ) ; + Size = MAP_APPFONT ( 50, 14 ) ; + TabStop = TRUE ; + }; + HelpButton BTN_HELP + { + Pos = MAP_APPFONT ( 194, 43 ) ; + Size = MAP_APPFONT ( 50, 14 ) ; + TabStop = TRUE ; + }; +}; diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index bcb26fdf2715..e65d314a5b6e 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -1574,18 +1574,23 @@ AbstractGraphicFilterDialog * AbstractDialogFactory_Impl::CreateGraphicFilterPos return 0; } +AbstractGraphicFilterDialog * AbstractDialogFactory_Impl::CreateGraphicFilterSmooth ( Window* pParent, + const Graphic& rGraphic, double nRadius, sal_uInt32) +{ + GraphicFilterDialog* pDlg = new GraphicFilterSmooth( pParent, rGraphic, nRadius ); + return new AbstractGraphicFilterDialog_Impl( pDlg ); +} + AbstractGraphicFilterDialog * AbstractDialogFactory_Impl::CreateGraphicFilterSolarize (Window* pParent, //add for GraphicFilterSolarize - const Graphic& rGraphic, - sal_uInt8 nGreyThreshold, sal_Bool bInvert, sal_uInt32 ) + const Graphic& rGraphic, sal_uInt8 nGreyThreshold, sal_Bool bInvert, sal_uInt32 ) { GraphicFilterDialog* pDlg = new GraphicFilterSolarize( pParent, rGraphic, nGreyThreshold, bInvert ); return new AbstractGraphicFilterDialog_Impl( pDlg ); } AbstractGraphicFilterDialog * AbstractDialogFactory_Impl::CreateGraphicFilterMosaic (Window* pParent, //add for GraphicFilterMosaic - const Graphic& rGraphic, - sal_uInt16 nTileWidth, sal_uInt16 nTileHeight, sal_Bool bEnhanceEdges, - sal_uInt32 nResId) + const Graphic& rGraphic, sal_uInt16 nTileWidth, sal_uInt16 nTileHeight, + sal_Bool bEnhanceEdges, sal_uInt32 nResId) { GraphicFilterDialog* pDlg=NULL; switch ( nResId ) diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index 0f25c25992a0..024300bd4767 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -725,18 +725,20 @@ public: sal_Int16 nInitialContext, const Link& lnkContextSupplier); virtual AbstractGraphicFilterDialog * CreateGraphicFilterEmboss (Window* pParent, //add for GraphicFilterEmboss - const Graphic& rGraphic, - RECT_POINT eLightSource, sal_uInt32 nResId); + const Graphic& rGraphic, RECT_POINT eLightSource, + sal_uInt32 nResId); virtual AbstractGraphicFilterDialog * CreateGraphicFilterPosterSepia (Window* pParent, //add for GraphicFilterPoster & GraphicFilterSepia - const Graphic& rGraphic, - sal_uInt16 nCount, - sal_uInt32 nResId); - virtual AbstractGraphicFilterDialog * CreateGraphicFilterSolarize (Window* pParent, //add for GraphicFilterSolarize - const Graphic& rGraphic, - sal_uInt8 nGreyThreshold, sal_Bool bInvert, sal_uInt32 nResId); + const Graphic& rGraphic, sal_uInt16 nCount, + sal_uInt32 nResId); + virtual AbstractGraphicFilterDialog * CreateGraphicFilterSmooth (Window* pParent, //add for GraphicFilterSolarize + const Graphic& rGraphic, double nRadius, + sal_uInt32 nResId); + virtual AbstractGraphicFilterDialog * CreateGraphicFilterSolarize (Window* pParent, //add for GraphicFilterSmooth + const Graphic& rGraphic, sal_uInt8 nGreyThreshold, + sal_Bool bInvert, sal_uInt32 nResId); virtual AbstractGraphicFilterDialog * CreateGraphicFilterMosaic (Window* pParent, //add for GraphicFilterMosaic - const Graphic& rGraphic, - sal_uInt16 nTileWidth, sal_uInt16 nTileHeight, sal_Bool bEnhanceEdges, sal_uInt32 nResId); + const Graphic& rGraphic, sal_uInt16 nTileWidth, sal_uInt16 nTileHeight, + sal_Bool bEnhanceEdges, sal_uInt32 nResId); virtual AbstractSvxAreaTabDialog* CreateSvxAreaTabDialog( Window* pParent,//add for SvxAreaTabDialog const SfxItemSet* pAttr, SdrModel* pModel, diff --git a/cui/source/inc/cuigrfflt.hxx b/cui/source/inc/cuigrfflt.hxx index 05b0eec9a984..98303e058baf 100644 --- a/cui/source/inc/cuigrfflt.hxx +++ b/cui/source/inc/cuigrfflt.hxx @@ -95,6 +95,26 @@ public: virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) = 0; }; +// ------------------------- +// - GraphicFilterSmooth - +// ------------------------- + +class GraphicFilterSmooth : public GraphicFilterDialog +{ +private: + + FixedText maFtRadius; + NumericField maMtrRadius; + +public: + + GraphicFilterSmooth( Window* pParent, const Graphic& rGraphic, double nRadius); + ~GraphicFilterSmooth(); + + virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ); + double GetRadius() const { return maMtrRadius.GetValue() / 10.0; } +}; + // ----------------------- // - GraphicFilterMosaic - // ----------------------- |