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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0dd959d7ee982c2634f325c6e7f91bfb46d12dc61a79f364d0b7caae529d59f1
4
- data.tar.gz: 024f66e021b395b4141c54298e2fb0f31b47d28952a5c03d56ecfaf75c68b1be
3
+ metadata.gz: 3c72ac16513ce785c2bfcd63fe1d230950d03d597e0def19d4a35034b743d513
4
+ data.tar.gz: dd3fcd6b2af8eaade1f9dc7bc7566af24ee3b5688d86363845cfc4794ee426d5
5
5
  SHA512:
6
- metadata.gz: 71093d3b9977140303838bf9628c1de54c47f978a556945321fd849d3ebb26912d50846050c15efe3f1a2cf4d8b0991940c08f4a63511451148f63d2b9e788f5
7
- data.tar.gz: 41c97279da0b7f81430a56c1c8e88be1ebc2bac61ea6b7a136be1accfe3cd71b7c5e0c3885d3a7dfa5d021852d4550e3f692b151767a18f6fcf7a8c9fd5340d0
6
+ metadata.gz: 4f299efeddddc2fe143595fbee1fa5b68fedd39f643da7700e25702398f5d3d3a5adc141268fa127dc669db476a41d64971b563997653ee1b2e0af8d418163eb
7
+ data.tar.gz: e8cc7732cc24c04bcfb076f0ae48f088f2a48c4e83f23b897b194ae7def003effd8c08da8c0a7cde08fb55ea09ae2bf2ce0d9c017d38b759531e53881c5e7871
data/Manifest.txt CHANGED
@@ -7,6 +7,7 @@ lib/pixelart/base.rb
7
7
  lib/pixelart/color.rb
8
8
  lib/pixelart/gradient.rb
9
9
  lib/pixelart/image.rb
10
+ lib/pixelart/led.rb
10
11
  lib/pixelart/misc.rb
11
12
  lib/pixelart/palette.rb
12
13
  lib/pixelart/pixelator.rb
data/lib/pixelart/base.rb CHANGED
@@ -19,6 +19,10 @@ require 'pixelart/pixelator'
19
19
 
20
20
  require 'pixelart/misc' ## misc helpers
21
21
 
22
+ require 'pixelart/led' ## (special) effects / filters
23
+
24
+
25
+
22
26
 
23
27
  ##########
24
28
  # add some spelling convenience variants
@@ -7,7 +7,6 @@ class Color
7
7
  WHITE = 0xffffffff # rgba(255,255,255,255)
8
8
 
9
9
 
10
-
11
10
  def self.parse( color )
12
11
  if color.is_a?( Integer ) ## e.g. assumes ChunkyPNG::Color.rgb() or such
13
12
  color ## pass through as is 1:1
@@ -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
+
@@ -3,7 +3,7 @@ module Pixelart
3
3
 
4
4
  MAJOR = 0
5
5
  MINOR = 1
6
- PATCH = 7
6
+ PATCH = 8
7
7
  VERSION = [MAJOR,MINOR,PATCH].join('.')
8
8
 
9
9
  def self.version
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.7
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-23 00:00:00.000000000 Z
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