Using GDIPLUS, add multiple point array data, or add multiple lines (such as straight lines, arcs, Seebel curves, etc.)
You can set the color of the border line path, fill the color, and later use images to draw texture tiles..
I want to use this method to draw any shape, such as drawing a triangle or other shape. It can achieve arbitrary enlargement and drawing.
Just need to enlarge the corresponding coordinate data to the specified multiple.
The function is not yet completed, mainly a design concept, and everyone can expand more gameplay on this basis.
Now draw a polygon based on multiple input points, but this feature has not been successfully tested yet.
how to fix this code?
GdipAddPathLine path, x + RoundSize, y, x + width - RoundSize, y
GdipAddPathArcI path, x + width - RoundSize * 2, y, RoundSize * 2, RoundSize * 2, 270, 90
DrawStart graphics, SBorderWidth, vbRed, vbYellow
Dim Point(2) As PointF
With Point(0)
.x = 150
.y = 0
End With
With Point(1)
.x = 300
.y = 250
End With
With Point(2)
.x = 0
.y = 250
End With
AddLineList Point()
DrawIt
Sub AddLineList(PointArr() As PointF)
'more than 3 porints
Dim i As Long
For i = 1 To UBound(PointArr)
GdipAddPathLine path, PointArr(i - 1).x, PointArr(i - 1).y, PointArr(i).x, PointArr(i).y
Next
End Sub
Shape enlargement and deformation allow for the specification of the starting position and the size of the drawing range, resulting in a vector like effect that can be widened or narrowed while maintaining image clarity.
Sub AddPointListPlus(PointArr() As PointF, WIDTH As Long, Height As Long, Optional Left As Long, Optional Top As Long)
'more than 3 porints
Dim i As Long, MaxWIDTH As Long, MaxHeight As Long
For i = 0 To UBound(PointArr)
If PointArr(i).x > MaxWIDTH Then MaxWIDTH = PointArr(i).x
If PointArr(i).y > MaxHeight Then MaxHeight = PointArr(i).y
Next
Dim BLX As Single, BlY As Single
BLX = WIDTH / MaxWIDTH
BlY = Height / MaxHeight
For i = 1 To UBound(PointArr)
GdipAddPathLine path, Left + (PointArr(i - 1).x * BLX), Top + PointArr(i - 1).y * BlY, Left + PointArr(i).x * BLX, Top + PointArr(i).y * BlY
Next
End Sub