Changeset 303 for trunk/Include/Classes/System/Drawing/Color.ab
- Timestamp:
- Aug 24, 2007, 11:14:46 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Include/Classes/System/Drawing/Color.ab
r282 r303 69 69 Exit Sub ' パレットインデックス指定は無効 70 70 Else 71 argb = Color_MakeARGB(255, GetRValue(rgb), GetGValue(rgb), GetBValue(rgb))71 argb = MakeARGB(255, GetRValue(rgb) As Byte, GetGValue(rgb) As Byte, GetBValue(rgb) As Byte) 72 72 End If 73 73 End Sub … … 82 82 83 83 Static Function FromArgb(argb As ARGB) As Color 84 Dim c As Color(argb) 85 Rteurn c 84 Return New Color(argb) 86 85 End Function 87 86 88 87 Static Function FromArgb(a As Byte, base As Color) As Color 89 Dim c As Color(a, base.R, base.G, base.B) 90 Return c 88 Return New Color(a, base.R, base.G, base.B) 91 89 End Function 92 90 93 91 Static Function FromArgb(r As Byte, g As Byte, b As Byte) As Color 94 Dim c As Color(r, g, b) 95 Return c 92 Return New Color(r, g, b) 96 93 End Function 97 94 98 95 Static Function FromArgb(a As Byte, r As Byte, g As Byte, b As Byte) As Color 99 Dim c As Color(a, r, g, b) 100 Return c 96 Return New Color(a, r, g, b) 101 97 End Function 102 98 … … 119 115 d = max - min 120 116 If g = max Then 121 Return ( b - r) As Double / d * 60 + 120117 Return ((b - r) As Double / d * 60.0 + 120.0) As Single 122 118 ElseIf b = max Then 123 Return ( r - g) As Double / d * 60 + 240119 Return ((r - g) As Double / d * 60 + 240) As Single 124 120 ElseIf g < b Then 125 Return ( g - b) As Double / d * 60 + 360121 Return ((g - b) As Double / d * 60 + 360) As Single 126 122 Else 127 Return ( g - b) As Double / d * 60123 Return ((g - b) As Double / d * 60) As Single 128 124 EndIf 129 125 End Function 130 126 131 127 Function GetSaturation() As Single 132 Dim max As Long, min As Long133 128 Dim r = R 134 129 Dim g = G 135 130 Dim b = B 136 max = System.Math.Max(System.Math.Max(r, g), b)137 min = System.Math.Min(System.Math.Min(r, g), b)131 Dim max = System.Math.Max(System.Math.Max(r, g), b) As Long 132 Dim min = System.Math.Min(System.Math.Min(r, g), b) As Long 138 133 Return (max - min) / max 139 134 End Function 140 135 141 136 Function GetBrightness() As Single 142 Dim max As Long143 137 Dim r = R 144 138 Dim g = G 145 139 Dim b = B 146 max = System.Math.Max(System.Math.Max(r, g), b)140 Dim max = System.Math.Max(System.Math.Max(r, g), b) 147 141 Return max * (1 / 255) 148 142 End Function
Note:
See TracChangeset
for help on using the changeset viewer.