From 5fcdce361a48436148c61788e0b4ec0ea19c6438 Mon Sep 17 00:00:00 2001 From: Arthur Moore Date: Thu, 18 Jun 2015 01:41:25 -0400 Subject: [PATCH] Created a simple harsh filter. This demonstrates how easy it is to add a filter using this framework --- CMakeLists.txt | 1 + src/filters/filter_factory.cpp | 4 ++++ src/filters/filter_functions/harsh.cpp | 27 ++++++++++++++++++++++++++ src/filters/filters.hpp | 15 ++++++++++++++ 4 files changed, 47 insertions(+) create mode 100644 src/filters/filter_functions/harsh.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 27a82f06..cade7a7a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -285,6 +285,7 @@ SET(SRC_FILTERS src/filters/filter_functions/simpleFilter.cpp src/filters/filter_functions/sdl.cpp src/filters/filter_functions/xBRZ/xbrz.cpp + src/filters/filter_functions/harsh.cpp ) SET(SRC_HQ_C diff --git a/src/filters/filter_factory.cpp b/src/filters/filter_factory.cpp index cda6ac0d..84fc8fc2 100644 --- a/src/filters/filter_factory.cpp +++ b/src/filters/filter_factory.cpp @@ -108,6 +108,10 @@ filter_base * filter_factory::createFilter(std::string filterName,unsigned int w { return new MotionBlurIB(width,height); } + if("Harsh" == filterName) + { + return new harsh(width,height); + } //If nothing found, just return a default filter return new filter_base(width,height); diff --git a/src/filters/filter_functions/harsh.cpp b/src/filters/filter_functions/harsh.cpp new file mode 100644 index 00000000..d0727c1c --- /dev/null +++ b/src/filters/filter_functions/harsh.cpp @@ -0,0 +1,27 @@ +#include "../filters.hpp" + +///Arthur's harsh filter +///All colors are either off or full color +void harsh::run(u32 *srcPtr,u32 *dstPtr) +{ + unsigned int numPixels = this->getWidth() * this->getHeight(); + for(unsigned int i=0;i