21 lines
484 B
Ruby
Executable File
21 lines
484 B
Ruby
Executable File
#!/usr/bin/env ruby
|
|
|
|
require "fileutils"
|
|
|
|
ICON = "share/jes/icons/jes-32x32.png"
|
|
OUTFILE = "src/jes/gui/icon.d"
|
|
|
|
system(*%W[convert #{ICON} bgra:icon.bgra])
|
|
icon_bgra = File.binread("icon.bgra")
|
|
FileUtils.rm_f("icon.bgra")
|
|
|
|
File.open(OUTFILE, "wb") do |fh|
|
|
fh.puts "module jes.gui.icon;"
|
|
fh.puts
|
|
fh.puts "const ubyte[] icon_32x32_bgra = ["
|
|
icon_bgra.bytes.each_slice(8) do |bytes|
|
|
fh.puts " #{bytes.map {|b| sprintf("0x%02xu,", b)}.join(" ")}"
|
|
end
|
|
fh.puts "];"
|
|
end
|