7
7
* Description : Threaded image filter to fix hot pixels
9
* Copyright (C) 2005-2007 by Gilles Caulier <caulier dot gilles at gmail dot com>
9
* Copyright (C) 2005-2008 by Gilles Caulier <caulier dot gilles at gmail dot com>
10
10
* Copyright (C) 2005-2006 by Unai Garro <ugarro at users dot sourceforge dot net>
12
12
* This program is free software; you can redistribute it
42
int y() const{return rect.y();}
43
int x() const{return rect.x();}
44
int width()const {return rect.width();}
45
int height()const {return rect.height();}
42
int y() const {return rect.y(); };
43
int x() const {return rect.x(); };
44
int width()const {return rect.width(); };
45
int height()const {return rect.height();};
47
47
bool operator==(const HotPixel p) const
49
49
//we can say they're same hotpixel spot if they
50
50
//touch(next to) each other horizontally or vertically, not diagonal corners
51
51
//return (rect.intersects(p.rect));
52
return (rect != p.rect)&&(x()+width()>=p.x() && x()<=p.x()+p.width()
53
&& y()+height()>=p.y() && y()<=p.y()+p.height())
54
&& !diagonal(rect,p.rect);
52
return (rect != p.rect) && (x() + width() >= p.x() && x() <= p.x() + p.width()
53
&& y() + height() >= p.y() && y() <= p.y() + p.height())
54
&& !diagonal(rect, p.rect);
59
bool diagonal (QRect r1,QRect r2) const
59
bool diagonal(QRect r1,QRect r2) const
61
61
//locate next-to positions
63
bool top=r1.y()+height()-1==r2.y()-1; //r1 is on the top of r2
64
bool left=r1.x()+width()-1==r2.x()-1; //r1 is on the left of r2
65
bool right=r1.x()==r2.x()+r2.width(); //...
66
bool bottom=r1.y()==r2.y()+r2.height(); //...
63
bool top = r1.y() + height()-1 == r2.y()-1; //r1 is on the top of r2
64
bool left = r1.x() + width()-1 == r2.x()-1; //r1 is on the left of r2
65
bool right = r1.x() == r2.x() + r2.width();
66
bool bottom = r1.y() == r2.y() + r2.height();
68
68
return (top && left || top && right || bottom && left || bottom && right);