Class: Wordcram::Sketch

Inherits:
Processing::App
  • Object
show all
Includes:
Style
Defined in:
lib/wordcram/sketch.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Style

#angled_at, #angled_between, #black, #blue, #center_clump, #colors, #create_placer, #fonts, #from, #green, #horiz_band_anchored_left, #horizontal_line, #orange, #placer, #red, #sized_by_rank, #sized_by_weight, #swirl, #text_case, #upper_left, #wave, #white, #word_padding, #yellow

Constructor Details

#initialize(&block) ⇒ Sketch

Returns a new instance of Sketch.



6
7
8
9
# File 'lib/wordcram/sketch.rb', line 6

def initialize(&block)
  @block = block
  super()
end

Instance Attribute Details

#blockObject

Returns the value of attribute block.



4
5
6
# File 'lib/wordcram/sketch.rb', line 4

def block
  @block
end

#wordcramObject

Returns the value of attribute wordcram.



4
5
6
# File 'lib/wordcram/sketch.rb', line 4

def wordcram
  @wordcram
end

Instance Method Details

#canvas(&block) ⇒ Object



11
12
13
# File 'lib/wordcram/sketch.rb', line 11

def canvas(&block)
  self.instance_eval(&block)
end

#save_to(path) ⇒ Object



23
24
25
# File 'lib/wordcram/sketch.rb', line 23

def save_to(path)
  saveFrame(path)
end

#setupObject



15
16
17
18
19
20
21
# File 'lib/wordcram/sketch.rb', line 15

def setup
  @wordcram = Java.wordcram.WordCram.new(self)

  self.instance_eval(&@block)

  @wordcram.draw_all()
end