#!/usr/bin/ruby -w =begin /*************************************************************************** * Copyright (C) 2006, Paul Lutus * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ =end # version: 1.3 if !ARGV[0] || ARGV.length < 3 puts "usage: interior color (hex) radius id (example: \"green\")" puts "result: creates stylesheet file and sample HTML" exit 0 else interior,radius,id = ARGV end graphic_background = (interior =~ /url\(/i) css_baseclass = "roundcorner_#{radius}_#{id}" target_css = "#{css_baseclass}.css" target_html = "#{css_baseclass}.html" radius = radius.to_i array = [] # create an array of margin values 0.upto(radius-1) do |i| x = i.to_f/radius y = 1.0 - Math.sqrt(1.0-(x*x)) r = (y * radius).to_i array << r if r > 0 end # content of sample HTML page roundcorner_html = "\n
\n" roundcorner_html += "\n" roundcorner_html += "\n\n" roundcorner_html += "