Code archives/Graphics/Draw gradiented surface!

This code has been declared by its author to be Public Domain code.

Download source code

Draw gradiented surface! by ChrML2003
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!
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.

Code Archives Forum