FotoSHOCK
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
BWconversion_direct/BWconversion_direct.hpp

This is an example of how to declare an ImageOperation that converts image to grayscale using a direct access to ImageBuffer.

/*
* Copyright 2011, 2012 Lukas Jirkovsky
*
* This file is part of FotoSHOCK.
*
* FotoSHOCK is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3 of the License.
*
* FotoSHOCK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with FotoSHOCK. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef BWCONVERSIONDIRECT_H
#define BWCONVERSIONDIRECT_H
#include <ImageOperation.hpp>
#include <ImageBuffer.hpp>
using namespace FotoSHOCKcore;
class BWconversion : public ImageOperation {
public:
virtual void runOperation (const Inputs& sources, const Outputs& dest, vector<UpdateInfo>& ROI, const long stamp);
private:
template <ValueType::Enum PixelFormat>
void convert(MipMap* src, MipMap* dest, vector<UpdateInfo>& ROIlist, const long stamp);
};
public:
virtual const char* name() {return "B/W Conversion.";}
virtual const char* description() {return "Converts an image to grayscale.";}
virtual ImageOperation* operation() {return new BWconversion;}
};
#endif