#!/usr/bin/perl -w
#=========================================================================
#
#    [WHAT IT DOES]
#
#    [DESCRIPTION]
#
#    $Id: $
#    Last change: <Mon, 2010/12/20 18:46:53 arwagner agamemnon>
#    Author     : Alexander Wagner
#    Language   : Perl
#
#-------------------------------------------------------------------------
#
#    Copyright (C) 2005 by Alexander Wagner
#
#    This is free software; you can redistribute it and/or modify it
#    under the terms of the GNU Genereal Public License as published
#    by the Free Software Foundation; either version 2, or (at your
#    option) any later version.
#
#    This program is distributed in the hope that it will be usefull,
#    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 recieved a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#=========================================================================

#====================================================================
# The main program
#====================================================================

my @sizes = (25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80);
my $out   = "Scid.tcl";
my $name  = "USCF";
my $outmime  = "/dev/shm/out.mime64";

open (OUT, ">$out") or die "Can't open $out: $!\n";

print OUT "lappend boardStyles $name\n";

foreach $s (@sizes) {

	$outimg = "scid-$s.png";
	
	system ("rm $outmime");
	system ("mpack -s none -o $outmime $outimg");

	print OUT "set pieceImageData($name,$s) {\n";
	open (IN, "<$outmime") or die "Can't open $outmime: $!\n";

	for (my $i=0; $i<14; $i++) {
		$line = <IN>;
	}

	while ($line = <IN>) {
		next if $line =~ m/^\n/;
		next if $line =~ m/^-----\n/;
		print OUT $line;
	}
	close(IN);

	print OUT "}\n\n";


}





