Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
1
Task/Grayscale-image/Ada/grayscale-image-1.ada
Normal file
1
Task/Grayscale-image/Ada/grayscale-image-1.ada
Normal file
|
|
@ -0,0 +1 @@
|
|||
type Grayscale_Image is array (Positive range <>, Positive range <>) of Luminance;
|
||||
20
Task/Grayscale-image/Ada/grayscale-image-2.ada
Normal file
20
Task/Grayscale-image/Ada/grayscale-image-2.ada
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
function Grayscale (Picture : Image) return Grayscale_Image is
|
||||
type Extended_Luminance is range 0..10_000_000;
|
||||
Result : Grayscale_Image (Picture'Range (1), Picture'Range (2));
|
||||
Color : Pixel;
|
||||
begin
|
||||
for I in Picture'Range (1) loop
|
||||
for J in Picture'Range (2) loop
|
||||
Color := Picture (I, J);
|
||||
Result (I, J) :=
|
||||
Luminance
|
||||
( ( 2_126 * Extended_Luminance (Color.R)
|
||||
+ 7_152 * Extended_Luminance (Color.G)
|
||||
+ 722 * Extended_Luminance (Color.B)
|
||||
)
|
||||
/ 10_000
|
||||
);
|
||||
end loop;
|
||||
end loop;
|
||||
return Result;
|
||||
end Grayscale;
|
||||
10
Task/Grayscale-image/Ada/grayscale-image-3.ada
Normal file
10
Task/Grayscale-image/Ada/grayscale-image-3.ada
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
function Color (Picture : Grayscale_Image) return Image is
|
||||
Result : Image (Picture'Range (1), Picture'Range (2));
|
||||
begin
|
||||
for I in Picture'Range (1) loop
|
||||
for J in Picture'Range (2) loop
|
||||
Result (I, J) := (others => Picture (I, J));
|
||||
end loop;
|
||||
end loop;
|
||||
return Result;
|
||||
end Color;
|
||||
Loading…
Add table
Add a link
Reference in a new issue