source: branch/egtra-gdiplus/Classes/System/Drawing/TextureBrush.ab@ 711

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

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

File size: 5.0 KB
Line 
1'Classes/System/Drawing/TextureBrush.ab
2
3#require <gdiplusflat.ab>
4#require <System/Drawing/Brush.ab>
5#require <System/Drawing/Image.ab>
6#require <System/Drawing/Rectangle.ab>
7#require <System/Drawing/RectangleF.ab>
8#require <System/Drawing/Imaging/ImageAttributes.ab>
9#require <System/Drawing/Drawing2D/misc.ab>
10
11Namespace System
12Namespace Drawing
13
14Class TextureBrush
15 Inherits Brush
16Public
17 Sub TextureBrush(image As Image, wrapMode = Drawing2D.WrapMode.Tile As Drawing2D.WrapMode)
18 Dim texture = 0 As *GpTexture
19 lastResult = GdiPlus.DllExports.GdipCreateTexture(image.NativeImage, wrapMode, texture)
20 SetNativeBrush(texture)
21 End Sub
22
23 Sub TextureBrush(image As Image, wrapMode As Drawing2D.WrapMode, dstRect As /*Const*/ RectangeF)
24 Dim texture = 0 As *GpTexture
25 lastResult = GdiPlus.DllExports.GdipCreateTexture2(image.NativeImage, wrapMode, dstRect.X, dstRect.Y, dstRect.Width, dstRect.Height, texture)
26 SetNativeBrush(texture)
27 End Sub
28
29 Sub TextureBrush(image As Image, dstRect As /*Const*/ RectangeF, imageAttributes = Nothing As /*Const*/ Imaging.ImageAttributes)
30 Dim texture = 0 As *GpTexture
31 lastResult = GdiPlus.DllExports.GdipCreateTextureIA(image.nativeImage, Imaging.ImageAttributes.Native(imageAttributes), dstRect.X, dstRect.Y, dstRect.Width, dstRect.Height, texture)
32 SetNativeBrush(texture)
33 End Sub
34
35 Sub TextureBrush(image As Image, dstRect As /*Const*/ Rectange, imageAttributes = Nothing As /*Const*/ Imaging.ImageAttributes)
36 Dim texture = 0 As *GpTexture
37 lastResult = GdiPlus.DllExports.GdipCreateTextureIAI(image.nativeImage, Imaging.ImageAttributes.Native(imageAttributes), dstRect.X, dstRect.Y, dstRect.Width, dstRect.Height, texture)
38 SetNativeBrush(texture)
39 End Sub
40
41 Sub TextureBrush(image As Image, wrapMode As Drawing2D.WrapMode, dstRect As /*Const*/ Rectange)
42 Dim texture = 0 As *GpTexture
43 lastResult = GdiPlus.DllExports.GdipCreateTexture2I(image.NativeImage, wrapMode, dstRect.X, dstRect.Y, dstRect.Width, dstRect.Height, texture)
44 SetNativeBrush(texture)
45 End Sub
46
47 Sub TextureBrush(image As Image, wrapMode As Drawing2D.WrapMode, dstX As Single, dstY As Single, dstWidth As Single, dstHeight As Single)
48 Dim texture = 0 As *GpTexture
49 lastResult = GdiPlus.DllExports.GdipCreateTexture2(image.nativeImage, wrapMode, dstX, dstY, dstWidth, dstHeight, texture)
50 SetNativeBrush(texture)
51 End Sub
52
53 Sub TextureBrush(image As Image, wrapMode As Drawing2D.WrapMode, dstX As Long, dstY As Long, dstWidth As Long, dstHeight As Long)
54 Dim texture = 0 As *GpTexture
55 lastResult = GdiPlus.DllExports.GdipCreateTexture2I(image.nativeImage, wrapMode, dstX, dstY, dstWidth, dstHeight, texture)
56 SetNativeBrush(texture)
57 End Sub
58
59 Function Transform(matrix As /*Const*/ Drawing2D.Matrix) As Gdiplus.Status
60 return SetStatus(GdiPlus.DllExports.GdipSetTextureTransform(nativeBrush As *GpTexture, matrix.NativeMatrix))
61 End Function
62
63 Const Function Transform() As Drawing2D.Matrix
64 Transform = New Drawing2D.Matrix
65 SetStatus(GdiPlus.DllExports.GdipGetTextureTransform(nativeBrush As *GpTexture, Transform.NativeMatrix))
66 End Function
67
68 Function ResetTransform() As Gdiplus.Status
69 return SetStatus(GdiPlus.DllExports.GdipResetTextureTransform(nativeBrush As *GpTexture))
70 End Function
71
72 Function MultiplyTransform(matrix As /*Const*/ Drawing2D.Matrix, order = Drawing2D.MatrixOrder.Prepend As Drawing2D.MatrixOrder) As Gdiplus.Status
73 return SetStatus(GdiPlus.DllExports.GdipMultiplyTextureTransform(nativeBrush As *GpTexture, matrix.NativeMatrix, order))
74 End Function
75
76 Function TranslateTransform(dx As Single, dy As Single, order = Drawing2D.MatrixOrder.Prepend As Drawing2D.MatrixOrder) As Gdiplus.Status
77 return SetStatus(GdiPlus.DllExports.GdipTranslateTextureTransform(nativeBrush As *GpTexture, dx, dy, order))
78 End Function
79
80 Function ScaleTransform(sx As Single, sy As Single, order = Drawing2D.MatrixOrder.Prepend As Drawing2D.MatrixOrder) As Gdiplus.Status
81 return SetStatus(GdiPlus.DllExports.GdipScaleTextureTransform(nativeBrush As *GpTexture, sx, sy, order))
82 End Function
83
84 Function RotateTransform(angle As Single, order = Drawing2D.MatrixOrder.Prepend As Drawing2D.MatrixOrder) As Gdiplus.Status
85 return SetStatus(GdiPlus.DllExports.GdipRotateTextureTransform(nativeBrush As *GpTexture, angle, order))
86 End Function
87
88 Function WrapMode(wrapMode As Drawing2D.WrapMode) As Gdiplus.Status
89 return SetStatus(GdiPlus.DllExports.GdipSetTextureWrapMode(nativeBrush As *GpTexture, wrapMode))
90 End Function
91
92 Const Function WrapMode() As Drawing2D.WrapMode
93 SetStatus(GdiPlus.DllExports.GdipGetTextureWrapMode(nativeBrush As *GpTexture, WrapMode)
94 End Function
95
96 Const Function Image() As Image
97 Dim image As *GpImage
98 SetStatus(GdiPlus.DllExports.GdipGetTextureImage(nativeBrush As *GpTexture, image))
99
100 Image = New Image(image, lastResult)
101 If Object.ReferenceEquals(Image, Nothing) Then
102 GdiPlus.DllExports.GdipDisposeImage(image)
103 End If
104 End Function
105
106'protected:
107 Sub TextureBrush()
108 End Sub
109End Class
110
111End Namespace 'Drawing
112End Namespace 'System
113
Note: See TracBrowser for help on using the repository browser.