source: trunk/Include/Classes/System/Drawing/SizeF.ab@ 384

Last change on this file since 384 was 303, checked in by イグトランス (egtra), 17 years ago

フルコンパイルでのミスあぶり出し。註:修正は全て@300や@301以前に行われた。

File size: 1.9 KB
Line 
1' Classes/System/Drawing/SizeF.ab
2
3#ifndef __SYSTEM_DRAWING_SIZEF_AB__
4#define __SYSTEM_DRAWING_SIZEF_AB__
5
6#include <Classes/System/Drawing/Size.ab>
7#include <Classes/System/Drawing/PointF.ab>
8
9Class SizeF
10Public
11 Sub SizeF()
12 width = 0
13 height = 0
14 End Sub
15
16 Sub SizeF(initWidth As Single, initHeight As Single)
17 width = initWidth
18 height = initHeight
19 End Sub
20
21 Sub SizeF(sz As SizeF)
22 width = sz.width
23 height = sz.height
24 End Sub
25
26 Function Width() As Single
27 Return width
28 End Function
29
30 Sub Width(w As Single)
31 width = w
32 End Sub
33
34 Function Height() As Single
35 Return height
36 End Function
37
38 Sub Height(h As Single)
39 height = h
40 End Sub
41
42 Function Operator +(sz As SizeF) As SizeF
43 Dim ret As SizeF(width + sz.width, height + sz.height)
44 Return ret
45 End Function
46
47 Function Operator -(sz As SizeF) As SizeF
48 Dim ret As SizeF(width - sz.width, height - sz.height)
49 Return ret
50 End Function
51
52 Function Operator ==(sz As SizeF) As Boolean
53 Return Equals(sz)
54 End Function
55
56 Function Operator <>(sz As SizeF) As Boolean
57 Return Not Equals(sz)
58 End Function
59/*
60 Sub Operator =(ByRef sz As SizeF)
61 width = sz.width
62 height = sz.height
63 End Sub
64*/
65 Function Equals(sz As SizeF) As Boolean
66 Return width = sz.width And height = sz.height
67 End Function
68
69 Override Function GetHashCode() As Long
70 Return GetDWord(VarPtr(width)) Xor _System_BSwap(GetDWord(VarPtr(height)))
71 End Function
72
73 Function IsEmpty() As Boolean
74 Return width = 0 And height = 0
75 End Function
76
77 Function Add(sz As SizeF) As SizeF
78 Return This + sz
79 End Function
80
81 Function Subtract(sz As SizeF) As SizeF
82 Return This - sz
83 End Function
84
85 Function ToSize() As Size
86 Return Size.Round(This)
87 End Function
88
89 Function ToPointF() As PointF
90 Dim pt As PointF(width, height)
91 Return pt
92 End Function
93Private
94 width As Single
95 height As Single
96End Class
97
98#endif '__SYSTEM_DRAWING_SIZEF_AB__
Note: See TracBrowser for help on using the repository browser.