#INCLUDE "windows.bi"
#INCLUDE "win/gdiplus.bi"
Using GDIPLUS
Dim wc As WNDCLASSEX
Dim  msg As MSG
Dim ULONG_PTR_01 As ULONG_PTR
Dim GDIPLUSSTARTUPINPUT_01 As GDIPLUSSTARTUPINPUT
GDIPLUSSTARTUPINPUT_01.GdiplusVersion = 1
If (GDIPLUSSTARTUP(@ULONG_PTR_01, @GDIPLUSSTARTUPINPUT_01, NULL) <> 0) Then
	Print "FAIL"
EndIf
Sub OnPaint(compHdc As HDC)
	Dim As PVOID GpGraphics,pthGrBrush,path
	Dim As Integer count=10
	Dim As ARGB colors(9)={_
	&hFF000000,&hFF00FF00,&hFF0000FF,_
	&hFFFFFFFF,&hFF000000,&hFF00FF00,_
	&hFF0000FF,&hFFFFFFFF,&hFF000000,&hFF00FF00}
	Dim As GPPointF points(9)
	points(0).x=75  : points(0).y=0
	points(1).x=100 : points(1).y=50
	points(2).x=150 : points(2).y=50
	points(3).x=112 : points(3).y=75	
	points(4).x=150 : points(4).y=150
	points(5).x=75  : points(5).y=100
	points(6).x=0   : points(6).y=150
	points(7).x=37  : points(7).y=75		
	points(8).x=0   : points(8).y=50
	points(9).x=50  : points(9).y=50	
	GdipCreateFromHDC(compHdc,@GpGraphics)
	GdipGraphicsClear(GpGraphics,&hffffffff)
	GdipCreatePath(FillModeAlternate,@path)
	GdipAddPathLine2(path,@points(0),10)
	GdipCreatePathGradientFromPath(path,@pthGrBrush)
	GdipSetPathGradientCenterColor(pthGrBrush,&hffff0000)
	GdipSetPathGradientSurroundColorsWithCount(pthGrBrush,@colors(0), @count)
	GdipFillPath(GpGraphics,pthGrBrush,path)
	GdipSetLineGammaCorrection(pthGrBrush,TRUE)
	GdipTranslateWorldTransform(GpGraphics,200.0, 0.0,MatrixOrderPrepend)
	GdipFillPath(GpGraphics,pthGrBrush,path)
	GdipDeletePath(path)
	GdipDeleteBrush(pthGrBrush)
	GdipDeleteGraphics(GpGraphics)
End Sub
Function WndProc(hWnd As HWND,uMsg As UINT,wParam As WPARAM,lParam As LPARAM) As Integer
	Dim ps As PAINTSTRUCT
	Static As HDC compHdc,hdc
	Select Case uMsg
		Case WM_CLOSE
			DeleteDC(compHdc)
			PostQuitMessage(0)
		Case WM_CREATE
			hdc=GetDC(GetDesktopWindow)
			compHdc=CreateCompatibleDC(hdc)
			Var bitmap = CreateCompatibleBitmap(hdc,GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN))
			SelectObject(compHdc,bitmap)
			DeleteObject(bitmap)
			ReleaseDC(GetDesktopWindow,hdc)
			OnPaint(compHdc)
			InvalidateRect(hwnd,0,0)
		Case WM_PAINT
			BeginPaint(hWnd,@ps)
			BitBlt(ps.hdc,ps.rcPaint.left,ps.rcPaint.top,ps.rcPaint.right-ps.rcPaint.left,ps.rcPaint.bottom-ps.rcPaint.top,compHdc,ps.rcPaint.left,ps.rcPaint.top,SRCCOPY)
			EndPaint(hWnd,@ps)
			Return 0
		Case Else
			Return DefWindowProc(hWnd,uMsg,wParam,lParam)
	End Select
End Function

With wc
	.hInstance=GetModuleHandle(0)
	.cbSize=SizeOf(WNDCLASSEX)
	.style=CS_HREDRAW Or CS_VREDRAW
	.lpfnWndProc=@WndProc
	.lpszClassName=StrPtr("class")
	.hCursor=LoadCursor(NULL,IDC_ARROW)
End With
RegisterClassEx(@wc)
CreateWindowEx(0,wc.lpszClassName,"DrawGDI+",WS_OVERLAPPEDWINDOW Or WS_VISIBLE,200,200,375,200,0,0,wc.hInstance,0)

While GetMessage(@msg,0,0,0)
	TranslateMessage(@msg)
	DispatchMessage(@msg)
Wend