Created
June 4, 2010 13:19
-
-
Save j1n3l0/425396 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env ruby | |
require "rubygems" | |
require "RMagick" | |
# | |
# draw the sequence in the background | |
def draw_sequence( image ) | |
sequence = Magick::Draw.new | |
start = 0 | |
stop = image.columns | |
height = image.rows / 2 | |
sequence.stroke( "black" ) | |
# sequence.stroke_width(2.5) | |
sequence.line( start, height, stop, height ) | |
sequence.draw( image ) | |
return image | |
end | |
# | |
# draw an arrow at a point | |
def draw_arrow( image, point ) | |
arrow = Magick::Draw.new | |
arrow.stroke( "black" ) | |
# arrow.stroke_width(1.5) | |
arrow.line( 100,45,point.first, point.last ).draw( image ) | |
arrow.line( 98,48,point.first, point.last ).draw( image ) | |
arrow.line( 102,48,point.first, point.last ).draw( image ) | |
return arrow | |
end | |
# | |
# prototyping rendering AsiSI | |
def draw_asisi( image, position ) | |
asisi = Magick::Draw.new | |
# draw the AsiSI on the sequence | |
asisi.annotate( image, 50, 20, position, 25, "AsiSI" ) do | |
self.gravity = Magick::CenterGravity | |
self.stroke = "black" | |
self.pointsize = 14 | |
self.font_family = "arial" | |
end | |
draw_arrow( image, [100, 50] ) | |
return image | |
end | |
# | |
# Main script | |
image_file = "./asisi.png" | |
image = Magick::Image.new( 200, 100 ) | |
draw_sequence( image ) | |
draw_asisi( image, 75 ) | |
# write image to file | |
image.write( image_file ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment