diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2024-11-22 18:41:30 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2024-11-22 20:55:03 +0900 |
commit | 5bed6e4a4c916a97f8fe4d1b07f7eecf4d733b90 (patch) | |
tree | f89cc49efc9ca1d0e1579ecb079ee7e7088ff8c8 /src/imageplugins/hotpixels/hotpixel.h | |
parent | 0bfbf616d9c1fd7abb1bd02732389ab35e5f8771 (diff) | |
download | digikam-5bed6e4a4c916a97f8fe4d1b07f7eecf4d733b90.tar.gz digikam-5bed6e4a4c916a97f8fe4d1b07f7eecf4d733b90.zip |
Rename 'digikam' folder to 'src'
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
(cherry picked from commit ee0d99607c14cb63d3ebdb3a970b508949fa8219)
Diffstat (limited to 'src/imageplugins/hotpixels/hotpixel.h')
-rw-r--r-- | src/imageplugins/hotpixels/hotpixel.h | 74 |
1 files changed, 74 insertions, 0 deletions
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 <caulier dot gilles at gmail dot com> + * Copyright (C) 2005-2006 by Unai Garro <ugarro at users dot sourceforge dot net> + * + * 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 <tqrect.h> + +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 |