spf_drawing 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/componente_magick_util.rb +9 -0
- data/lib/composicion_magick.rb +43 -0
- data/lib/spf_drawing/version.rb +1 -1
- data/lib/spf_drawing.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NTQwNTg2Y2FiZDNjMzRjODUzOTk2ZGE5MTY0YWMxZTVhNWViZmRkZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZWY5ZDFmMWVkMDg1YzZjMTMzNWQyZjA1YzVkMzgxMDRjOWJjMzJhMA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZTZiYjBmYjY0YTk3NjI3NTg3MDk5YzhlZWI5MGE5OGVkZTJkMTliNDE2OTgz
|
10
|
+
YmM4NWIwMTJmZDJjNjllMWZmZmM1ZTFjZjQyZDYxZTBhNDcxZjVlMTY1NTY3
|
11
|
+
NTNlYjNiZmE4ZTI0YmY4YWJhZTU3ZWY2YjAwZDUxYTk4ZmZhOWU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjUxMTljNjk5MWJjYTZkMWRmZmQwMzI1MzA5MDY1Y2MyMjE1ZDE0ZjA0MTE3
|
14
|
+
NDgxODdjOWE3N2E1MzFjMGRkNjk2NzhmNWU1M2EwYzE1ZTBiMTNjZGQ5ZjMz
|
15
|
+
YTViM2NlNGU4YmJmMmRmNTZiYTI4NmM0MDMzNDgwMDlkNTNmNGU=
|
data/lib/composicion_magick.rb
CHANGED
@@ -22,6 +22,21 @@ class ComposicionMagick
|
|
22
22
|
imagen_composicion.destroy!
|
23
23
|
end
|
24
24
|
|
25
|
+
def crear_dibujo_componente(componente)
|
26
|
+
path = "#{Path::ImagesMagick}componente_#{componente.id}.png"
|
27
|
+
|
28
|
+
|
29
|
+
imagen_composicion = dibujar_solo_componente(componente)
|
30
|
+
|
31
|
+
|
32
|
+
imagen_composicion.write(path)
|
33
|
+
|
34
|
+
# agarra la misma imagen y la hace transparente
|
35
|
+
system("convert #{path} -transparent white #{path}")
|
36
|
+
|
37
|
+
imagen_composicion.destroy!
|
38
|
+
end
|
39
|
+
|
25
40
|
def dibujar_composicion(composicion)
|
26
41
|
imagenes = ImageList.new
|
27
42
|
|
@@ -53,6 +68,25 @@ class ComposicionMagick
|
|
53
68
|
imagenes.append(true)
|
54
69
|
end
|
55
70
|
|
71
|
+
def dibujar_solo_componente(componente)
|
72
|
+
imagenes = ImageList.new
|
73
|
+
|
74
|
+
imagenes.push Image.read(Path::IconoSunPng)[0].resize(40, 40)
|
75
|
+
|
76
|
+
componente.elementos.order(:orden).each do |elemento|
|
77
|
+
imagen_elemento = dibujar_elemento(elemento)
|
78
|
+
imagenes.push imagen_elemento
|
79
|
+
end
|
80
|
+
|
81
|
+
imagen2 = ImageList.new
|
82
|
+
|
83
|
+
imagen2.push Image.read(Path::IconoHomePng)[0].resize(40, 40)
|
84
|
+
# imagen2.push Image.read("/home/fontela/SPF/app/assets/images/vacio.png")[0]
|
85
|
+
imagenes.push imagen2.append(false)
|
86
|
+
|
87
|
+
imagenes.append(true)
|
88
|
+
end
|
89
|
+
|
56
90
|
def dibujar_elemento(elemento)
|
57
91
|
|
58
92
|
# devuelve un objeto Figura::Monolitico/Espaciador/etc
|
@@ -125,4 +159,13 @@ class ComposicionMagick
|
|
125
159
|
end
|
126
160
|
end
|
127
161
|
|
162
|
+
def get_imagen_componente(componente)
|
163
|
+
if File.exist?("#{Path::ImagesMagick}componente_#{componente.id}.png")
|
164
|
+
return "componente_#{componente.id}.png"
|
165
|
+
else
|
166
|
+
crear_dibujo_componente(compoonente)
|
167
|
+
return "componente_#{componente.id}.png"
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
128
171
|
end
|
data/lib/spf_drawing/version.rb
CHANGED
data/lib/spf_drawing.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spf_drawing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carlos Ramseyer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -48,6 +48,7 @@ files:
|
|
48
48
|
- MIT-LICENSE
|
49
49
|
- README.rdoc
|
50
50
|
- Rakefile
|
51
|
+
- lib/componente_magick_util.rb
|
51
52
|
- lib/composicion_magick.rb
|
52
53
|
- lib/composicion_magick_util.rb
|
53
54
|
- lib/figura.rb
|