pixelart 0.2.2 → 1.0.0

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: 3c2b93e1779a1c06ff0b13dbfcae471648cd2f2dc153b17da3fd864615f6f6c1
4
- data.tar.gz: cef870177214b37eb902a99a41410dc8c080b613fed7c48cccd801290392fd28
3
+ metadata.gz: c77200956faad2093e12cba99a8f8a3339941e612406701a795eecdcdd8248d8
4
+ data.tar.gz: d3dfbf4c9d278db95219b695dc55cea1b31debd8b5a08a20305135526d3618d1
5
5
  SHA512:
6
- metadata.gz: 8ac5ad9fd3e16d9d490d7c43c38fa2b95ee6318a7c0f319e142fc59084ab70315ebb3d0e800d4536a098214768cab3adae99b1ec2c482ce93a4ab1e902d36cc5
7
- data.tar.gz: 67e9e1214ae9f614a2694d30a9b63ce5aa2c83dad17a98dac141913b86cb4375ea22fc0630e2e3160f6b768b4b79ab2236555d0467471fd6a127f477ca48f6db
6
+ metadata.gz: db9abc2122d9727e2fee58c54913174983ff3dd03d2e2658c4b0a84d80114f0f482673d2b7e51fea61dbbb423f1df05eb5e027ba51d741ab86dc7e16d6f2eb72
7
+ data.tar.gz: 36c0733c3c5e15f18cca6787185eb2229fa8d7a98c3d037cf781295b8d32fc74be542a433de1504981afb984d9234730191dcf14443b3f614cd3dc9139d4fa7e
data/Manifest.txt CHANGED
@@ -12,4 +12,5 @@ lib/pixelart/led.rb
12
12
  lib/pixelart/misc.rb
13
13
  lib/pixelart/palette.rb
14
14
  lib/pixelart/pixelator.rb
15
+ lib/pixelart/sketch.rb
15
16
  lib/pixelart/version.rb
data/lib/pixelart/base.rb CHANGED
@@ -20,8 +20,8 @@ require 'pixelart/pixelator'
20
20
 
21
21
  require 'pixelart/misc' ## misc helpers
22
22
 
23
- require 'pixelart/led' ## (special) effects / filters
24
-
23
+ require 'pixelart/led' ## (special) effects / filters
24
+ require 'pixelart/sketch'
25
25
 
26
26
 
27
27
 
@@ -0,0 +1,69 @@
1
+ module Pixelart
2
+
3
+
4
+
5
+ class Image
6
+ def sketch( sketch=4, line: 1 )
7
+ # todo: line - find a better name eg. line_strenght/width or such?
8
+ width = @img.width*sketch + (@img.width+1)*line
9
+ height = @img.height*sketch + (@img.height+1)*line
10
+
11
+ puts " #{width}x#{height}"
12
+
13
+ img = Image.new( width, height, Color::WHITE )
14
+
15
+ @img.width.times do |x|
16
+ @img.height.times do |y|
17
+ pixel = @img[x,y]
18
+
19
+ ## get surrounding pixels - if "out-of-bound" use transparent (0)
20
+ left = x == 0 ? Color::TRANSPARENT : @img[x-1,y]
21
+ top = y == 0 ? Color::TRANSPARENT : @img[x ,y-1]
22
+
23
+ if pixel != left ## draw vertical line
24
+ (sketch+line*2).times do |n|
25
+ line.times do |m|
26
+ img[ x*sketch + line*x + m,
27
+ n + y*sketch + line*y] = Color::BLACK
28
+ end
29
+ end
30
+ end
31
+
32
+ if pixel != top ## draw horizontal line
33
+ (sketch+line*2).times do |n|
34
+ line.times do |m|
35
+ img[n + x*sketch + line*x,
36
+ y*sketch + line*y + m] = Color::BLACK
37
+ end
38
+ end
39
+ end
40
+
41
+
42
+ ## check special edge case for x and y to add "finish-up" right and bottom line
43
+ if x == @img.width-1 && pixel != Color::TRANSPARENT
44
+ ## draw vertical line
45
+ (sketch+line*2).times do |n|
46
+ line.times do |m|
47
+ img[ (x+1)*sketch + line*(x+1) + m,
48
+ n + y*sketch + line*y] = Color::BLACK
49
+ end
50
+ end
51
+ end
52
+
53
+ if y== @img.height-1 && pixel != Color::TRANSPARENT
54
+ ## draw horizontal line
55
+ (sketch+line*2).times do |n|
56
+ line.times do |m|
57
+ img[n + x*sketch + line*x,
58
+ (y+1)*sketch + line*(y+1) + m] = Color::BLACK
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+
65
+ img
66
+ end
67
+ end # class Image
68
+ end # module Pixelart
69
+
@@ -1,9 +1,9 @@
1
1
 
2
2
  module Pixelart
3
3
 
4
- MAJOR = 0
5
- MINOR = 2
6
- PATCH = 2
4
+ MAJOR = 1
5
+ MINOR = 0
6
+ PATCH = 0
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.2.2
4
+ version: 1.0.0
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-05-16 00:00:00.000000000 Z
11
+ date: 2021-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chunky_png
@@ -82,6 +82,7 @@ files:
82
82
  - lib/pixelart/misc.rb
83
83
  - lib/pixelart/palette.rb
84
84
  - lib/pixelart/pixelator.rb
85
+ - lib/pixelart/sketch.rb
85
86
  - lib/pixelart/version.rb
86
87
  homepage: https://github.com/rubycoco/pixel
87
88
  licenses: