magic_cloud 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -5
- data/lib/magic_cloud/layouter/place.rb +2 -10
- data/lib/magic_cloud/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7197d0ee63b2aee8e0a2a49f07477a5a6d21058a
|
4
|
+
data.tar.gz: 926729b0eeaf7c68409f1c8381fa76cc6687b235
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e516459c658fcba58f33ecffa361dd4bf0184de94511174e2d453cc7dbd9e65f0e344887aaa745288796aea5affcc9399b70f3ae4f9640b86f11f2e7b4722fd
|
7
|
+
data.tar.gz: f6d3f66ef8f70b20f6b2ad80de458f111c5dd519725c406a32cc89dd2d42169c550849f4c9ebfbc501d5d6610204cc2d822cd9e68b602eee5d684fef9ac1d606
|
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
MagicCloud - simple pretty word cloud for Ruby
|
2
2
|
==============================================
|
3
3
|
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/magic_cloud.svg)](http://badge.fury.io/rb/magic_cloud)
|
5
|
+
|
4
6
|
**MagicCloud** is simple, pure-ruby library for making pretty
|
5
7
|
[Wordle](http://www.wordle.net/)-like clouds. It uses RMagick as graphic
|
6
8
|
backend.
|
@@ -61,11 +63,14 @@ Performance
|
|
61
63
|
|
62
64
|
It's reasonable for me. On my small Thinkpad E330, some 50-words cloud
|
63
65
|
image, size 700×500, are typically generated in <3sec. It's not that cool,
|
64
|
-
yet not too long for you to fell asleep.
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
66
|
+
yet not too long for you to fell asleep.
|
67
|
+
|
68
|
+
The time of cloud making depends on words count, size of image
|
69
|
+
(it's faster to find place for all words on larger image) and used rotation
|
70
|
+
algorithm (vertical+horizontal words only is significantly faster - and,
|
71
|
+
on my opinion, better looking - than "cool" free-rotated-words cloud). It
|
72
|
+
even depends on font - dense font like Impact takes mor time to being
|
73
|
+
layed out than sparse Tahoma.
|
69
74
|
|
70
75
|
Major performance eater is perfect collision detection, which Wordle-like
|
71
76
|
cloud needs. MagicCloud for now uses really dumb algortihm with some
|
@@ -13,16 +13,8 @@ module MagicCloud
|
|
13
13
|
@layouter, @shape = layouter, shape
|
14
14
|
|
15
15
|
# initial position
|
16
|
-
@start_x = (
|
17
|
-
|
18
|
-
(rand-0.5) * # random shift
|
19
|
-
(@layouter.width - @shape.width) # not more than (cloud width - word width)
|
20
|
-
).to_i
|
21
|
-
@start_y = (
|
22
|
-
@layouter.height/2 + # from center
|
23
|
-
(rand-0.5) * # random shift
|
24
|
-
(@layouter.height - @shape.height) # not more than (cloud height - word height)
|
25
|
-
).to_i
|
16
|
+
@start_x = (@layouter.width/2-@shape.width/2).to_i
|
17
|
+
@start_y = (@layouter.height/2-@shape.height/2).to_i
|
26
18
|
|
27
19
|
# when shift of position is more than max delta (diagonal of cloud)
|
28
20
|
# there is no hope it will eventually found its place
|
data/lib/magic_cloud/version.rb
CHANGED