[bb] Gradient Rect by Snarty [ 1+ years ago ]

Started by BlitzBot, June 29, 2017, 00:28:43

Previous topic - Next topic

BlitzBot

Title : Gradient Rect
Author : Snarty
Posted : 1+ years ago

Description : Used in my projects, thought it's about time I shared this, simple to use fast as fudge. Main use was for title bars of windows, obviously :)

Code :
Code (blitzbasic) Select
; Written By Paul Snart
; Copyright Pacific Software
; Open Source (Credit where credit is due)

Function GradientBar(x,y,w#,h,r1#,g1#,b1#,r2#,g2#,b2#)

NumSteps#=w-1

If NumSteps>0
StRd#=(r2-r1)/NumSteps
NRd#=r1
StGr#=(g2-g1)/NumSteps
NGr#=g1
StBl#=(b2-b1)/NumSteps
NBl#=b1
For dw=1 To w-1
Color NRd,NGr,NBl
Line x+dw,y+1,x+dw,y+h-1
NRd=NRd+StRd
NGr=NGr+StGr
NBl=NBl+StBl
Next
EndIf

End Function


Comments : none...