Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,17 +0,0 @@
|
|||
package Bitmap_Store is
|
||||
type Luminance is mod 2**8;
|
||||
type Pixel is record
|
||||
R, G, B : Luminance := Luminance'First;
|
||||
end record;
|
||||
Black : constant Pixel := (others => Luminance'First);
|
||||
White : constant Pixel := (others => Luminance'Last);
|
||||
type Image is array (Positive range <>, Positive range <>) of Pixel;
|
||||
|
||||
procedure Fill (Picture : in out Image; Color : Pixel);
|
||||
|
||||
procedure Print (Picture : Image);
|
||||
|
||||
type Point is record
|
||||
X, Y : Positive;
|
||||
end record;
|
||||
end Bitmap_Store;
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
with Ada.Text_IO; use Ada.Text_IO;
|
||||
|
||||
package body Bitmap_Store is
|
||||
|
||||
procedure Fill (Picture : in out Image; Color : Pixel) is
|
||||
begin
|
||||
for p of Picture loop x:= Color;end loop;
|
||||
end Fill;
|
||||
|
||||
procedure Print (Picture : Image) is
|
||||
begin
|
||||
for I in Picture'Range (1) loop
|
||||
for J in Picture'Range (2) loop
|
||||
Put (if Picture (I, J) = White then ' ' else 'H');
|
||||
end loop;
|
||||
New_Line;
|
||||
end loop;
|
||||
end Print;
|
||||
|
||||
end Bitmap_Store;
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
use Bitmap_Store; with Bitmap_Store;
|
||||
...
|
||||
X : Image (1..64, 1..64);
|
||||
begin
|
||||
Fill (X, (255, 255, 255));
|
||||
X (1, 2) := (R => 255, others => 0);
|
||||
X (3, 4) := X (1, 2);
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
class RGBColor
|
||||
getter red, green, blue
|
||||
|
||||
def initialize(@red = 0_u8, @green = 0_u8, @blue = 0_u8)
|
||||
end
|
||||
|
||||
RED = new(red: 255_u8)
|
||||
GREEN = new(green: 255_u8)
|
||||
BLUE = new(blue: 255_u8)
|
||||
BLACK = new
|
||||
WHITE = new(255_u8, 255_u8, 255_u8)
|
||||
end
|
||||
|
||||
class Pixmap
|
||||
getter width, height
|
||||
@data : Array(Array(RGBColor))
|
||||
|
||||
def initialize(@width : Int32, @height : Int32)
|
||||
@data = Array.new(@width) { Array.new(@height, RGBColor::WHITE) }
|
||||
end
|
||||
|
||||
def fill(color)
|
||||
@data.each &.fill(color)
|
||||
end
|
||||
|
||||
def [](x, y)
|
||||
@data[x][y]
|
||||
end
|
||||
|
||||
def []=(x, y, color)
|
||||
@data[x][y] = color
|
||||
end
|
||||
end
|
||||
|
||||
bmap = Pixmap.new(5, 5)
|
||||
pp bmap
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
-- Some color constants:
|
||||
constant
|
||||
black = #000000,
|
||||
white = #FFFFFF,
|
||||
red = #FF0000,
|
||||
green = #00FF00,
|
||||
blue = #0000FF
|
||||
|
||||
-- Create new image filled with some color
|
||||
function new_image(integer width, integer height, atom fill_color)
|
||||
return repeat(repeat(fill_color,height),width)
|
||||
end function
|
||||
|
||||
-- Usage example:
|
||||
sequence image
|
||||
image = new_image(800,600,black)
|
||||
|
||||
-- Set pixel color:
|
||||
image[400][300] = red
|
||||
|
||||
-- Get pixel color
|
||||
atom color
|
||||
color = image[400][300] -- Now color is #FF0000
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
local canvas = require "canvas"
|
||||
|
||||
-- Create a new canvas object: 400 pixels wide and 400 pixels high.
|
||||
local c = canvas.new(400, 400)
|
||||
|
||||
-- Color the whole canvas blue.
|
||||
c:fill(0xff0000)
|
||||
|
||||
-- Draw a red square in the middle.
|
||||
for i = 1, 51 do
|
||||
for j = 1, 51 do
|
||||
c:set(174 + i, 174 + j, 0x0000ff)
|
||||
end
|
||||
end
|
||||
|
||||
-- Print to the terminal the color (as an integer) of a pixel.
|
||||
print(c:get(200, 200)) -- 255
|
||||
|
||||
-- Convert the canvas to a BMP image.
|
||||
local image = c:tobmp()
|
||||
|
||||
-- Save the image to a file.
|
||||
io.contents("mybmp.bmp", image)
|
||||
Loading…
Add table
Add a link
Reference in a new issue