Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
24
Task/Colour-bars-Display/Sidef/colour-bars-display.sidef
Normal file
24
Task/Colour-bars-Display/Sidef/colour-bars-display.sidef
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
require('GD');
|
||||
|
||||
var colors = Hash.new(
|
||||
white => [255, 255, 255],
|
||||
red => [255, 0, 0],
|
||||
green => [0, 255, 0],
|
||||
blue => [0, 0, 255],
|
||||
magenta => [255, 0, 255],
|
||||
yellow => [255, 255, 0],
|
||||
cyan => [0, 255, 255],
|
||||
black => [0, 0, 0],
|
||||
);
|
||||
|
||||
var barwidth = 160/8;
|
||||
var image = %s'GD::Image'.new(160, 100);
|
||||
var start = 0;
|
||||
|
||||
colors.values.each { |rgb|
|
||||
var paintcolor = image.colorAllocate(rgb...);
|
||||
image.filledRectangle(start * barwidth, 0, start*barwidth + barwidth - 1, 99, paintcolor);
|
||||
start++;
|
||||
};
|
||||
|
||||
%f'colorbars.png'.open('>:raw').print(image.png);
|
||||
Loading…
Add table
Add a link
Reference in a new issue