December 03, 2020, 08:11:57 PM

Author Topic: [bb] Gradient Rect by Snarty [ 1+ years ago ]  (Read 580 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
[bb] Gradient Rect by Snarty [ 1+ years ago ]
« on: June 29, 2017, 12:28:43 AM »
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
  1. ; Written By Paul Snart
  2. ; Copyright Pacific Software
  3. ; Open Source (Credit where credit is due)
  4.  
  5. Function GradientBar(x,y,w#,h,r1#,g1#,b1#,r2#,g2#,b2#)
  6.  
  7.         NumSteps#=w-1
  8.        
  9.         If NumSteps>0
  10.                 StRd#=(r2-r1)/NumSteps
  11.                 NRd#=r1
  12.                 StGr#=(g2-g1)/NumSteps
  13.                 NGr#=g1
  14.                 StBl#=(b2-b1)/NumSteps
  15.                 NBl#=b1
  16.                 For dw=1 To w-1
  17.                         Color NRd,NGr,NBl
  18.                         Line x+dw,y+1,x+dw,y+h-1
  19.                         NRd=NRd+StRd
  20.                         NGr=NGr+StGr
  21.                         NBl=NBl+StBl
  22.                 Next
  23.         EndIf
  24.  
  25. End Function


Comments : none...

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal