Class: IconBanner::AppIconSet

Inherits:
Process
  • Object
show all
Defined in:
lib/icon_banner/appiconset.rb

Constant Summary collapse

BASE_ICON_PATH =
'/**/*.appiconset/*.png'
PLATFORM =
'iOS'
PLATFORM_CODE =
'ios'

Constants inherited from Process

Process::BACKUP_EXTENSION

Instance Method Summary collapse

Methods inherited from Process

#create_backup, #find_base_color, #generate, #get_app_icons, #process_icon, #restore, #restore_backup, #validate_platform

Instance Method Details

#backup_path(path) ⇒ Object



41
42
43
44
# 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) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# 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) ⇒ Object



46
47
48
# File 'lib/icon_banner/appiconset.rb', line 46

def should_ignore_icon(icon)
  icon[/\/Carthage\//] || icon[/\/Pods\//] || icon[/\/Releases\//] || icon[/\/checkouts\//]
end