frameit/lib/frameit/editor.rb
# more complex mode: background, frame and title
more complex mode: background, frame and title
more complex mode : background frame and title
def complex_framing
      background = generate_background
      self.space_to_device = vertical_frame_padding
      if fetch_config['title']
        background = put_title_into_background(background, fetch_config['stack_title'])
      end
      if self.frame 
        resize_frame!
        put_into_frame
        frame_width = background.width - horizontal_frame_padding * 2
        frame_height = background.height - space_to_device - vertical_frame_padding
        if fetch_config['show_complete_frame']
          image_aspect_ratio = @image.width.to_f / @image.height.to_f
          image_width = [frame_width, @image.width].min
          image_height = [frame_height, image_width / image_aspect_ratio].min
          image_width = image_height * image_aspect_ratio
          @image.resize("#{image_width}x#{image_height}") if image_width < @image.width || image_height < @image.height
        else
          @image.resize("#{frame_width}x") if frame_width < @image.width
        end
      end
      @image = put_device_into_background(background)
      image
    end
def complex_framing background = generate_background self . space_to_device = vertical_frame_padding if fetch_config [ 'title' ] background = put_title_into_background ( background , fetch_config [ 'stack_title' ] ) end if self . frame resize_frame! put_into_frame frame_width = background . width - horizontal_frame_padding * 2 frame_height = background . height - space_to_device - vertical_frame_padding if fetch_config [ 'show_complete_frame' ] image_aspect_ratio = @image . width . to_f / @image . height . to_f image_width = [ frame_width , @image . width ] . min image_height = [ frame_height , image_width / image_aspect_ratio ] . min image_width = image_height * image_aspect_ratio @image . resize ( "#{image_width}x#{image_height}" ) if image_width < @image . width || image_height < @image . height else @image . resize ( "#{frame_width}x" ) if frame_width < @image . width end end @image = put_device_into_background ( background ) image end
more complex mode: background, frame and title
more complex mode : background frame and title
# we have no frame on le mac # Decrease the size of the framed screenshot to fit into the defined padding + background # calculate the final size of the screenshot to resize in one go # it may be limited either by the width or height of the frame # the screenshot size is only limited by width. # If higher than the frame, the screenshot is cut off at the bottom