class IconBanner::AppIconSet

Constants

BASE_ICON_PATH
PLATFORM
PLATFORM_CODE

Public Instance Methods

backup_path(path) click to toggle source
# File lib/icon_banner/appiconset.rb, line 41
def backup_path(path)
  ext = File.extname path
  path.gsub(ext, BACKUP_EXTENSION + ext)
end
generate_banner(path, label, color, font) click to toggle source
# File lib/icon_banner/appiconset.rb, line 12
def generate_banner(path, label, color, font)
  MiniMagick::Tool::Convert.new do |convert|
    convert.size '1024x1024'
    convert << 'xc:transparent'
    convert << path
  end

  banner = MiniMagick::Image.new path

  banner.combine_options do |combine|
    combine.fill 'rgba(0,0,0,0.25)'
    combine.draw 'polygon 0,306 0,590 590,0 306,0'
    combine.blur '0x10'
  end

  banner.combine_options do |combine|
    combine.fill 'white'
    combine.draw 'polygon 0,306 0,590 590,0 306,0'
  end

  banner.combine_options do |combine|
    combine.font font
    combine.fill color
    combine.gravity 'Center'
    combine.pointsize 150 - ([label.length - 8, 0].max * 8)
    combine.draw "affine 0.5,-0.5,0.5,0.5,-286,-286 text 0,0 \"#{label}\""
  end
end
should_ignore_icon(icon) click to toggle source
# File lib/icon_banner/appiconset.rb, line 46
def should_ignore_icon(icon)
  icon[/\/Carthage\//] || icon[/\/Pods\//] || icon[/\/Releases\//]
end