source: branch/egtra-gdiplus/Classes/System/Drawing/Brush.ab

Last change on this file was 241, checked in by イグトランス (egtra), 18 years ago

GDI+に対して名前空間で囲ったものの、現在コンパイルできないため分岐させておく

File size: 2.3 KB
Line 
1' Classes/System/Drawing/Brush.ab
2
3#require <GdiPlusFlat.ab>
4
5Namespace System
6Namespace Drawing
7
8Class Brush
9 'Inherits ICloneable, IDisposable
10Public
11 Virtual Sub ~Brush()
12 Dispose()
13 End Sub
14
15 Sub Dispose()
16 If nativeBrush <> 0 Then
17 Gdiplus.DllExports.GdipDeleteBrush(nativeBrush)
18 nativeBrush = 0
19 End If
20 End Sub
21
22 /*Const Override*/ Virtual Function Clone() As Brush
23 Dim brush = 0 As *GpBrush
24
25 SetStatus(GdiPlus.DllExports.GdipCloneBrush(nativeBrush, brush))
26
27 Clone = New Brush(brush, lastResult)
28
29 If newBrush = Nothing Then
30 GdiPlus.DllExports.GdipDeleteBrush(brush)
31 End If
32 End Sub
33/*
34 Const Function GetType() As BrushType
35 GetType = -1 As BrushType
36 SetStatus(GdiPlus.DllExports.GdipGetBrushType(nativeBrush, GetType))
37 End Function
38*/
39 Function GetLastStatus() As Gdiplus.Status
40 GetLastStatus = lastResult
41 lastResult = Gdiplus.Status.Ok
42 End Function
43
44 Function NativeBrush() AS *GpBrush
45 Return nativeBrush
46 End Function
47
48'Protected
49 Sub Brush()
50 SetStatus(Gdiplus.Status.NotImplemented)
51 End Sub
52
53'Protected
54 Sub Brush(nativeBrush As *GpBrush, status As Gdiplus.Status)
55 lastResult = status
56 SetNativeBrush(nativeBrush)
57 End Sub
58
59Protected
60 Sub SetNativeBrush(nativeBrush As *GpBrush)
61 This.nativeBrush = nativeBrush
62 End Sub
63
64 Function SetStatus(status As Gdiplus.Status) As Gdiplus.Status
65 If status != Gdiplus.Status.Ok Then
66 lastResult = status
67 End If
68 Return status
69 End Function
70
71 nativeBrush As *GpBrush
72 /*Mutable*/ lastResult As Gdiplus.Status
73End Class
74
75class SolidBrush
76 Inherits Brush
77Public
78
79 Sub SolidBrush(color As Color)
80 Dim brush = 0 As *GpSolidFill
81 lastResult = GdiPlus.DllExports.GdipCreateSolidFill(color.Value, brush)
82 SetNativeBrush(brush)
83 End Sub
84
85 Const Function GetColor(ByRef color As Color) As Gdiplus.Status
86 Dim argb As ARGB
87 SetStatus(GdiPlus.DllExports.GdipGetSolidFillColor(nativeBrush As *GpSolidFill, argb))
88 color = New Color(argb)
89 Return lastResult
90 End Function
91
92 Function SetColor(color As Color) As Gdiplus.Status
93 Return SetStatus(GdiPlus.DllExports.GdipSetSolidFillColor(nativeBrush As *GpSolidFill, color.Value))
94 End Function
95
96'Protected
97 Sub SolidBrush()
98 End Sub
99End Class
100
101End Namespace 'Drawing
102End Namespace 'System
Note: See TracBrowser for help on using the repository browser.