class ImageParadise::RandomTextToImage
Constants
- BE_VERBOSE
#¶ ↑
BE_VERBOSE
¶ ↑#¶ ↑
- DEFAULT_FONT
#¶ ↑
DEFAULT_FONT
¶ ↑#¶ ↑
- DEFAULT_FONT_SIZE
#¶ ↑
DEFAULT_FONT_SIZE
¶ ↑#¶ ↑
- DEFAULT_TEXT
#¶ ↑
DEFAULT_TEXT
¶ ↑#¶ ↑
- IMAGE_DIRECTORY
#¶ ↑
IMAGE_DIRECTORY
¶ ↑#¶ ↑
- IMAGE_TYPE
#¶ ↑
IMAGE_TYPE
¶ ↑#¶ ↑
- RUN_SYSTEM
#¶ ↑
RUN_SYSTEM
¶ ↑#¶ ↑
- STORE_INTO_THIS_YAML_FILE
#¶ ↑
STORE_INTO_THIS_YAML_FILE
¶ ↑#¶ ↑
Attributes
be_verbose[W]
Public Class Methods
new( i = DEFAULT_TEXT, append_this_to_saved_filename = '', run_already = true, be_verbose = BE_VERBOSE )
click to toggle source
#¶ ↑
initialize¶ ↑
#¶ ↑
# File lib/image_paradise/utility_scripts/random_text_to_image.rb, line 58 def initialize( i = DEFAULT_TEXT, append_this_to_saved_filename = '', run_already = true, be_verbose = BE_VERBOSE ) set_be_verbose(be_verbose) reset set_append_this_to_saved_filename( append_this_to_saved_filename ) set_text(i) set_everything run if run_already end
Public Instance Methods
get_random_colour()
click to toggle source
#¶ ↑
get_random_colour
¶ ↑
get random colours
#¶ ↑
# File lib/image_paradise/utility_scripts/random_text_to_image.rb, line 320 def get_random_colour Colours.html_colours?.sample end
Also aliased as: random_colour
random_number(i = 20)
click to toggle source
#¶ ↑
random_number
¶ ↑
#¶ ↑
# File lib/image_paradise/utility_scripts/random_text_to_image.rb, line 221 def random_number(i = 20) rand(i) end
Also aliased as: rd, random_plus
remove_old_image_file(i = @stored_where)
click to toggle source
report_where_we_stored_it()
click to toggle source
reset()
click to toggle source
run()
click to toggle source
run_n_times( n_times = HOW_MANY_TIMES )
click to toggle source
run_sys_cmd()
click to toggle source
run_system?()
click to toggle source
set_append_this_to_saved_filename(i)
click to toggle source
set_background_colour()
click to toggle source
set_be_verbose(i)
click to toggle source
set_blur()
click to toggle source
set_border()
click to toggle source
set_canvas()
click to toggle source
set_channel()
click to toggle source
set_draw1()
click to toggle source
set_draw2()
click to toggle source
set_everything()
click to toggle source
#¶ ↑
set_everything
¶ ↑
#¶ ↑
# File lib/image_paradise/utility_scripts/random_text_to_image.rb, line 136 def set_everything # wrapper to set everything. random_plus = rd(225) set_width set_height set_size( @width.to_i * 8+random_plus, @height.to_i * 7+random_plus ) set_canvas set_font set_pointsize set_draw1 set_channel set_blur set_transparent # if we want a transparent background. # set_background_colour set_fill set_stroke set_draw2 # set_border # Something is weird here. set_name # This here should come right before run_sys_cmd is called. end
set_fill(which_colour = get_random_colour)
click to toggle source
set_font(this_font = DEFAULT_FONT)
click to toggle source
set_height()
click to toggle source
set_name( this_name = 'output' )
click to toggle source
#¶ ↑
set_name
¶ ↑
#¶ ↑
# File lib/image_paradise/utility_scripts/random_text_to_image.rb, line 245 def set_name( this_name = 'output' ) this_name = this_name.dup if this_name.frozen? this_name << @append_this_to_saved_filename this_name << IMAGE_TYPE @stored_where = IMAGE_DIRECTORY+'/'+this_name# keep a reference where it is stored. @_ << ' '+@stored_where end
set_pointsize(i = 12+random_plus(75))
click to toggle source
set_size(width = 500, height = 500)
click to toggle source
set_stroke()
click to toggle source
set_text(i = DEFAULT_TEXT)
click to toggle source
#¶ ↑
set_text
¶ ↑
#¶ ↑
# File lib/image_paradise/utility_scripts/random_text_to_image.rb, line 91 def set_text(i = DEFAULT_TEXT) # this sets the @text variable. _ = STORE_INTO_THIS_YAML_FILE if i.is_a? Array if i.empty? i = DEFAULT_TEXT else i = i.join(' ').strip end end i = DEFAULT_TEXT if i.nil? if i == 'LAST' # treat LAST as special instruction. if File.exist? _ i = YAML.load_file(_) else opn; e 'Sorry, file '+sfile(_)+' does not exist.' end end i.gsub!("'", "\\\\'") if i.include? "'" @text = i end
set_transparent()
click to toggle source
set_width()
click to toggle source
store_last_command_into_yaml_file()
click to toggle source
stored_where?()
click to toggle source
#¶ ↑
stored_where
?¶ ↑
#¶ ↑
# File lib/image_paradise/utility_scripts/random_text_to_image.rb, line 339 def stored_where? @stored_where end
Also aliased as: stored_where