Module: Wordcram::Style

Included in:
Sketch
Defined in:
lib/wordcram/styles/styles.rb

Instance Method Summary collapse

Instance Method Details

#angled_at(angle) ⇒ Object

Angler


8
9
10
# File 'lib/wordcram/styles/styles.rb', line 8

def angled_at(angle)
  wordcram.angled_at(angle)
end

#angled_between(from, to) ⇒ Object


12
13
14
# File 'lib/wordcram/styles/styles.rb', line 12

def angled_between(from, to)
  wordcram.angled_between(from, to)
end

#blackObject


52
53
54
# File 'lib/wordcram/styles/styles.rb', line 52

def black
  color(0, 0, 0)
end

#blueObject


40
41
42
# File 'lib/wordcram/styles/styles.rb', line 40

def blue
  color(0, 0, 255)
end

#center_clumpObject


143
144
145
# File 'lib/wordcram/styles/styles.rb', line 143

def center_clump
  Java.wordcram.Placers.center_clump
end

#colors(*colors) ⇒ Object

Color


32
33
34
35
36
37
38
# File 'lib/wordcram/styles/styles.rb', line 32

def colors(*colors)
  if colors.size == 1
    wordcram.with_color(*colors)
  else
    wordcram.with_colors(*colors)
  end
end

#create_placer(name) ⇒ Object

Placer


119
120
121
122
123
# File 'lib/wordcram/styles/styles.rb', line 119

def create_placer(name)
  placer = send(name)
rescue NoMethodError
  placer = ''
end

#fonts(*fonts) ⇒ Object

Font


73
74
75
76
77
78
79
# File 'lib/wordcram/styles/styles.rb', line 73

def fonts(*fonts)
  if fonts.size == 1
    wordcram.with_font(*fonts)
  else
    wordcram.with_fonts(*fonts)
  end
end

#from(content, options = {}) ⇒ Object

Sources


108
109
110
111
112
# File 'lib/wordcram/styles/styles.rb', line 108

def from(content, options = {})
  wordcram.send(:"from_#{options[:as]}", content)
rescue NoMethodError
  wordcram.send(:from_text_string, content)
end

#greenObject


44
45
46
# File 'lib/wordcram/styles/styles.rb', line 44

def green
  color(0, 255, 0)
end

#horiz_band_anchored_leftObject


147
148
149
# File 'lib/wordcram/styles/styles.rb', line 147

def horiz_band_anchored_left
  Java.wordcram.Placers.horiz_band_anchored_left
end

#horizontal_lineObject

Bundled Placers


139
140
141
# File 'lib/wordcram/styles/styles.rb', line 139

def horizontal_line
  Java.wordcram.Placers.horiz_line
end

#orangeObject


48
49
50
# File 'lib/wordcram/styles/styles.rb', line 48

def orange
  color(255, 127, 0)
end

#placer(placer = nil, &block) ⇒ Object


125
126
127
128
129
130
131
132
# File 'lib/wordcram/styles/styles.rb', line 125

def placer(placer=nil, &block)
  if placer.nil?
    placer = Placer.new &block
  else
    placer = create_placer(placer)
  end
  wordcram.with_placer(placer)
end

#redObject


64
65
66
# File 'lib/wordcram/styles/styles.rb', line 64

def red
  color(255, 0, 0)
end

#sized_by_rank(options) ⇒ Object


99
100
101
# File 'lib/wordcram/styles/styles.rb', line 99

def sized_by_rank(options)
  wordcram.sized_by_rank(options[:min], options[:max])
end

#sized_by_weight(options) ⇒ Object

Sizer


95
96
97
# File 'lib/wordcram/styles/styles.rb', line 95

def sized_by_weight(options)
  wordcram.sized_by_weight(options[:min], options[:max])
end

#swirlObject


151
152
153
# File 'lib/wordcram/styles/styles.rb', line 151

def swirl
  Java.wordcram.Placers.swirl
end

#text_case(option) ⇒ Object

Case


21
22
23
24
25
# File 'lib/wordcram/styles/styles.rb', line 21

def text_case(option)
  wordcram.send :"#{option}_case"
rescue NoMethodError
  wordcram.keep_case
end

#upper_leftObject


155
156
157
# File 'lib/wordcram/styles/styles.rb', line 155

def upper_left
  Java.wordcram.Placers.upper_left
end

#waveObject


159
160
161
# File 'lib/wordcram/styles/styles.rb', line 159

def wave
  Java.wordcram.Placers.wave
end

#whiteObject


56
57
58
# File 'lib/wordcram/styles/styles.rb', line 56

def white
  color(255, 255, 255)
end

#word_padding(padding) ⇒ Object

Padding


86
87
88
# File 'lib/wordcram/styles/styles.rb', line 86

def word_padding(padding)
  wordcram.with_word_padding(padding)
end

#yellowObject


60
61
62
# File 'lib/wordcram/styles/styles.rb', line 60

def yellow
  color(255, 255, 0)
end