From 5bed6e4a4c916a97f8fe4d1b07f7eecf4d733b90 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Fri, 22 Nov 2024 18:41:30 +0900 Subject: Rename 'digikam' folder to 'src' Signed-off-by: Michele Calgaro (cherry picked from commit ee0d99607c14cb63d3ebdb3a970b508949fa8219) --- src/imageplugins/hotpixels/hotpixel.h | 74 +++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 src/imageplugins/hotpixels/hotpixel.h (limited to 'src/imageplugins/hotpixels/hotpixel.h') diff --git a/src/imageplugins/hotpixels/hotpixel.h b/src/imageplugins/hotpixels/hotpixel.h new file mode 100644 index 00000000..bceb539f --- /dev/null +++ b/src/imageplugins/hotpixels/hotpixel.h @@ -0,0 +1,74 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2005-03-27 + * Description : Threaded image filter to fix hot pixels + * + * Copyright (C) 2005-2008 by Gilles Caulier + * Copyright (C) 2005-2006 by Unai Garro + * + * This program is free software; you can redistribute it + * and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; + * either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * ============================================================ */ + +#ifndef HOTPIXEL_H +#define HOTPIXEL_H + +// TQt includes. + +#include + +namespace DigikamHotPixelsImagesPlugin +{ + +class HotPixel +{ + +public: + + TQRect rect; + int luminosity; + int y() const {return rect.y(); }; + int x() const {return rect.x(); }; + int width()const {return rect.width(); }; + int height()const {return rect.height();}; + + bool operator==(const HotPixel p) const + { + //we can say they're same hotpixel spot if they + //touch(next to) each other horizontally or vertically, not diagonal corners + //return (rect.intersects(p.rect)); + return (rect != p.rect) && (x() + width() >= p.x() && x() <= p.x() + p.width() + && y() + height() >= p.y() && y() <= p.y() + p.height()) + && !diagonal(rect, p.rect); + } + +private: + + bool diagonal(TQRect r1,TQRect r2) const + { + //locate next-to positions + + bool top = r1.y() + height()-1 == r2.y()-1; //r1 is on the top of r2 + bool left = r1.x() + width()-1 == r2.x()-1; //r1 is on the left of r2 + bool right = r1.x() == r2.x() + r2.width(); + bool bottom = r1.y() == r2.y() + r2.height(); + + return ((top && left) || (top && right) || (bottom && left) || (bottom && right)); + } +}; + +} // NameSpace DigikamHotPixelsImagesPlugin + +#endif // HOTPIXEL_H -- cgit v1.2.1