-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
nooodl
committed
Jul 29, 2011
1 parent
8632c10
commit c0ba0eb
Showing
4 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
require 'RMagick' | ||
include Magick | ||
$CGANAMES = %w(black blue green cyan red magenta brown lgray gray lblue lgreen lcyan lred lmagenta yellow white) | ||
|
||
def cga(cname) | ||
n = $CGANAMES.index cname | ||
c = Array.new(3) {|i| n[2-i] * 0xAA + n[3] * 0x55} | ||
c[1] = 0x55 if n == 6 | ||
return c | ||
end | ||
|
||
def write_icon(filename, color, symbol) | ||
color = cga(color) if color.is_a? String | ||
r, g, b = *color | ||
fg = "rgb(#{r>>0},#{g>>0},#{b>>0})" | ||
bg = "rgb(#{r>>4},#{g>>4},#{b>>4})" | ||
|
||
img = Image.new(50, 50) {self.background_color = bg} | ||
Draw.new.annotate(img, 0, 0, 0, 0, symbol) { | ||
self.font_family = 'DejaVu Sans Mono' | ||
self.fill = fg | ||
self.pointsize = 40 | ||
self.gravity = CenterGravity | ||
} | ||
img.border(2, 2, fg).write("./icons/#{filename}.png") | ||
end | ||
|
||
write_icon *$_.split while DATA.gets | ||
|
||
__END__ | ||
old-ascension lgray < | ||
anti-stoner red x | ||
escapologist brown ( |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.