تابع ShadeColor

با سلام و سپاس

 

با تابع ShadeColor میتونید یه رنگ رو حالت سایه بهش بدید خیلی جالب میشه

Sub ShadeColor(clr As Int) As Int
Dim argb() As Int = GetARGB(clr)
Dim factor As Float = 0.75
Return Colors.RGB(argb(1) * factor, argb(2) * factor, argb(3) * factor)
End Sub

Sub GetARGB(Color As Int) As Int()
Private res(4) As Int
res(0) = Bit.UnsignedShiftRight(Bit.And(Color, 0xff000000), 24)
res(1) = Bit.UnsignedShiftRight(Bit.And(Color, 0xff0000), 16)
res(2) = Bit.UnsignedShiftRight(Bit.And(Color, 0xff00), 8)
res(3) = Bit.And(Color, 0xff)
Return res
End Sub

موفق باشید.

 

 

دیدگاهتان را بنویسید