text2isometric 0.0.1

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3c7412697d8bb4207c10cf0dad0a46179fd11bc1
4
+ data.tar.gz: 11a2eaa69fd83387296f0c524ee922645ce63f66
5
+ SHA512:
6
+ metadata.gz: b9fa367270814fcc1cc5b26c607b81a1f66659510af4c4e20540a46e103bba3e90d7a888f7c19cc0cbcd50256864f7f0226215d161bf3c6cd12305487434df5a
7
+ data.tar.gz: d66bac473f14b510aec29d4f1e36fdac4a9d3a5212e82c5dca219696bf4766671a47b96ee6e59c02829eb299ccf3881552902806a72d08bb71e0f93f3b1b1213
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in text2isometric.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2016 Pim Snel
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,90 @@
1
+ # text2isometric
2
+
3
+ Experimental gem and applescript for OmniGraffle to generate isometric
4
+ texts. Motivation was the realization that OmniGraffle is not able to
5
+ create 3d texts compatible with the nice AWS 3D stencils I wanted to
6
+ use.
7
+
8
+ ![image](http://picdrop.t3lab.com/98meGnW0WM.png)
9
+
10
+ It's a rather complex stack of technologies:
11
+
12
+ - 1 AppleScipt runs from OmniGraffle and will ask parameters
13
+ - 2 it than executes a ruby script that generates a html5 document with
14
+ the 3d texts in the right direction.
15
+ - 3 than it run webkit2png and imagemagick to export the result
16
+ - 4 the image is placed in OmniGraffle
17
+
18
+ Like I said is experimental. If you can make it better please help...
19
+
20
+ ## Compatible Stencils
21
+
22
+ - Included is a blue isometric grid
23
+ - [AWS 3D](https://stenciltown.omnigroup.com/#stencil=aws-3d)
24
+ - [Three Dimensional](https://stenciltown.omnigroup.com/#stencil=three-dimensional)
25
+ - [Isometric](https://www.graffletopia.com/stencils/533)
26
+
27
+
28
+
29
+ ## Installation
30
+
31
+ ### install gem
32
+
33
+ ```
34
+ $ gem install text2isometric
35
+ ```
36
+
37
+
38
+ ### install webkit2png & imagemagick
39
+
40
+ ```
41
+ $ brew install webkit2png
42
+ $ brew install imagemagick
43
+ ```
44
+
45
+ ### install applescript
46
+
47
+ *Warning!!* In templates you will find an applescript called isometric-text.scpt.
48
+ You should tweak this to make it work on your computer.
49
+
50
+ ```
51
+ $ text2isometric instgrafflescript
52
+ ```
53
+
54
+
55
+ ## Gem Usage
56
+
57
+ The text2isometric script has these options
58
+
59
+ ```
60
+ $ text2isometric
61
+
62
+ Commands:
63
+ text2isometric cube # show cube with directions
64
+ text2isometric front TEXT # Generate text in front
65
+ text2isometric help [COMMAND] # Describe available commands or one specific command
66
+ text2isometric instgrafflescript # install omnigraffle applescript
67
+ text2isometric plane TEXT # Generate text in plane
68
+ text2isometric side TEXT # Generate text in side
69
+ text2isometric top TEXT # Generate text in top
70
+ text2isometric version # Display version
71
+
72
+ Options:
73
+ -c, [--color=COLOR] # text color css compatible, default black
74
+ -s, [--size=N] # text size in pixels, default 80
75
+ -f, [--font=FONT] # Font, default Arial
76
+ ```
77
+
78
+
79
+ Maybe someday this will be more usable. Or the people at omnigroup will
80
+ add this functionality natively. I hope the last.
81
+
82
+ ## Contributing
83
+
84
+ 1. Fork it ( https://github.com/[my-github-username]/text2isometric/fork )
85
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
86
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
87
+ 4. Push to the branch (`git push origin my-new-feature`)
88
+ 5. Create a new Pull Request
89
+
90
+
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'thor'
5
+ require "text2isometric"
6
+
7
+ Text2isometric::Commands.start(ARGV)
8
+
9
+
10
+
11
+
Binary file
@@ -0,0 +1,123 @@
1
+ require "text2isometric/version"
2
+ require 'ostruct'
3
+ require 'erb'
4
+
5
+ module Text2isometric
6
+ class Commands < Thor
7
+ class_option :color, :desc => 'text color css compatible, default black', :aliases => '-c', :type => :string
8
+ class_option :size, :desc => 'text size in pixels, default 80', :aliases => '-s', :type => :numeric
9
+ class_option :font, :desc => 'Font, default Arial', :aliases => '-f', :type => :string
10
+
11
+ def initialize(*args)
12
+ super
13
+ @output_dir = File.expand_path('~') + "/isometric"
14
+ end
15
+
16
+ desc "version", "Display version"
17
+ def version
18
+ print Text2isometric::VERSION + "\n"
19
+ end
20
+
21
+ desc "instgrafflescript", "install omnigraffle applescript"
22
+ def instgrafflescript
23
+ script_path = File.expand_path('../../templates/isometric-text.scpt',__FILE__)
24
+ dest_path = File.expand_path('~') + "/Library/Scripts/Applications/OmniGraffle/"
25
+ system "cp -v #{script_path} #{dest_path}"
26
+ end
27
+
28
+ desc "side TEXT", "Generate text in side"
29
+ def side(text)
30
+ create_isometric(text, 'side')
31
+ end
32
+
33
+ desc "plane TEXT", "Generate text in plane"
34
+ def plane(text)
35
+ create_isometric(text, 'plane')
36
+ end
37
+
38
+ desc "front TEXT", "Generate text in front"
39
+ def front(text)
40
+ create_isometric(text, 'front')
41
+ end
42
+
43
+ desc "top TEXT", "Generate text in top"
44
+ def top(text)
45
+ create_isometric(text, 'top')
46
+ end
47
+
48
+ desc "cube", "show cube with directions"
49
+ def cube
50
+ cube = <<CUBE
51
+ .......
52
+ .... ....
53
+ .... ....
54
+ .... t ....
55
+ .... o ...
56
+ |... p ...|
57
+ | .... .... |
58
+ | .... .... |
59
+ | .... .... |
60
+ | f .... ... |
61
+ | r | |
62
+ | o | e |
63
+ | n | d |
64
+ | t | i |
65
+ | | s |
66
+ ...... | .... e
67
+ ..... | ..... n
68
+ ..... | ..... a
69
+ ....|.... l
70
+ . p
71
+
72
+
73
+ CUBE
74
+ print cube
75
+ end
76
+
77
+ private
78
+
79
+ def create_isometric(text, axis)
80
+ system "rm -Rf #{@output_dir}"
81
+ system "mkdir -p #{@output_dir}"
82
+
83
+ r = {}
84
+ if options[:size]
85
+ r['size'] = options[:size]
86
+ else
87
+ r['size'] = '80'
88
+ end
89
+
90
+ unless options[:font].empty?
91
+ r['color'] = options[:color]
92
+ else
93
+ r['color'] = 'black'
94
+ end
95
+
96
+ unless options[:font].empty?
97
+ r['font'] = options[:font]
98
+ else
99
+ r['font'] = 'black'
100
+ end
101
+
102
+ r['text'] = text
103
+ r['transform_class'] = axis
104
+
105
+ erb_path = File.expand_path('../../templates/text.html.erb',__FILE__)
106
+ template = File.read(erb_path)
107
+ namespace = OpenStruct.new(
108
+ r:r
109
+ )
110
+ result = ERB.new(template).result(namespace.instance_eval { binding })
111
+ File.open("#{@output_dir}/text.html", 'w') { |file| file.write(result)}
112
+
113
+ #html -> png
114
+ system "/usr/local/bin/webkit2png -F --transparent -o #{@output_dir}/out #{@output_dir}/text.html"
115
+ system "/usr/local/bin/convert #{@output_dir}/out-full.png -define png:big-depth=16 -define png:color-type=6 -trim #{@output_dir}/trim.png"
116
+ system "mv #{@output_dir}/trim.png #{@output_dir}/isometric.png"
117
+
118
+ print "created:\n"
119
+ print "#{@output_dir}/isometric.png\n"
120
+ end
121
+ end
122
+ end
123
+
@@ -0,0 +1,3 @@
1
+ module Text2isometric
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,22 @@
1
+ set myAxis to choose from list {"side", "plane", "front", "top", "free"} with prompt "Please select which sound you like best" default items "side"
2
+
3
+ display dialog "Enter text" default answer myAxis
4
+ set myText to text returned of the result
5
+
6
+ display dialog "Enter text" default answer "--size 80 --color black --font 'Arial'"
7
+ set myOptions to text returned of the result
8
+
9
+ do shell script "/Users/pim/.rvm/bin/rvm default do text2isometric " & myAxis & " '" & myText & "' " & myOptions
10
+
11
+ tell application "Image Events"
12
+ set img to open "/Users/pim/test2isometric/isometric.png"
13
+ set my_dimensions to dimensions of img
14
+ set my_x to item 1 of my_dimensions as integer
15
+ set my_y to item 2 of my_dimensions as integer
16
+ end tell
17
+
18
+ tell application id "com.omnigroup.OmniGraffle6"
19
+ tell canvas of front window
20
+ make new shape at end of graphics with properties {fill:no fill, draws stroke:false, draws shadow:false, image scale:1, size:{my_x, my_y}, image:"/Users/pim/isometric/isometric.png"}
21
+ end tell
22
+ end tell
@@ -0,0 +1,85 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+
7
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
8
+
9
+ <style type="text/css" media="screen">
10
+
11
+ body {
12
+ text-align: center;
13
+ font-family: sans-serif;
14
+ }
15
+
16
+ .cube {
17
+ position: absolute;
18
+ top: 90px;
19
+ left: 360px;
20
+ }
21
+
22
+ .face {
23
+ position: absolute;
24
+ /* border: 1px black solid;*/
25
+ xxxoverflow: hidden;
26
+ xxxfont-family: Arial;
27
+ xxxfont-size: 24px;
28
+ }
29
+
30
+ .plane {
31
+ top: 1000;
32
+ left: 8600px;
33
+ background: none;
34
+ color: #999;
35
+ /* -webkit-transform: matrix(0.8965754721680534, -0.5176380902050416, 0.8965754721680536, 0.5176380902050415, 0, 0);*/
36
+ -webkit-transform: rotate(-30deg) skewX(30deg) skewY(0deg) scaleY(0.87);
37
+ -ms-transform: rotate(-30deg) skewX(30deg) skewY(0deg) scaleY(0.87);
38
+ -moz-transform: rotate(-30deg) skewX(30deg) skewY(0deg) scaleY(0.87);
39
+ -o-transform: rotate(-30deg) skewX(30deg) skewY(0deg) scaleY(0.87);
40
+ transform: rotate(-30deg) skewX(30deg) skewY(0deg) scaleY(0.87);
41
+ }
42
+
43
+ .front {
44
+ top: 10650px;
45
+ left: 0;
46
+ background: none;
47
+ color: #333;
48
+ /* -webkit-transform: matrix(0.8965754721680536, 0.5176380902050415, 0, 1.035276180410083, 0, 0);*/
49
+ -webkit-transform: rotate(30deg) skewX(30deg) skewY(0deg);
50
+ -ms-transform: rotate(30deg) skewX(30deg) skewY(0deg);
51
+ -moz-transform: rotate(30deg) skewX(30deg) skewY(0deg);
52
+ -o-transform: rotate(30deg) skewX(30deg) skewY(0deg);
53
+ transform: rotate(30deg) skewX(30deg) skewY(0deg);
54
+ }
55
+
56
+ .side {
57
+ top: 10650px;
58
+ left: 172px;
59
+ background: none;
60
+ color: #666;
61
+ /* -webkit-transform: matrix(0.8965754721680536, -0.5176380902050415, 0, 1.035276180410083, 0, 0);*/
62
+ -webkit-transform: rotate(-30deg) skewX(-30deg) skewY(0deg);
63
+ -ms-transform: rotate(-30deg) skewX(-30deg) skewY(0deg);
64
+ -moz-transform: rotate(-30deg) skewX(-30deg) skewY(0deg);
65
+ -o-transform: rotate(-30deg) skewX(-30deg) skewY(0deg);
66
+ transform: rotate(-30deg) skewX(-30deg) skewY(0deg);
67
+ }
68
+
69
+ .top {
70
+ top: 1065px;
71
+ left: 172px;
72
+ background: none;
73
+ color: #666;
74
+ }
75
+
76
+ </style>
77
+ </head>
78
+ <body>
79
+
80
+ <div class="face <%= r['transform_class'] %> " style="color: <%= r['color'] %>; font:<%= r['size'] %>px <%= r['font'] %>;">
81
+ <%= r['text'] %>
82
+ </div>
83
+
84
+ </body>
85
+ </html>
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'text2isometric/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "text2isometric"
8
+ spec.version = Text2isometric::VERSION
9
+ spec.authors = ["Pim Snel"]
10
+ spec.email = ["pim@lingewoud.nl"]
11
+ spec.summary = %q{Generates isometric images from text}
12
+ spec.description = %q{Generates isometric images from text using webkit2png}
13
+ spec.homepage = "https://github.com/mipmip/text2isometric"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_runtime_dependency "thor", "~> 0.19"
24
+ end
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: text2isometric
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Pim Snel
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-01-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: thor
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.19'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.19'
55
+ description: Generates isometric images from text using webkit2png
56
+ email:
57
+ - pim@lingewoud.nl
58
+ executables:
59
+ - text2isometric
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - bin/text2isometric
69
+ - intro.graffle
70
+ - isometric-blue-grid.graffle
71
+ - lib/text2isometric.rb
72
+ - lib/text2isometric/version.rb
73
+ - templates/isometric-text.scpt
74
+ - templates/text.html.erb
75
+ - text2isometric.gemspec
76
+ homepage: https://github.com/mipmip/text2isometric
77
+ licenses:
78
+ - MIT
79
+ metadata: {}
80
+ post_install_message:
81
+ rdoc_options: []
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ requirements: []
95
+ rubyforge_project:
96
+ rubygems_version: 2.4.3
97
+ signing_key:
98
+ specification_version: 4
99
+ summary: Generates isometric images from text
100
+ test_files: []