frameit/lib/frameit/editor.rb
# Add the title above or below the device
Add the title above or below the device
Add the title above or below the device
def put_title_into_background_stacked(background, title, keyword)
      resize_text(title)
      resize_text(keyword)
      vertical_padding = vertical_frame_padding 
      keyword_top_space = vertical_padding
      spacing_between_title_and_keyword = (actual_font_size / 2)
      title_top_space = vertical_padding + keyword.height + spacing_between_title_and_keyword
      title_left_space = (background.width / 2.0 - title.width / 2.0).round
      keyword_left_space = (background.width / 2.0 - keyword.width / 2.0).round
      self.space_to_device += title.height + keyword.height + spacing_between_title_and_keyword + vertical_padding
      title_below_image = fetch_config['title_below_image']
      background = background.composite(keyword, "png") do |c|
        c.compose("Over")
        c.geometry("+#{keyword_left_space}+#{keyword_top_space}") unless title_below_image
        c.geometry("+#{keyword_left_space}+#{background.height - space_to_device + keyword_top_space}") if title_below_image
      end
      background = background.composite(title, "png") do |c|
        c.compose("Over")
        c.geometry("+#{title_left_space}+#{title_top_space}") unless title_below_image
        c.geometry("+#{title_left_space}+#{background.height - space_to_device + title_top_space}") if title_below_image
      end
      background
    end
def put_title_into_background_stacked ( background , title , keyword ) resize_text ( title ) resize_text ( keyword ) vertical_padding = vertical_frame_padding keyword_top_space = vertical_padding spacing_between_title_and_keyword = ( actual_font_size / 2 ) title_top_space = vertical_padding + keyword . height + spacing_between_title_and_keyword title_left_space = ( background . width / 2.0 - title . width / 2.0 ) . round keyword_left_space = ( background . width / 2.0 - keyword . width / 2.0 ) . round self . space_to_device += title . height + keyword . height + spacing_between_title_and_keyword + vertical_padding title_below_image = fetch_config [ 'title_below_image' ] background = background . composite ( keyword , "png" ) do | c | c . compose ( "Over" ) c . geometry ( "+#{keyword_left_space}+#{keyword_top_space}" ) unless title_below_image c . geometry ( "+#{keyword_left_space}+#{background.height - space_to_device + keyword_top_space}" ) if title_below_image end background = background . composite ( title , "png" ) do | c | c . compose ( "Over" ) c . geometry ( "+#{title_left_space}+#{title_top_space}" ) unless title_below_image c . geometry ( "+#{title_left_space}+#{background.height - space_to_device + title_top_space}" ) if title_below_image end background end
Add the title above or below the device
Add the title above or below the device
# assign padding to variable # keyword # Place the title below the keyword
background
<not_specific>
title
<not_specific>
keyword
<not_specific>