markus / ConvertService / ConverterService / ImageFields / Image.cs @ 366f00c2
이력 | 보기 | 이력해설 | 다운로드 (3.41 KB)
1 |
using System; |
---|---|
2 |
using System.Collections.Generic; |
3 |
using System.Linq; |
4 |
using System.Text; |
5 |
using System.Windows; |
6 |
|
7 |
namespace ImageFields |
8 |
{ |
9 |
public class Image |
10 |
{ |
11 |
// Fields |
12 |
private Point dpi; |
13 |
private double maxViewportWidth; |
14 |
private double minViewportWidth; |
15 |
private string path; |
16 |
private Point size; |
17 |
private Point viewportOrigin; |
18 |
private double viewportWidth; |
19 |
|
20 |
// Methods |
21 |
public Image(string path) |
22 |
{ |
23 |
this.path = path; |
24 |
this.viewportOrigin = new Point(0.0, 0.0); |
25 |
this.viewportWidth = 1.0; |
26 |
this.maxViewportWidth = double.MaxValue; |
27 |
this.minViewportWidth = double.Epsilon; |
28 |
} |
29 |
|
30 |
// Properties |
31 |
public Point Dpi |
32 |
{ |
33 |
get |
34 |
{ |
35 |
return this.dpi; |
36 |
} |
37 |
set |
38 |
{ |
39 |
if ((value.X <= 0.0) || (value.Y <= 0.0)) |
40 |
{ |
41 |
throw new ArgumentOutOfRangeException("value", "DPI must be greater than 0."); |
42 |
} |
43 |
this.dpi = value; |
44 |
} |
45 |
} |
46 |
|
47 |
public double MaxViewportWidth |
48 |
{ |
49 |
get |
50 |
{ |
51 |
return this.maxViewportWidth; |
52 |
} |
53 |
set |
54 |
{ |
55 |
if (value <= 0.0) |
56 |
{ |
57 |
throw new ArgumentOutOfRangeException("value", "MaxViewportWidth must be greater than 0."); |
58 |
} |
59 |
if (value < this.minViewportWidth) |
60 |
{ |
61 |
throw new ArgumentOutOfRangeException("value", "MaxViewportWidth must be greater than MinViewportWidth."); |
62 |
} |
63 |
this.maxViewportWidth = value; |
64 |
} |
65 |
} |
66 |
|
67 |
public double MinViewportWidth |
68 |
{ |
69 |
get |
70 |
{ |
71 |
return this.minViewportWidth; |
72 |
} |
73 |
set |
74 |
{ |
75 |
if (value <= 0.0) |
76 |
{ |
77 |
throw new ArgumentOutOfRangeException("value", "MinViewportWidth must be greater than 0."); |
78 |
} |
79 |
if (value > this.maxViewportWidth) |
80 |
{ |
81 |
throw new ArgumentOutOfRangeException("value", "MinViewportWidth must be less than MaxViewportWidth."); |
82 |
} |
83 |
this.minViewportWidth = value; |
84 |
} |
85 |
} |
86 |
|
87 |
public string Path |
88 |
{ |
89 |
get |
90 |
{ |
91 |
return this.path; |
92 |
} |
93 |
set |
94 |
{ |
95 |
this.path = value; |
96 |
} |
97 |
} |
98 |
|
99 |
public Point Size |
100 |
{ |
101 |
get |
102 |
{ |
103 |
return this.size; |
104 |
} |
105 |
set |
106 |
{ |
107 |
if ((value.X <= 0.0) || (value.Y <= 0.0)) |
108 |
{ |
109 |
throw new ArgumentOutOfRangeException("value", "Size must be greater than 0."); |
110 |
} |
111 |
this.size = value; |
112 |
} |
113 |
} |
114 |
|
115 |
public Point ViewportOrigin |
116 |
{ |
117 |
get |
118 |
{ |
119 |
return this.viewportOrigin; |
120 |
} |
121 |
set |
122 |
{ |
123 |
this.viewportOrigin = value; |
124 |
} |
125 |
} |
126 |
|
127 |
public double ViewportWidth |
128 |
{ |
129 |
get |
130 |
{ |
131 |
return this.viewportWidth; |
132 |
} |
133 |
set |
134 |
{ |
135 |
this.viewportWidth = value; |
136 |
} |
137 |
} |
138 |
} |
139 |
|
140 |
|
141 |
} |