~ubuntu-branches/ubuntu/intrepid/digikam/intrepid

« back to all changes in this revision

Viewing changes to digikam/imageplugins/hotpixels/hotpixel.h

  • Committer: Bazaar Package Importer
  • Author(s): Mark Purcell
  • Date: 2008-07-17 20:25:39 UTC
  • mfrom: (1.2.15 upstream) (3.1.2 lenny)
  • Revision ID: james.westby@ubuntu.com-20080717202539-6n7dtirbkoo7qvhd
Tags: 2:0.9.4-1
* New upstream release
  - digiKam 0.9.4 Release Plan (KDE3) ~ 13 July 08 (Closes: #490144)
* DEB_CONFIGURE_EXTRA_FLAGS := --without-included-sqlite3
* Debhelper compatibility level V7
* Install pixmaps in debian/*.install
* Add debian/digikam.lintian-overrides

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 * Date        : 2005-03-27
7
7
 * Description : Threaded image filter to fix hot pixels
8
8
 * 
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>
11
11
 * 
12
12
 * This program is free software; you can redistribute it
39
39
        
40
40
    QRect rect;
41
41
    int luminosity;
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();};
46
46
    
47
47
    bool operator==(const HotPixel p) const
48
48
    {
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);
55
55
    } 
56
56
        
57
57
private:
58
58
        
59
 
    bool diagonal (QRect r1,QRect r2) const
 
59
    bool diagonal(QRect r1,QRect r2) const
60
60
    {
61
61
        //locate next-to positions
62
62
        
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();
67
67
        
68
68
        return (top && left || top && right || bottom && left || bottom && right);
69
69
    }