Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Another way to draw rounded rectangles
#2
A simpler version of your packcolor, which you might want to use to help things run a little more efficiently, if that's ever an issue for you:

Code: (Select All)
$Color:32
Print packcolorN(Red), pcN(Red)
Print packcolorN(Green), pcN(Green)
Print packcolorN(Blue), pcN(Blue)
Print packcolorN(Gold), pcN(Gold)
Print packcolorN(BrickRed), pcN(BrickRed)



Function pcN$ (klr As _Unsigned Long)
pcN$ = "#" + Right$("000000" + Hex$(klr And &HFFFFFF), 6)
End Function


Function packcolorN$ (klr As _Unsigned Long)
'convert an unsigned long color value into a hexidecimal string # that will be used in an SVG
Dim As _Unsigned Long rk, gk, bk
'get the color channels of the unsinged long color
rk = _Red32(klr)
gk = _Green32(klr)
bk = _Blue32(klr)
'convert those channel values into hexidecimal
If rk < 16 Then
r$ = "0" + Hex$(rk) 'put in a padded hexidcimal value
Else
r$ = Hex$(rk) 'put in a 2 digit hexidecimal value
End If
If gk < 16 Then
g$ = "0" + Hex$(gk) 'put in a padded hexidcimal value
Else
g$ = Hex$(gk) 'put in a 2 digit hexidecimal value
End If
If bk < 16 Then
b$ = "0" + Hex$(bk) 'put in a padded hexidcimal value
Else
b$ = Hex$(bk) 'put in a 2 digit hexidecimal value
End If
packcolorN$ = "#" + r$ + g$ + b$
End Function
Reply


Messages In This Thread
RE: Another way to draw rounded rectangles - by SMcNeill - 09-19-2024, 09:12 PM



Users browsing this thread: 1 Guest(s)