Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
23
Task/Bitmap/Visual-Basic-.NET/bitmap-1.vb
Normal file
23
Task/Bitmap/Visual-Basic-.NET/bitmap-1.vb
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
' The StructLayout attribute allows fields to overlap in memory.
|
||||
<System.Runtime.InteropServices.StructLayout(LayoutKind.Explicit)> _
|
||||
Public Structure Rgb
|
||||
|
||||
<FieldOffset(0)> _
|
||||
Public Rgb As Integer
|
||||
|
||||
<FieldOffset(0)> _
|
||||
Public B As Byte
|
||||
|
||||
<FieldOffset(1)> _
|
||||
Public G As Byte
|
||||
|
||||
<FieldOffset(2)> _
|
||||
Public R As Byte
|
||||
|
||||
Public Sub New(ByVal r As Byte, ByVal g As Byte, ByVal b As Byte)
|
||||
Me.R = r
|
||||
Me.G = g
|
||||
Me.B = b
|
||||
End Sub
|
||||
|
||||
End Structure
|
||||
39
Task/Bitmap/Visual-Basic-.NET/bitmap-2.vb
Normal file
39
Task/Bitmap/Visual-Basic-.NET/bitmap-2.vb
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
Public Class RasterBitmap
|
||||
|
||||
Private m_pixels() As Rgb
|
||||
|
||||
Private m_width As Integer
|
||||
Public ReadOnly Property Width As Integer
|
||||
Get
|
||||
Return m_width
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_height As Integer
|
||||
Public ReadOnly Property Height As Integer
|
||||
Get
|
||||
Return m_height
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub New(ByVal width As Integer, ByVal height As Integer)
|
||||
m_pixels = New Rgb(width * height - 1) {}
|
||||
m_width = width
|
||||
m_height = height
|
||||
End Sub
|
||||
|
||||
Public Sub Clear(ByVal color As Rgb)
|
||||
For i As Integer = 0 To m_pixels.Length - 1
|
||||
m_pixels(i) = color
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Public Sub SetPixel(ByVal x As Integer, ByVal y As Integer, ByVal color As Rgb)
|
||||
m_pixels((y * m_width) + x) = color
|
||||
End Sub
|
||||
|
||||
Public Function GetPixel(ByVal x As Integer, ByVal y As Integer) As Rgb
|
||||
Return m_pixels((y * m_width) + x)
|
||||
End Function
|
||||
|
||||
End Class
|
||||
Loading…
Add table
Add a link
Reference in a new issue