Created
December 10, 2014 09:33
-
-
Save mikequentel/6bfc40638ca4a789f8e2 to your computer and use it in GitHub Desktop.
How to Create a Text File List of RGB Values in Ada
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with Ada.Text_IO; use Ada.Text_IO; | |
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; | |
with Ada.Strings; use Ada.Strings; | |
with Ada.Strings.Fixed; use Ada.Strings.Fixed; | |
procedure rgb is | |
subtype Rgb_Int is integer range 0..255; | |
fp: File_Type; | |
r: Rgb_Int := 255; | |
g: Rgb_Int := 255; | |
b: Rgb_Int := 255; | |
begin | |
create(File=>fp, Mode=>Out_File, Name=>"true_colour_ada.txt"); | |
for r in reverse 0..255 loop | |
for g in reverse 0..255 loop | |
for r in reverse 0..255 loop | |
Put_Line(fp, Trim(Rgb_Int'Image(r), Left) & "," & Trim(Rgb_Int'Image(g), Left) & "," & Trim(Rgb_Int'Image(b), Left)); | |
end loop; | |
end loop; | |
end loop; | |
close(fp); | |
end rgb; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ada version of the same example in C http://mikequentelsoftware.blogspot.ca/2010/11/how-to-create-text-file-of-rgb-values.html