raysetta 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +72 -0
- data/Rakefile +8 -0
- data/Steepfile +15 -0
- data/exe/raysetta +3 -0
- data/lib/raysetta/aabb.rb +116 -0
- data/lib/raysetta/background/base.rb +19 -0
- data/lib/raysetta/background/cube_map.rb +44 -0
- data/lib/raysetta/background/gradient.rb +28 -0
- data/lib/raysetta/background/solid.rb +24 -0
- data/lib/raysetta/background/sphere_map.rb +30 -0
- data/lib/raysetta/camera.rb +109 -0
- data/lib/raysetta/entity_base.rb +28 -0
- data/lib/raysetta/exe.rb +75 -0
- data/lib/raysetta/hit.rb +38 -0
- data/lib/raysetta/image.rb +46 -0
- data/lib/raysetta/interval.rb +63 -0
- data/lib/raysetta/material/base.rb +19 -0
- data/lib/raysetta/material/dielectric.rb +60 -0
- data/lib/raysetta/material/diffuse_light.rb +42 -0
- data/lib/raysetta/material/lambertian.rb +48 -0
- data/lib/raysetta/material/metal.rb +49 -0
- data/lib/raysetta/object/base.rb +23 -0
- data/lib/raysetta/object/box.rb +50 -0
- data/lib/raysetta/object/bvh.rb +81 -0
- data/lib/raysetta/object/group.rb +59 -0
- data/lib/raysetta/object/moving_sphere.rb +41 -0
- data/lib/raysetta/object/quad.rb +88 -0
- data/lib/raysetta/object/sphere.rb +68 -0
- data/lib/raysetta/object/tri.rb +46 -0
- data/lib/raysetta/output/base.rb +23 -0
- data/lib/raysetta/output/png.rb +26 -0
- data/lib/raysetta/output/ppm.rb +19 -0
- data/lib/raysetta/perlin.rb +91 -0
- data/lib/raysetta/ray.rb +28 -0
- data/lib/raysetta/runner/base.rb +28 -0
- data/lib/raysetta/runner/concurrent.rb +17 -0
- data/lib/raysetta/runner/processes.rb +26 -0
- data/lib/raysetta/runner/ractors.rb +32 -0
- data/lib/raysetta/runner/sync.rb +28 -0
- data/lib/raysetta/runner/threads.rb +26 -0
- data/lib/raysetta/runner.rb +45 -0
- data/lib/raysetta/scatter.rb +12 -0
- data/lib/raysetta/scene.rb +205 -0
- data/lib/raysetta/texture/base.rb +19 -0
- data/lib/raysetta/texture/checker.rb +55 -0
- data/lib/raysetta/texture/image.rb +57 -0
- data/lib/raysetta/texture/noise.rb +46 -0
- data/lib/raysetta/texture/solid_color.rb +36 -0
- data/lib/raysetta/tracer.rb +43 -0
- data/lib/raysetta/util.rb +38 -0
- data/lib/raysetta/vec2.rb +125 -0
- data/lib/raysetta/vec3.rb +214 -0
- data/lib/raysetta/version.rb +5 -0
- data/lib/raysetta.rb +44 -0
- data/mise.toml +2 -0
- data/scenes/box.json +26 -0
- data/scenes/cornell.json +108 -0
- data/scenes/cubemap.json +109 -0
- data/scenes/dumb.json +58 -0
- data/scenes/earth.json +79 -0
- data/scenes/example.json +11712 -0
- data/scenes/perlin.json +2126 -0
- data/scenes/quads.json +38 -0
- data/scenes/simple_light.json +2126 -0
- data/scenes/testcube.json +113 -0
- data/sig/raysetta/aabb.rbs +39 -0
- data/sig/raysetta/background/base.rbs +11 -0
- data/sig/raysetta/background/cube_map.rbs +9 -0
- data/sig/raysetta/background/gradient.rbs +10 -0
- data/sig/raysetta/background/solid.rbs +9 -0
- data/sig/raysetta/background/sphere_map.rbs +9 -0
- data/sig/raysetta/camera.rbs +41 -0
- data/sig/raysetta/entity_base.rbs +12 -0
- data/sig/raysetta/hit.rbs +21 -0
- data/sig/raysetta/image.rbs +13 -0
- data/sig/raysetta/interval.rbs +36 -0
- data/sig/raysetta/material/base.rbs +11 -0
- data/sig/raysetta/material/dielectric.rbs +15 -0
- data/sig/raysetta/material/diffuse_light.rbs +12 -0
- data/sig/raysetta/material/lambertian.rbs +10 -0
- data/sig/raysetta/material/metal.rbs +11 -0
- data/sig/raysetta/object/base.rbs +15 -0
- data/sig/raysetta/object/box.rbs +13 -0
- data/sig/raysetta/object/bvh.rbs +23 -0
- data/sig/raysetta/object/group.rbs +16 -0
- data/sig/raysetta/object/moving_sphere.rbs +15 -0
- data/sig/raysetta/object/quad.rbs +26 -0
- data/sig/raysetta/object/sphere.rbs +14 -0
- data/sig/raysetta/object/tri.rbs +15 -0
- data/sig/raysetta/output/base.rbs +15 -0
- data/sig/raysetta/output/png.rbs +8 -0
- data/sig/raysetta/output/ppm.rbs +7 -0
- data/sig/raysetta/perlin.rbs +19 -0
- data/sig/raysetta/ray.rbs +18 -0
- data/sig/raysetta/runner/base.rbs +15 -0
- data/sig/raysetta/runner/concurrent.rbs +10 -0
- data/sig/raysetta/runner/processes.rbs +9 -0
- data/sig/raysetta/runner/ractors.rbs +11 -0
- data/sig/raysetta/runner/sync.rbs +11 -0
- data/sig/raysetta/runner/threads.rbs +9 -0
- data/sig/raysetta/runner.rbs +5 -0
- data/sig/raysetta/scatter.rbs +8 -0
- data/sig/raysetta/scene.rbs +69 -0
- data/sig/raysetta/texture/base.rbs +11 -0
- data/sig/raysetta/texture/checker.rbs +15 -0
- data/sig/raysetta/texture/image.rbs +11 -0
- data/sig/raysetta/texture/noise.rbs +13 -0
- data/sig/raysetta/texture/solid_color.rbs +10 -0
- data/sig/raysetta/tracer.rbs +16 -0
- data/sig/raysetta/util.rbs +15 -0
- data/sig/raysetta/vec2.rbs +48 -0
- data/sig/raysetta/vec3.rbs +67 -0
- data/sig/raysetta.rbs +6 -0
- data/sig/stdlib/chunky_png.rbs +24 -0
- data/sig/stdlib/etc.rbs +3 -0
- data/sig/stdlib/json.rbs +3 -0
- data/sig/stdlib/optparse.rbs +4 -0
- data/sig/stdlib/parallel.rbs +5 -0
- data/sig/stdlib/progress.rbs +5 -0
- metadata +206 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module Raysetta
|
|
2
|
+
module Object
|
|
3
|
+
class Sphere < Base
|
|
4
|
+
attr_accessor center: Vec3
|
|
5
|
+
attr_accessor radius: Float
|
|
6
|
+
attr_accessor material: Material::Base
|
|
7
|
+
attr_reader bounding_box: AABB
|
|
8
|
+
|
|
9
|
+
def initialize: (Vec3 center, Float radius, Material::Base material) -> void
|
|
10
|
+
|
|
11
|
+
def hit: (Ray r, Range[Float] ray_t, ?Vec3 center) -> Hit?
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Raysetta
|
|
2
|
+
module Object
|
|
3
|
+
class Tri < Quad
|
|
4
|
+
# Compute the bounding box of all three vertices.
|
|
5
|
+
@bounding_box: AABB
|
|
6
|
+
|
|
7
|
+
def initialize: (Vec3 a, Vec3 b, Vec3 c, Material::Base material) -> void
|
|
8
|
+
|
|
9
|
+
private
|
|
10
|
+
|
|
11
|
+
def interior?: (Float a, Float b) -> Vec2?
|
|
12
|
+
def compute_bounding_box: () -> AABB
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Raysetta
|
|
2
|
+
module Output
|
|
3
|
+
class Base
|
|
4
|
+
type pixel = [Integer, Integer, Integer]
|
|
5
|
+
attr_reader pixels: Array[Array[pixel]]
|
|
6
|
+
attr_reader width: Integer
|
|
7
|
+
attr_reader height: Integer
|
|
8
|
+
|
|
9
|
+
def initialize: (Array[Array[pixel]] pixels, width: Integer, height: Integer) -> void
|
|
10
|
+
|
|
11
|
+
def call: () -> untyped
|
|
12
|
+
def save: (String file) -> void
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module Raysetta
|
|
2
|
+
class Perlin < EntityBase
|
|
3
|
+
attr_accessor randvec: Array[Vec3]
|
|
4
|
+
attr_accessor perm_x: Array[Integer]
|
|
5
|
+
attr_accessor perm_y: Array[Integer]
|
|
6
|
+
attr_accessor perm_z: Array[Integer]
|
|
7
|
+
|
|
8
|
+
POINT_COUNT: 256
|
|
9
|
+
|
|
10
|
+
def initialize: (?Array[Vec3] randvec, ?Array[Integer] perm_x, ?Array[Integer] perm_y, ?Array[Integer] perm_z) -> void
|
|
11
|
+
|
|
12
|
+
def noise: (Vec3 point) -> Float
|
|
13
|
+
def turb: (Vec3 point, Integer depth) -> Float
|
|
14
|
+
|
|
15
|
+
def self.perlin_interp: (Array[Array[Array[Vec3]]] c, Vec3 vec) -> Float
|
|
16
|
+
|
|
17
|
+
CUBE: Array[[Integer, Integer, Integer]]
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module Raysetta
|
|
2
|
+
class Ray
|
|
3
|
+
attr_accessor origin: Vec3
|
|
4
|
+
attr_accessor direction: Vec3
|
|
5
|
+
attr_accessor time: Float
|
|
6
|
+
|
|
7
|
+
def initialize: (Vec3 origin, Vec3 direction, ?Float time) -> void
|
|
8
|
+
|
|
9
|
+
def at: (Float t) -> Vec3
|
|
10
|
+
|
|
11
|
+
def dup: () -> instance
|
|
12
|
+
|
|
13
|
+
def ==: (untyped r) -> bool
|
|
14
|
+
alias eql? ==
|
|
15
|
+
|
|
16
|
+
def hash: () -> Integer
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Raysetta
|
|
2
|
+
module Runner
|
|
3
|
+
type output = Array[Array[Output::Base::pixel]]
|
|
4
|
+
|
|
5
|
+
class Base
|
|
6
|
+
attr_reader tracer: Tracer
|
|
7
|
+
|
|
8
|
+
def initialize: (Tracer tracer) -> void
|
|
9
|
+
|
|
10
|
+
def call: () -> void
|
|
11
|
+
def progress: () -> void
|
|
12
|
+
def finish: () -> void
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
module Raysetta
|
|
2
|
+
class Scene
|
|
3
|
+
type json = Hash[String, Hash[String, Hash[String, untyped]]]
|
|
4
|
+
|
|
5
|
+
attr_accessor world: Object::Base
|
|
6
|
+
attr_accessor camera: Camera
|
|
7
|
+
attr_accessor background: Background::Base
|
|
8
|
+
|
|
9
|
+
def initialize: (Object::Base world, Camera camera, Background::Base background) -> void
|
|
10
|
+
|
|
11
|
+
def self.parse: (json json) -> Scene
|
|
12
|
+
|
|
13
|
+
def export: () -> Hash[Symbol, untyped]
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
interface _Exportable
|
|
18
|
+
def id: () -> String
|
|
19
|
+
def export: () -> Hash[Symbol, untyped]
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def export_by_id: (Array[_Exportable] entities) -> Hash[String, Hash[Symbol, untyped]]
|
|
23
|
+
|
|
24
|
+
class Parser
|
|
25
|
+
@noises: Hash[String, Perlin]
|
|
26
|
+
@images: Hash[String, Image]
|
|
27
|
+
@textures: Hash[String, Texture::Base]
|
|
28
|
+
@materials: Hash[String, Material::Base]
|
|
29
|
+
|
|
30
|
+
class Error < Raysetta::Error
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
attr_reader json: json
|
|
34
|
+
|
|
35
|
+
def initialize: (json json) -> void
|
|
36
|
+
|
|
37
|
+
def parse: () -> Scene
|
|
38
|
+
|
|
39
|
+
def parse_noise: (Hash[String, untyped] noise) -> Perlin
|
|
40
|
+
def parse_image: (Hash[String, untyped] img) -> Image
|
|
41
|
+
def parse_texture: (Hash[String, untyped] tex) -> Texture::Base
|
|
42
|
+
def parse_material: (Hash[String, untyped] mat) -> Material::Base
|
|
43
|
+
def parse_world: (Hash[String, Hash[String, untyped]] json) -> Object::Base
|
|
44
|
+
|
|
45
|
+
def parse_object: (Hash[String, untyped] obj) -> Object::Base
|
|
46
|
+
def parse_sphere: (Hash[String, untyped] obj) -> Object::Sphere
|
|
47
|
+
def parse_moving_sphere: (Hash[String, untyped] obj) -> Object::MovingSphere
|
|
48
|
+
def parse_quad: (Hash[String, untyped] obj) -> Object::Quad
|
|
49
|
+
def parse_tri: (Hash[String, untyped] obj) -> Object::Tri
|
|
50
|
+
def parse_box: (Hash[String, untyped] obj) -> Object::Box
|
|
51
|
+
|
|
52
|
+
def material: (String name) -> Material::Base
|
|
53
|
+
def texture: (String name) -> Texture::Base
|
|
54
|
+
def image: (String name) -> Image
|
|
55
|
+
def noise: (String name) -> Perlin
|
|
56
|
+
|
|
57
|
+
def parse_camera: (Hash[String, untyped] cam) -> Camera
|
|
58
|
+
def parse_background: (Hash[String, untyped] bg) -> Background::Base
|
|
59
|
+
def parse_solid_bg: (Hash[String, untyped] bg) -> Background::Solid
|
|
60
|
+
def parse_gradient_bg: (Hash[String, untyped] bg) -> Background::Gradient
|
|
61
|
+
def parse_sphere_map: (Hash[String, untyped] bg) -> Background::SphereMap
|
|
62
|
+
def parse_cube_map: (Hash[String, untyped] bg) -> Background::CubeMap
|
|
63
|
+
|
|
64
|
+
def vec2: (Array[Float]) -> Vec2
|
|
65
|
+
def vec3: (Array[Float]) -> Vec3
|
|
66
|
+
alias rgb vec3
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Raysetta
|
|
2
|
+
module Texture
|
|
3
|
+
class Checker < Base
|
|
4
|
+
attr_accessor inv_scale: Float
|
|
5
|
+
attr_accessor even: Texture::Base
|
|
6
|
+
attr_accessor odd: Texture::Base
|
|
7
|
+
|
|
8
|
+
def initialize: (Float scale, Texture::Base even, Texture::Base odd) -> void
|
|
9
|
+
def self.solid: (Float scale, Vec3 even, Vec3 odd) -> instance
|
|
10
|
+
|
|
11
|
+
def scale=: (Float scale) -> Float
|
|
12
|
+
def scale: () -> Float
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Raysetta
|
|
2
|
+
module Texture
|
|
3
|
+
class Noise < Base
|
|
4
|
+
attr_accessor scale: Float
|
|
5
|
+
attr_accessor depth: Integer
|
|
6
|
+
attr_accessor marble_axis: Symbol
|
|
7
|
+
|
|
8
|
+
def initialize: (Float scale, Integer depth, Symbol marble_axis, ?Perlin noise) -> void
|
|
9
|
+
|
|
10
|
+
attr_reader noise: Perlin
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module Raysetta
|
|
2
|
+
class Tracer
|
|
3
|
+
@pixel_sample_scale: Float
|
|
4
|
+
|
|
5
|
+
attr_reader scene: Scene
|
|
6
|
+
attr_reader width: Integer
|
|
7
|
+
attr_reader height: Integer
|
|
8
|
+
attr_reader samples_per_pixel: Integer
|
|
9
|
+
attr_reader max_depth: Integer
|
|
10
|
+
|
|
11
|
+
def initialize: (Scene scene, ?width: Integer, ?height: Integer, ?samples_per_pixel: Integer, ?max_depth: Integer) -> void
|
|
12
|
+
|
|
13
|
+
def call: (Integer x, Integer y) -> [Integer, Integer, Integer]
|
|
14
|
+
def ray_color: (Ray r, ?Integer depth) -> Vec3
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Raysetta
|
|
2
|
+
module Util
|
|
3
|
+
EPSILON: Float
|
|
4
|
+
|
|
5
|
+
def self.degrees_to_radians: (Float degrees) -> Float
|
|
6
|
+
|
|
7
|
+
# Returns a random real in [min,max).
|
|
8
|
+
def self.random: (Float min, Float max) -> Float
|
|
9
|
+
|
|
10
|
+
def self.linear_to_gamma: (Float linear_component) -> Float
|
|
11
|
+
def self.gamma_to_linear: (Float gamma_component, ?Float gamma) -> Float
|
|
12
|
+
|
|
13
|
+
def self.sphere_uv: (Vec3 point) -> Vec2
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
module Raysetta
|
|
2
|
+
class Vec2
|
|
3
|
+
attr_accessor x: Float
|
|
4
|
+
attr_accessor y: Float
|
|
5
|
+
|
|
6
|
+
attr_accessor u (): Float
|
|
7
|
+
attr_accessor v (): Float
|
|
8
|
+
|
|
9
|
+
def initialize: (?Float x, ?Float y) -> void
|
|
10
|
+
|
|
11
|
+
def self.random: (?Float min, ?Float max) -> Vec2
|
|
12
|
+
def self.sample_square: () -> instance
|
|
13
|
+
|
|
14
|
+
def []: (Integer i) -> Float
|
|
15
|
+
def []=: (Integer i, Float v) -> void
|
|
16
|
+
|
|
17
|
+
def -@: () -> Vec2
|
|
18
|
+
|
|
19
|
+
def +: (Vec2 v) -> Vec2
|
|
20
|
+
def -: (Vec2 v) -> Vec2
|
|
21
|
+
def *: (Float t) -> Vec2
|
|
22
|
+
def /: (Float t) -> Vec2
|
|
23
|
+
|
|
24
|
+
def add: (Vec2 v) -> self
|
|
25
|
+
def sub: (Vec2 v) -> self
|
|
26
|
+
def mul: (Float t) -> self
|
|
27
|
+
def div: (Float t) -> self
|
|
28
|
+
|
|
29
|
+
def neg: () -> self
|
|
30
|
+
|
|
31
|
+
def length: () -> Float
|
|
32
|
+
def length_squared: () -> Float
|
|
33
|
+
|
|
34
|
+
def dot: (Vec2 v) -> Float
|
|
35
|
+
def unit: () -> Vec2
|
|
36
|
+
def normalize: () -> self
|
|
37
|
+
|
|
38
|
+
def dup: () -> Vec2
|
|
39
|
+
|
|
40
|
+
def abs!: () -> self
|
|
41
|
+
def abs: () -> Vec2
|
|
42
|
+
|
|
43
|
+
def zero?: () -> bool
|
|
44
|
+
|
|
45
|
+
def to_a: () -> [Float, Float]
|
|
46
|
+
alias to_ary to_a
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
module Raysetta
|
|
2
|
+
class Vec3
|
|
3
|
+
attr_accessor x: Float
|
|
4
|
+
attr_accessor y: Float
|
|
5
|
+
attr_accessor z: Float
|
|
6
|
+
|
|
7
|
+
attr_accessor r (): Float
|
|
8
|
+
attr_accessor g (): Float
|
|
9
|
+
attr_accessor b (): Float
|
|
10
|
+
|
|
11
|
+
def self.dimensions: () -> 3
|
|
12
|
+
|
|
13
|
+
def initialize: (?Float x, ?Float y, ?Float z) -> void
|
|
14
|
+
|
|
15
|
+
def self.random: (?Float min, ?Float max) -> Vec3
|
|
16
|
+
def self.random_in_unit_sphere: () -> instance
|
|
17
|
+
def self.random_unit: () -> instance
|
|
18
|
+
def self.random_on_hemisphere: (Vec3 normal) -> instance
|
|
19
|
+
def self.random_in_unit_disk: () -> instance
|
|
20
|
+
|
|
21
|
+
def []: (Integer i) -> Float
|
|
22
|
+
def []=: (Integer i, Float v) -> void
|
|
23
|
+
|
|
24
|
+
def -@: () -> Vec3
|
|
25
|
+
|
|
26
|
+
def +: (Vec3 v) -> Vec3
|
|
27
|
+
def -: (Vec3 v) -> Vec3
|
|
28
|
+
def *: (Float t) -> Vec3
|
|
29
|
+
def /: (Float t) -> Vec3
|
|
30
|
+
|
|
31
|
+
def add: (Vec3 v) -> self
|
|
32
|
+
def sub: (Vec3 v) -> self
|
|
33
|
+
def mul: (Float t) -> self
|
|
34
|
+
def div: (Float t) -> self
|
|
35
|
+
|
|
36
|
+
def neg: () -> self
|
|
37
|
+
|
|
38
|
+
def length: () -> Float
|
|
39
|
+
def length_squared: () -> Float
|
|
40
|
+
|
|
41
|
+
def dot: (Vec3 v) -> Float
|
|
42
|
+
def unit: () -> Vec3
|
|
43
|
+
def normalize: () -> self
|
|
44
|
+
|
|
45
|
+
def dup: () -> Vec3
|
|
46
|
+
|
|
47
|
+
def abs!: () -> self
|
|
48
|
+
def abs: () -> Vec3
|
|
49
|
+
|
|
50
|
+
def smoothstep!: () -> self
|
|
51
|
+
def smoothstep: () -> Vec3
|
|
52
|
+
|
|
53
|
+
def multiply: (Vec3 v) -> self
|
|
54
|
+
def times: (Vec3 v) -> Vec3
|
|
55
|
+
|
|
56
|
+
def cross: (Vec3 v) -> Vec3
|
|
57
|
+
def reflect: (Vec3 n) -> Vec3
|
|
58
|
+
def refract: (Vec3 n, Float etai_over_etat) -> instance
|
|
59
|
+
|
|
60
|
+
def to_pixel: () -> [Integer, Integer, Integer]
|
|
61
|
+
|
|
62
|
+
def zero?: () -> bool
|
|
63
|
+
|
|
64
|
+
def to_a: () -> [Float, Float, Float]
|
|
65
|
+
alias to_ary to_a
|
|
66
|
+
end
|
|
67
|
+
end
|
data/sig/raysetta.rbs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module ChunkyPNG
|
|
2
|
+
class Canvas
|
|
3
|
+
def width: () -> Integer
|
|
4
|
+
def height: () -> Integer
|
|
5
|
+
def get_pixel: (Integer, Integer) -> Color
|
|
6
|
+
def set_pixel: (Integer, Integer, Integer) -> void
|
|
7
|
+
def to_data_url: () -> String
|
|
8
|
+
def save: (String, Symbol) -> void
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
class Image < Canvas
|
|
12
|
+
def initialize: (Integer width, Integer height) -> void
|
|
13
|
+
|
|
14
|
+
def self.from_file: (String) -> instance
|
|
15
|
+
def self.from_data_url: (String) -> instance
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
class Color
|
|
19
|
+
def self.r: (instance) -> Integer
|
|
20
|
+
def self.g: (instance) -> Integer
|
|
21
|
+
def self.b: (instance) -> Integer
|
|
22
|
+
def self.rgb: (Integer, Integer, Integer) -> Integer
|
|
23
|
+
end
|
|
24
|
+
end
|
data/sig/stdlib/etc.rbs
ADDED
data/sig/stdlib/json.rbs
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
module Parallel
|
|
2
|
+
def self.map: [I, O] (Array[I], in_threads: Integer, ?finish: Proc) { (I) -> O } -> Array[O]
|
|
3
|
+
| [I, O] (Array[I], in_processes: Integer, ?finish: Proc) { (I) -> O } -> Array[O]
|
|
4
|
+
| [I] (Array[I], in_ractors: Integer, ractor: [Class, Symbol], ?finish: Proc) -> Array[untyped]
|
|
5
|
+
end
|