Code archives/Graphics/Draw gradiented surface!

This code has not been declared by its author to be Public Domain code, and therefore should not be assumed to be so.

Download source code

Draw gradiented surface! by ChrML
(Posted 23 years ago)
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