ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

FBSL - Drawing a nice avatar...

(1/1)

Gerome:
Hello,

The following snippet will draw a nice avatar onto a form  :Thmbsup:
You can use the 'online compiler' to see the results...

--- ---Dim %hdc = GetDC(ME)
Const WM_DRAW = WM_USER + &H100

Fbsl_SetText(ME, "SideshowBob's Special")
Resize(ME, 0, 0, 50, 150)
Center(ME)
Show(ME)
Draw()

Begin Events
Select Case CBMSG
Case WM_DRAW
Draw()
Case WM_PAINT, WM_NCPAINT
PostMessage(ME, WM_DRAW, 0, 0)
Case WM_CLOSE
ReleaseDC(ME, hdc)
ExitProgram(0)
End Select
End Events

Sub Draw()
'=======
' Hair
'=======
Arc(hdc, 25, 41, 8, 56, 0, 3)
Arc(hdc, 8, 56, 20, 27, 0, -0.3)
Arc(hdc, 20, 28, 0, 38, 0, 3)
Arc(hdc, 0, 38, 24, 13, 0, -0.3)
Arc(hdc, 24, 13, 7, 8, 0, 0.3)
Arc(hdc, 7, 9, 42, 9, 0, -2)
Arc(hdc, 41, 9, 64, 2, 0, -0.4)
Arc(hdc, 64, 4, 53, 13, 0, 2)
Arc(hdc, 53, 14, 79, 22, 0, -2)
Arc(hdc, 79, 22, 62, 21, 0, 0.3)
Arc(hdc, 62, 21, 76, 46, 0, -2)
Arc(hdc, 76, 46, 62, 32, 0, 0.5)
Arc(hdc, 62, 32, 66, 62, 0, -3)
Arc(hdc, 66, 62, 60, 51, 0, 0.5)
Arc(hdc, 61, 41, 48, 67, 0, -0.3)
Arc(hdc, 48, 67, 44, 42, 0, 0.2)
Arc(hdc, 46, 35, 40, 49, 0, -0.1)
Arc(hdc, 40, 49, 34, 35, 0, 0.05)
Arc(hdc, 34, 35, 26, 46, 0, -0.05)
Arc(hdc, 26, 46, 20, 35, 0, 0.05)
Fill(hdc, 30, 30, Rgb(196, 0, 52))
'=======
' Face
'=======
Arc(hdc, 46, 49, 41, 60, 0, 7)
Arc(hdc, 39, 61, 38, 66, 0, -2)
Arc(hdc, 40, 66, 38, 84, 0, 7)
Arc(hdc, 24, 43, 22, 54, 0, 3)
Arc(hdc, 27, 49, 20, 63, 0, 5)
Arc(hdc, 20, 63, 26, 62, 0, 3)
Arc(hdc, 26, 62, 19, 65, 0, -1)
Arc(hdc, 20, 66, 16, 69, 0, 3)
Arc(hdc, 16, 69, 35, 68, 0, 4)
Arc(hdc, 22, 69, 29, 85, 0, 0.1)
Arc(hdc, 29, 83, 28, 95, 0, 7)
Arc(hdc, 28, 93, 38, 84, 0, -0.3)
'=======
' Eyes
'=======
Arc(hdc, 30, 48, 40, 48, 0, 1.4)
Arc(hdc, 29, 50, 40, 50, 0, 0.1)
Arc(hdc, 30, 56, 36, 57, 0, 0.3)
Arc(hdc, 21, 50, 26, 50, 0, 0.1)
PSet(hdc, 23, 51)
PSet(hdc, 35, 51)
PSet(hdc, 40, 62)
Fill(hdc, 30, 45, Rgb(250, 215, 0))
'=======
' Shirt
'=======
Arc(hdc, 15, 90, 50, 90, 0, 0.7)
Arc(hdc, 14, 90, 29, 83, 0, -0.3)
Arc(hdc, 39, 84, 50, 90, 0, -3)
Arc(hdc, 23, 92, 29, 83, 0, -0.3)
Arc(hdc, 38, 94, 44, 85, 0, -0.3)
Arc(hdc, 33, 88, 38, 94, 0, -3)
Fill(hdc, 30, 95, Rgb(55, 115, 44))
End Sub

jgpaiva:
 ;D ;D This one sure is worth compiling!
Have a look :)

Navigation

[0] Message Index

Go to full version