using Gdip.Tutorial.1-Draw.Shapes.ahk as a starting point. Replace the code:
Code:
; Create a fully opaque red brush (ARGB = Transparency, red, green, blue) to draw a circle
pBrush := Gdip_BrushCreateSolid(0xffff0000)
; Fill the graphics of the bitmap with an ellipse using the brush created
; Filling from coordinates (100,50) an ellipse of 200x300
Gdip_FillEllipse(G, pBrush, 100, 50, 200, 300)
; Delete the brush as it is no longer needed and wastes memory
Gdip_DeleteBrush(pBrush)
; Create a slightly transparent (66) blue brush (ARGB = Transparency, red, green, blue) to draw a rectangle
pBrush := Gdip_BrushCreateSolid(0x660000ff)
; Fill the graphics of the bitmap with a rectangle using the brush created
; Filling from coordinates (250,80) a rectangle of 300x200
Gdip_FillRectangle(G, pBrush, 250, 80, 300, 200)
; Delete the brush as it is no longer needed and wastes memory
Gdip_DeleteBrush(pBrush)
With
Code:
; Create a fully opaque red pen (ARGB = Transparency, red, green, blue)
pPen1 := Gdip_CreatePen(0xffff0000,3)
; Create a fully opaque green pen (ARGB = Transparency, red, green, blue)
pPen2 := Gdip_CreatePen(0xff00ff00,3)
; The length of the wavy line
WavyLen := 200
; The number of the waves (smaller=more, larger=less)
WavyX := 20
; The depth of the waves (smaller=flatter, larger=curved)
WavyY := 10
; The starting position
StartX := 10
StartY := 10
PrevX := StartX
PrevY := StartY
; Paint the Sine Wave
WavyIdx=0
Loop,%WavyLen%
{
NewX := StartX + WavyIdx
NewY := StartY + (Sin(WavyIdx/WavyX)*WavyY)
Gdip_DrawLine(G, pPen1, PrevX, PrevY, NewX, NewY)
PrevX := NewX
PrevY := NewY
WavyIdx++
}
Gdip_DrawLine(G, pPen2, StartX, StartY+(WavyY*2), StartX+WavyLen, StartY+(WavyY*2))
; Delete the pens as they are no longer needed and wastes memory
Gdip_DeletePen(pPen1)
Gdip_DeletePen(pPen2)