~mantas/pinta/stable

« back to all changes in this revision

Viewing changes to Pinta.Core/Effects/Scanline.cs

  • Committer: Iain Lane
  • Date: 2010-03-13 18:20:18 UTC
  • mfrom: (1.1.2)
  • Revision ID: git-v1:1781694a68ecf232d0110c0b2f3d4a1b96c74ec2
Merge commit 'upstream/0.2'

Conflicts:
        debian/control

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/////////////////////////////////////////////////////////////////////////////////
 
2
// Paint.NET                                                                   //
 
3
// Copyright (C) dotPDN LLC, Rick Brewster, Tom Jackson, and contributors.     //
 
4
// Portions Copyright (C) Microsoft Corporation. All Rights Reserved.          //
 
5
// See license-pdn.txt for full licensing and attribution details.             //
 
6
/////////////////////////////////////////////////////////////////////////////////
 
7
 
 
8
using System;
 
9
using Cairo;
 
10
 
 
11
namespace Pinta.Core
 
12
{
 
13
    public struct Scanline
 
14
    {
 
15
        private int x;
 
16
        private int y;
 
17
        private int length;
 
18
 
 
19
        public int X
 
20
        {
 
21
            get
 
22
            {
 
23
                return x;
 
24
            }
 
25
        }
 
26
 
 
27
        public int Y
 
28
        {
 
29
            get
 
30
            {
 
31
                return y;
 
32
            }
 
33
        }
 
34
 
 
35
        public int Length
 
36
        {
 
37
            get
 
38
            {
 
39
                return length;
 
40
            }
 
41
        }
 
42
 
 
43
        public override int GetHashCode()
 
44
        {
 
45
            unchecked
 
46
            {
 
47
                return length.GetHashCode() + x.GetHashCode() + y.GetHashCode();
 
48
            }
 
49
        }
 
50
        
 
51
        public override bool Equals(object obj)
 
52
        {
 
53
            if (obj is Scanline)
 
54
            {
 
55
                Scanline rhs = (Scanline)obj;
 
56
                return x == rhs.x && y == rhs.y && length == rhs.length;
 
57
            }
 
58
            else
 
59
            {
 
60
                return false;
 
61
            }
 
62
        }
 
63
 
 
64
        public static bool operator== (Scanline lhs, Scanline rhs)
 
65
        {
 
66
            return lhs.x == rhs.x && lhs.y == rhs.y && lhs.length == rhs.length;
 
67
        }
 
68
 
 
69
        public static bool operator!= (Scanline lhs, Scanline rhs)
 
70
        {
 
71
            return !(lhs == rhs);
 
72
        }
 
73
 
 
74
        public override string ToString()
 
75
        {
 
76
            return "(" + x + "," + y + "):[" + length.ToString() + "]";
 
77
        }
 
78
 
 
79
        public Scanline(int x, int y, int length)
 
80
        {
 
81
            this.x = x;
 
82
            this.y = y;
 
83
            this.length = length;
 
84
        }
 
85
    }
 
86
}