Ooops
March 05, 2021, 07:56:50 AM

Author Topic: [bb] Draw gradiented surface! by ChrML [ 1+ years ago ]  (Read 416 times)

Offline BlitzBot

[bb] Draw gradiented surface! by ChrML [ 1+ years ago ]
« on: June 29, 2017, 12:28:42 AM »
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
  1. Function DrawGradientSurface(sred#,sgreen#,sblue#,dred#,dgreen#,dblue#,x%,y%,width#,height#)
  2.   eachxred#=(dred#-sred#)/width#
  3.   eachxgreen#=(dgreen#-sgreen#)/width#
  4.   eachxblue#=(dblue#-sblue#)/width#
  5.  
  6.   tempwidth%=width#
  7.  
  8.   For tempx=x% To x%+tempwidth%
  9.     colr = eachxred#*count+sred
  10.     colg = eachxgreen#*count+sgreen
  11.     colb = eachxblue#*count+sblue
  12.  
  13.     Color colr,colg,colb
  14.     Line tempx,y%,tempx,y%+height#
  15.  
  16.     count=count+1
  17.   Next
  18. End Function


Comments : none...

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal