geo_pattern 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE.txt +1 -1
- data/README.md +3 -1
- data/{geopatterns.gemspec → geo_pattern.gemspec} +0 -0
- data/lib/geo_pattern/pattern.rb +13 -4
- data/lib/geo_pattern/version.rb +1 -1
- metadata +3 -3
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
# GeoPattern
|
2
2
|
|
3
|
-
Generate beautiful
|
3
|
+
Generate beautiful tiling SVG patterns from a string. The string is converted into a SHA and a color and pattern are determined based on the values in the hash. The color is determined by shifting the hue and saturation from a default (or passed in) base color. One of 16 patterns is used (or you can specify one) and the sizing of the pattern elements is also determined by the hash values.
|
4
4
|
|
5
5
|
You can use the generated pattern as the `background-image` for a container. Using the `base64` representation of the pattern still results in SVG rendering, so it looks great on retina displays.
|
6
6
|
|
7
|
+
See the [GitHub Guides](http://guides.github.com) site as an example of this library in action.
|
8
|
+
|
7
9
|
## Installation
|
8
10
|
|
9
11
|
Add this line to your application's Gemfile:
|
File without changes
|
data/lib/geo_pattern/pattern.rb
CHANGED
@@ -658,6 +658,15 @@ module GeoPattern
|
|
658
658
|
opacity = opacity(val)
|
659
659
|
fill = fill_color(val)
|
660
660
|
|
661
|
+
styles = {
|
662
|
+
"fill" => "none",
|
663
|
+
"stroke" => fill,
|
664
|
+
"style" => {
|
665
|
+
"opacity" => opacity,
|
666
|
+
"stroke-width" => "#{block_size}px"
|
667
|
+
}
|
668
|
+
}
|
669
|
+
|
661
670
|
svg.rect(x*square_size + x*block_size*2 + block_size/2 + block_size*2,
|
662
671
|
y*square_size + y*block_size*2 + block_size/2 + block_size*2,
|
663
672
|
block_size * 3, block_size * 3, styles)
|
@@ -678,15 +687,15 @@ module GeoPattern
|
|
678
687
|
|
679
688
|
if (x % 2 == 0)
|
680
689
|
if (y % 2 == 0)
|
681
|
-
draw_outer_mosaic_tile(x*triangle_size*2, y*triangle_size*2, triangle_size,
|
690
|
+
draw_outer_mosaic_tile(x*triangle_size*2, y*triangle_size*2, triangle_size, hex_val(i, 1))
|
682
691
|
else
|
683
|
-
draw_inner_mosaic_tile(x*triangle_size*2, y*triangle_size*2, triangle_size,
|
692
|
+
draw_inner_mosaic_tile(x*triangle_size*2, y*triangle_size*2, triangle_size, [hex_val(i, 1), hex_val(i+1, 1)])
|
684
693
|
end
|
685
694
|
else
|
686
695
|
if (y % 2 == 0)
|
687
|
-
draw_inner_mosaic_tile(x*triangle_size*2, y*triangle_size*2, triangle_size,
|
696
|
+
draw_inner_mosaic_tile(x*triangle_size*2, y*triangle_size*2, triangle_size, [hex_val(i, 1), hex_val(i+1, 1)])
|
688
697
|
else
|
689
|
-
draw_outer_mosaic_tile(x*triangle_size*2, y*triangle_size*2, triangle_size,
|
698
|
+
draw_outer_mosaic_tile(x*triangle_size*2, y*triangle_size*2, triangle_size, hex_val(i, 1))
|
690
699
|
end
|
691
700
|
end
|
692
701
|
i += 1
|
data/lib/geo_pattern/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geo_pattern
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-02-
|
12
|
+
date: 2014-02-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: color
|
@@ -71,7 +71,7 @@ files:
|
|
71
71
|
- LICENSE.txt
|
72
72
|
- README.md
|
73
73
|
- Rakefile
|
74
|
-
-
|
74
|
+
- geo_pattern.gemspec
|
75
75
|
- lib/geo_pattern.rb
|
76
76
|
- lib/geo_pattern/pattern.rb
|
77
77
|
- lib/geo_pattern/svg.rb
|