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
15
Task/Grayscale-image/Phix/grayscale-image.phix
Normal file
15
Task/Grayscale-image/Phix/grayscale-image.phix
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
function to_gray(sequence image)
|
||||
sequence color
|
||||
for i=1 to length(image) do
|
||||
for j=1 to length(image[i]) do
|
||||
-- unpack color triple
|
||||
color = sq_div(sq_and_bits(image[i][j], {#FF0000,#FF00,#FF}),
|
||||
{#010000,#0100,#01})
|
||||
image[i][j] = floor(0.2126*color[1] + 0.7152*color[2] + 0.0722*color[3])*#010101
|
||||
end for
|
||||
end for
|
||||
return image
|
||||
end function
|
||||
|
||||
sequence img = read_ppm("Lena.ppm")
|
||||
img = to_gray(img)
|
||||
Loading…
Add table
Add a link
Reference in a new issue