[bb] Draw gradiented surface! by ChrML [ 1+ years ago ]

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

Previous topic - Next topic

BlitzBot

Title : Draw gradiented surface!
Author : ChrML
Posted : 1+ years ago

Description : I sat today for 10 mins, and made a little function which lets you draw gradiented surfaces out of lines. This method is a lot faster than with WritePixelFast. It can gradiate between any colors!

Code :
Code (blitzbasic) Select
Function DrawGradientSurface(sred#,sgreen#,sblue#,dred#,dgreen#,dblue#,x%,y%,width#,height#)
  eachxred#=(dred#-sred#)/width#
  eachxgreen#=(dgreen#-sgreen#)/width#
  eachxblue#=(dblue#-sblue#)/width#

  tempwidth%=width#

  For tempx=x% To x%+tempwidth%
    colr = eachxred#*count+sred
    colg = eachxgreen#*count+sgreen
    colb = eachxblue#*count+sblue

    Color colr,colg,colb
    Line tempx,y%,tempx,y%+height#

    count=count+1
  Next
End Function


Comments : none...