naoticon 0.0.2 → 0.0.3
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 +4 -4
- data/README.md +14 -20
- data/bin/naoticon +3 -1
- data/lib/naoticon/version.rb +1 -1
- data/lib/naoticon.rb +12 -5
- data/{naoticon.png → naoticon1.png} +0 -0
- data/naoticon4.png +0 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32446c6c5417c16b9c01f325685765a262ffd248
|
4
|
+
data.tar.gz: ab5b3e692316253e0f79d63e8d1d70e3c7d14f95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec24856f3dc400049a91940ad3ecf3aaf5db40cfb8e960e61b310483d1228d9d9bacde76f82ac772380f9ce81af23914139de58d8dde0f2544080d1f0819dd24
|
7
|
+
data.tar.gz: 199ab7befe4dca7495b7af0ad8f670808b6d73dc70a5a579504008be7d1226b1ce5b6a8a36f72964d4e37336db78c1ce6923705ba33e1b229137813c088f8276
|
data/README.md
CHANGED
@@ -1,29 +1,23 @@
|
|
1
|
-
#
|
1
|
+
# naoticon
|
2
2
|
|
3
|
-
|
3
|
+

|
4
4
|
|
5
|
-
|
5
|
+
naoticon is a generator of identicon for naoty (it's me).
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
gem 'naoticon'
|
10
|
-
|
11
|
-
And then execute:
|
12
|
-
|
13
|
-
$ bundle
|
7
|
+
## Usage
|
14
8
|
|
15
|
-
|
9
|
+
```
|
10
|
+
$ gem install naoticon
|
11
|
+
$ naoticon
|
12
|
+
```
|
16
13
|
|
17
|
-
|
14
|
+

|
18
15
|
|
19
|
-
|
16
|
+
`naoticon` command generates `naoticon.png`. The scale of icon can be passed to the command arguement.
|
20
17
|
|
21
|
-
|
18
|
+
```
|
19
|
+
$ naoticon 4
|
20
|
+
```
|
22
21
|
|
23
|
-
|
22
|
+

|
24
23
|
|
25
|
-
1. Fork it
|
26
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
-
5. Create new Pull Request
|
data/bin/naoticon
CHANGED
data/lib/naoticon/version.rb
CHANGED
data/lib/naoticon.rb
CHANGED
@@ -3,6 +3,7 @@ require "chunky_png"
|
|
3
3
|
|
4
4
|
module Naoticon
|
5
5
|
module Builder
|
6
|
+
MIN_LENGTH = 16
|
6
7
|
DOTS = [
|
7
8
|
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
8
9
|
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
@@ -22,11 +23,17 @@ module Naoticon
|
|
22
23
|
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
23
24
|
].freeze
|
24
25
|
|
25
|
-
def self.build(filename = "naoticon.png")
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
def self.build(scale = 1, filename = "naoticon.png")
|
27
|
+
length = MIN_LENGTH * scale
|
28
|
+
icon = ChunkyPNG::Image.new(length, length, ChunkyPNG::Color::BLACK)
|
29
|
+
MIN_LENGTH.times do |x|
|
30
|
+
scale.times do |i|
|
31
|
+
MIN_LENGTH.times do |y|
|
32
|
+
scale.times do |j|
|
33
|
+
color = DOTS[x][y] == 1 ? ChunkyPNG::Color::WHITE : ChunkyPNG::Color::BLACK
|
34
|
+
icon[y * scale + j, x * scale + i] = color
|
35
|
+
end
|
36
|
+
end
|
30
37
|
end
|
31
38
|
end
|
32
39
|
icon.save(filename)
|
File without changes
|
data/naoticon4.png
ADDED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: naoticon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naoto Kaneko
|
@@ -83,7 +83,8 @@ files:
|
|
83
83
|
- lib/naoticon.rb
|
84
84
|
- lib/naoticon/version.rb
|
85
85
|
- naoticon.gemspec
|
86
|
-
-
|
86
|
+
- naoticon1.png
|
87
|
+
- naoticon4.png
|
87
88
|
homepage: https://github.com/naoty/naoticon
|
88
89
|
licenses:
|
89
90
|
- MIT
|