Greyscale bars/Display: Difference between revisions
Content added Content deleted
No edit summary |
(Added Processing implementation) |
||
Line 1,421: | Line 1,421: | ||
If the flag is not set, put "left-to-right" into the gradient's direction. |
If the flag is not set, put "left-to-right" into the gradient's direction. |
||
Draw the gradient.</lang> |
Draw the gradient.</lang> |
||
=={{header|Processing}}== |
|||
<lang java> |
|||
//Aamrun, 3rd July 2022 |
|||
void drawPanel(int startColour,int endColour,int bars,int startY){ |
|||
int rectWidth = width / bars,rectHeight = height / 4, startX = 0,increment; |
|||
increment = (endColour - startColour)/(bars-1); |
|||
for(int i = 0;i < bars;i++){ |
|||
fill(startColour + i*increment); |
|||
rect(startX + i*rectWidth,startY,rectWidth,rectHeight); |
|||
} |
|||
} |
|||
void setup(){ |
|||
size(1280,960); |
|||
drawPanel(0,255,8,0); |
|||
drawPanel(255,0,16,height/4); |
|||
drawPanel(0,255,32,height/2); |
|||
drawPanel(255,0,64,3*height/4); |
|||
} |
|||
</lang> |
|||
=={{header|PureBasic}}== |
=={{header|PureBasic}}== |