pixelart 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Manifest.txt +1 -0
- data/lib/pixelart/base.rb +4 -0
- data/lib/pixelart/color.rb +0 -1
- data/lib/pixelart/led.rb +37 -0
- data/lib/pixelart/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c72ac16513ce785c2bfcd63fe1d230950d03d597e0def19d4a35034b743d513
|
4
|
+
data.tar.gz: dd3fcd6b2af8eaade1f9dc7bc7566af24ee3b5688d86363845cfc4794ee426d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f299efeddddc2fe143595fbee1fa5b68fedd39f643da7700e25702398f5d3d3a5adc141268fa127dc669db476a41d64971b563997653ee1b2e0af8d418163eb
|
7
|
+
data.tar.gz: e8cc7732cc24c04bcfb076f0ae48f088f2a48c4e83f23b897b194ae7def003effd8c08da8c0a7cde08fb55ea09ae2bf2ce0d9c017d38b759531e53881c5e7871
|
data/Manifest.txt
CHANGED
data/lib/pixelart/base.rb
CHANGED
data/lib/pixelart/color.rb
CHANGED
data/lib/pixelart/led.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
module Pixelart
|
2
|
+
|
3
|
+
|
4
|
+
class Image
|
5
|
+
def led( led=8, spacing: 2, round_corner: false )
|
6
|
+
|
7
|
+
width = @img.width*led + (@img.width-1)*spacing
|
8
|
+
height = @img.height*led + (@img.height-1)*spacing
|
9
|
+
|
10
|
+
puts " #{width}x#{height}"
|
11
|
+
|
12
|
+
img = Image.new( width, height, Color::BLACK )
|
13
|
+
|
14
|
+
@img.width.times do |x|
|
15
|
+
@img.height.times do |y|
|
16
|
+
pixel = @img[x,y]
|
17
|
+
pixel = Color::BLACK if pixel == Color::TRANSPARENT
|
18
|
+
led.times do |n|
|
19
|
+
led.times do |m|
|
20
|
+
## round a little - drop all four corners for now
|
21
|
+
next if round_corner &&
|
22
|
+
[[0,0],[0,1],[1,0],[1,1],[0,2],[2,0],
|
23
|
+
[0,led-1],[0,led-2],[1,led-1],[1,led-2],[0,led-3],[2,led-1],
|
24
|
+
[led-1,0],[led-1,1],[led-2,0],[led-2,1],[led-1,2],[led-3,0],
|
25
|
+
[led-1,led-1],[led-1,led-2],[led-2,led-1],[led-2,led-2],[led-1,led-3],[led-3,led-1],
|
26
|
+
].include?( [n,m] )
|
27
|
+
img[x*led+n + spacing*x,
|
28
|
+
y*led+m + spacing*y] = pixel
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
img
|
34
|
+
end
|
35
|
+
end # class Image
|
36
|
+
end # module Pixelart
|
37
|
+
|
data/lib/pixelart/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pixelart
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-04-
|
11
|
+
date: 2021-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chunky_png
|
@@ -77,6 +77,7 @@ files:
|
|
77
77
|
- lib/pixelart/color.rb
|
78
78
|
- lib/pixelart/gradient.rb
|
79
79
|
- lib/pixelart/image.rb
|
80
|
+
- lib/pixelart/led.rb
|
80
81
|
- lib/pixelart/misc.rb
|
81
82
|
- lib/pixelart/palette.rb
|
82
83
|
- lib/pixelart/pixelator.rb
|