stitchify 0.3.0 → 0.4.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
  SHA1:
3
- metadata.gz: 3e1bcb14528603351a2a3a744657d9bc3bbc7cde
4
- data.tar.gz: 63f7539a7f97e45f5bfb441a808f4734d82f0841
3
+ metadata.gz: a69e46357be5a7471d4e299fdf2991ed93807852
4
+ data.tar.gz: 69ac7719b3df36c5fd33282fcadf62f7cfa97c37
5
5
  SHA512:
6
- metadata.gz: cff773759e61200ec5aae4010c09f0b0bf23f6c37f1b012b292c5bf38cb500a06d8ae2c13721be58e0a31e463f3bfbb48d5a4ab4cae85d873899f55d1a756d28
7
- data.tar.gz: fef94398096254ef98bcceaba83d54e10dcdf0a4187c19e6ea31ce754b0a2105a89ef6b846ae559edfd18464e1a6855c6bf3dd8eab92f154d5d9173e7ceb4b15
6
+ metadata.gz: 8ac0ab428ea0ae7c8ea8d72bad8cac09c21f39e013cad8995eccd9b9ba94c14d82c7eaeba1cff63d23e59968d1c8850b081d9a0032d65823bfcd1d8c9874c1d1
7
+ data.tar.gz: 4231feda99f27a2e1407eba36dccc9646d8c50d10b3883220e8895cf958ba110ab42c98875d2cf9f6901f978c6504c64bfeb3f6414f2ce854809111c0633b776
@@ -33,6 +33,7 @@ class Stitchifier
33
33
  :dominant_colors,
34
34
  :img,
35
35
  :img_path,
36
+ :file_path,
36
37
  :num_of_colors,
37
38
  :num_of_off_colors,
38
39
  :pos_x,
@@ -41,7 +42,7 @@ class Stitchifier
41
42
  :stitch_map,
42
43
  :width
43
44
 
44
- def initialize(img_path = '', width = 50, px=10, num_of_colors = 8)
45
+ def initialize(img_path = '', width = 50, px=10, num_of_colors=8, file_path='stitchify.svg')
45
46
  # sets variables
46
47
  self.num_of_colors = num_of_colors
47
48
  set_num_colors
@@ -52,6 +53,7 @@ class Stitchifier
52
53
  self.stitch_map = []
53
54
  self.px = px
54
55
  self.color_set = nil
56
+ self.file_path = file_path
55
57
 
56
58
  unless img_path.empty?
57
59
  make_img
@@ -63,7 +65,7 @@ class Stitchifier
63
65
  end
64
66
 
65
67
  def stitch
66
- d = DrawRasem.new(self.stitch_map, self.width, self.px, self.color_set)
68
+ d = DrawRasem.new(self.stitch_map, self.width, self.px, self.color_set, self.file_path)
67
69
  d.stitch
68
70
  end
69
71
 
@@ -1,17 +1,25 @@
1
1
  class DrawRasem
2
2
 
3
- attr_accessor :px_arr, :width, :px, :pos_x, :pos_y, :height, :color_set
4
-
5
- def initialize(px_arr, width=50, px=10, color_set=[])
3
+ attr_accessor :color_set,
4
+ :file_path,
5
+ :height,
6
+ :pos_x,
7
+ :pos_y,
8
+ :px,
9
+ :px_arr,
10
+ :width
11
+
12
+ def initialize(px_arr, width=50, px=10, color_set=[], file_path='stitchify.svg')
6
13
  self.px_arr = px_arr
7
14
  self.width = width
8
15
  self.px = px
9
16
  self.color_set = color_set
17
+ self.file_path = file_path
10
18
  clear_vars
11
19
  end
12
20
 
13
21
  def stitch
14
- write(build_rasem_data, file='stitchify.svg')
22
+ write(build_rasem_data, self.file_path)
15
23
  clear_vars
16
24
  end
17
25
 
@@ -128,8 +136,8 @@ class DrawRasem
128
136
 
129
137
  blocks = rasem_obj.width / 10
130
138
  blocks.times do |i|
131
- text((i + 1) * 10 * px + b, c, stroke_width: 1, 'font-size': '8px', class: 'grid-numbers') { raw (i + 1) * 5 }
132
- text(1, (i + 1) * 10 * px + px + a, stroke_width: 1, 'font-size': '8px', class: 'grid-numbers') { raw (i + 1) * 5 }
139
+ text((i + 1) * 10 * px + b, c, stroke_width: 1, 'font-size': '8px', class: 'grid-numbers') { raw (i + 1) * 10 }
140
+ text(1, (i + 1) * 10 * px + px + a, stroke_width: 1, 'font-size': '8px', class: 'grid-numbers') { raw (i + 1) * 10 }
133
141
  end
134
142
  end
135
143
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stitchify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ellen Wondra