Michal Rudolf wrote:

Hi!
>> - it is now easy to switch square textures (see the menu options ->
>> chessboard -> colors...).
> Nice. BTW it will be nice to make squares as different as possible. For
> example texture 8 will probably be improved by rotating one of the square
> graphics.

A better algorithm is to arrange the square bitmaps into one large board of wood and cut the squares from the full wood. Included an example I used to generate board bitmaps for Shredder by generating individual bitmaps for each square (provided the input file is large enough).


#!/bin/bash
#----------------------------------------------------------------------
# Board Creator for Shredder 9
#
# This script can be used to create board bitmaps for Shredder.
# To get realistic boards every square gets its individual texture.
# The script is called with several texture files, then creates 
# the "full material" and cuts the squares from those. These individual
# squares are then glued together to form the final board.
# 
# This script requires ImageMagick, namely convert and montage.
#
# Synopsis:
#
#     ShredderBoard DarkSquareTexture LiteSquareTexture BackgroundTexture 
BoardFrametexture
#
# (c) 2006 by Alexander Wagner
#
#----------------------------------------------------------------------

# The usual dimensions for Shredder9

# The full bitmap including background
boardsize="720x720"
# The actual chessboard
innerbrd="640x640"
# The chessboard + the sourrounding frame
framesize="645x645"
# The frame itself
frame1="+5+5"
# The background
bkgsize="+35+35"
# The size of each square
tilesize="80x80"
# Set to +1+1 if a thin (black) border should be drawn
if [ ! $5 ]; then 
        tilespec="+0+0 -background black"
else 
        tilespec="+1+1 -background black"
fi

# Offset of the tiles cut in several steps to get individual
# tiles for each square like a real world board.
xoff1="+0"
xoff2="+80"
xoff3="+160"
xoff4="+240"

yoff1="+0"
yoff2="+80"
yoff3="+160"
yoff4="+240"

echo "----------------------------------------------------------------------"
echo "Shredder Chess Board Creator 1.0"
echo ""
echo "This script will generate the graphics required by the Shredder GUI" 
echo "for the chess board displayed."
echo ""
echo "Call this program with four texture files:"
echo "   The one the dark squares"
echo "   The one the lite squares"
echo "   The one the table on which the board is set"
echo "   The one the boards frame"
echo ""
echo "NOTE: This utility requires ImageMagick to be installed!"
echo ""
echo "Synopsis:"
echo ""
echo "    ShredderBoard DarkSquareTexture LiteSquareTexture BackgroundTexture 
BoardFrametexture"
echo ""
echo "                   (c) 2006 by Alexander Wagner"
echo ""
echo "----------------------------------------------------------------------"


# Create full boards to cut the fields from
# Do this only if the full material does not exist already
# to allow the provision of the full boards
#
# If they are not provide: use argument $1 to create a $boardsize
# image tiled with the texture or dark squares and use $2 for the
# light squares. $3 is used for the background on which the board
# should be set (the table). $4 is used for the boards thin outer
# frame.
echo "Creating full material..."
if [ ! -e dark.png  ]; then convert -size $boardsize tile:$1  dark.png ; fi
if [ ! -e lite.png  ]; then convert -size $boardsize tile:$2  lite.png ; fi
if [ ! -e back.png  ]; then convert -size $boardsize tile:$3  back.png ; fi
if [ ! -e frame.png ]; then convert -size $boardsize tile:$4  frame.png; fi

# creating tiles
# Do this only if they do not already exist in case the user 
# wants to provide individual tiles
echo "Cutting the squares..."

echo -n "A "
if [ ! -e a1.png ]; then convert -crop $tilesize$xoff1$yoff1  dark.png   
a1.png; fi
if [ ! -e a2.png ]; then convert -crop $tilesize$xoff1$yoff1  lite.png   
a2.png; fi
if [ ! -e a3.png ]; then convert -crop $tilesize$xoff2$yoff1  dark.png   
a3.png; fi
if [ ! -e a4.png ]; then convert -crop $tilesize$xoff2$yoff1  lite.png   
a4.png; fi
if [ ! -e a5.png ]; then convert -crop $tilesize$xoff3$yoff1  dark.png   
a5.png; fi
if [ ! -e a6.png ]; then convert -crop $tilesize$xoff3$yoff1  lite.png   
a6.png; fi
if [ ! -e a7.png ]; then convert -crop $tilesize$xoff4$yoff1  dark.png   
a7.png; fi
if [ ! -e a8.png ]; then convert -crop $tilesize$xoff4$yoff1  lite.png   
a8.png; fi

echo -n "B "
if [ ! -e b1.png ]; then convert -crop $tilesize$xoff1$yoff1  lite.png   
b1.png; fi
if [ ! -e b2.png ]; then convert -crop $tilesize$xoff1$yoff1  dark.png   
b2.png; fi
if [ ! -e b3.png ]; then convert -crop $tilesize$xoff2$yoff1  lite.png   
b3.png; fi
if [ ! -e b4.png ]; then convert -crop $tilesize$xoff2$yoff1  dark.png   
b4.png; fi
if [ ! -e b5.png ]; then convert -crop $tilesize$xoff3$yoff1  lite.png   
b5.png; fi
if [ ! -e b6.png ]; then convert -crop $tilesize$xoff3$yoff1  dark.png   
b6.png; fi
if [ ! -e b7.png ]; then convert -crop $tilesize$xoff4$yoff1  lite.png   
b7.png; fi
if [ ! -e b8.png ]; then convert -crop $tilesize$xoff4$yoff1  dark.png   
b8.png; fi

echo -n "C "
if [ ! -e c1.png ]; then convert -crop $tilesize$xoff1$yoff2  dark.png   
c1.png; fi
if [ ! -e c2.png ]; then convert -crop $tilesize$xoff1$yoff2  lite.png   
c2.png; fi
if [ ! -e c3.png ]; then convert -crop $tilesize$xoff2$yoff2  dark.png   
c3.png; fi
if [ ! -e c4.png ]; then convert -crop $tilesize$xoff2$yoff2  lite.png   
c4.png; fi
if [ ! -e c5.png ]; then convert -crop $tilesize$xoff3$yoff2  dark.png   
c5.png; fi
if [ ! -e c6.png ]; then convert -crop $tilesize$xoff3$yoff2  lite.png   
c6.png; fi
if [ ! -e c7.png ]; then convert -crop $tilesize$xoff4$yoff2  dark.png   
c7.png; fi
if [ ! -e c8.png ]; then convert -crop $tilesize$xoff4$yoff2  lite.png   
c8.png; fi

echo -n "D "
if [ ! -e d1.png ]; then convert -crop $tilesize$xoff1$yoff2  lite.png   
d1.png; fi
if [ ! -e d2.png ]; then convert -crop $tilesize$xoff1$yoff2  dark.png   
d2.png; fi
if [ ! -e d3.png ]; then convert -crop $tilesize$xoff2$yoff2  lite.png   
d3.png; fi
if [ ! -e d4.png ]; then convert -crop $tilesize$xoff2$yoff2  dark.png   
d4.png; fi
if [ ! -e d5.png ]; then convert -crop $tilesize$xoff3$yoff2  lite.png   
d5.png; fi
if [ ! -e d6.png ]; then convert -crop $tilesize$xoff3$yoff2  dark.png   
d6.png; fi
if [ ! -e d7.png ]; then convert -crop $tilesize$xoff4$yoff2  lite.png   
d7.png; fi
if [ ! -e d8.png ]; then convert -crop $tilesize$xoff4$yoff2  dark.png   
d8.png; fi

echo -n "E "
if [ ! -e e1.png ]; then convert -crop $tilesize$xoff1$yoff3  dark.png   
e1.png; fi
if [ ! -e e2.png ]; then convert -crop $tilesize$xoff1$yoff3  lite.png   
e2.png; fi
if [ ! -e e3.png ]; then convert -crop $tilesize$xoff2$yoff3  dark.png   
e3.png; fi
if [ ! -e e4.png ]; then convert -crop $tilesize$xoff2$yoff3  lite.png   
e4.png; fi
if [ ! -e e5.png ]; then convert -crop $tilesize$xoff3$yoff3  dark.png   
e5.png; fi
if [ ! -e e6.png ]; then convert -crop $tilesize$xoff3$yoff3  lite.png   
e6.png; fi
if [ ! -e e7.png ]; then convert -crop $tilesize$xoff4$yoff3  dark.png   
e7.png; fi
if [ ! -e e8.png ]; then convert -crop $tilesize$xoff4$yoff3  lite.png   
e8.png; fi

echo -n "F "
if [ ! -e f1.png ]; then convert -crop $tilesize$xoff1$yoff3  lite.png   
f1.png; fi
if [ ! -e f2.png ]; then convert -crop $tilesize$xoff1$yoff3  dark.png   
f2.png; fi
if [ ! -e f3.png ]; then convert -crop $tilesize$xoff2$yoff3  lite.png   
f3.png; fi
if [ ! -e f4.png ]; then convert -crop $tilesize$xoff2$yoff3  dark.png   
f4.png; fi
if [ ! -e f5.png ]; then convert -crop $tilesize$xoff3$yoff3  lite.png   
f5.png; fi
if [ ! -e f6.png ]; then convert -crop $tilesize$xoff3$yoff3  dark.png   
f6.png; fi
if [ ! -e f7.png ]; then convert -crop $tilesize$xoff4$yoff3  lite.png   
f7.png; fi
if [ ! -e f8.png ]; then convert -crop $tilesize$xoff4$yoff3  dark.png   
f8.png; fi

echo -n "G "
if [ ! -e g1.png ]; then convert -crop $tilesize$xoff1$yoff4  dark.png   
g1.png; fi
if [ ! -e g2.png ]; then convert -crop $tilesize$xoff1$yoff4  lite.png   
g2.png; fi
if [ ! -e g3.png ]; then convert -crop $tilesize$xoff2$yoff4  dark.png   
g3.png; fi
if [ ! -e g4.png ]; then convert -crop $tilesize$xoff2$yoff4  lite.png   
g4.png; fi
if [ ! -e g5.png ]; then convert -crop $tilesize$xoff3$yoff4  dark.png   
g5.png; fi
if [ ! -e g6.png ]; then convert -crop $tilesize$xoff3$yoff4  lite.png   
g6.png; fi
if [ ! -e g7.png ]; then convert -crop $tilesize$xoff4$yoff4  dark.png   
g7.png; fi
if [ ! -e g8.png ]; then convert -crop $tilesize$xoff4$yoff4  lite.png   
g8.png; fi

echo -n "H "
if [ ! -e h1.png ]; then convert -crop $tilesize$xoff1$yoff4  lite.png   
h1.png; fi
if [ ! -e h2.png ]; then convert -crop $tilesize$xoff1$yoff4  dark.png   
h2.png; fi
if [ ! -e h3.png ]; then convert -crop $tilesize$xoff2$yoff4  lite.png   
h3.png; fi
if [ ! -e h4.png ]; then convert -crop $tilesize$xoff2$yoff4  dark.png   
h4.png; fi
if [ ! -e h5.png ]; then convert -crop $tilesize$xoff3$yoff4  lite.png   
h5.png; fi
if [ ! -e h6.png ]; then convert -crop $tilesize$xoff3$yoff4  dark.png   
h6.png; fi
if [ ! -e h7.png ]; then convert -crop $tilesize$xoff4$yoff4  lite.png   
h7.png; fi
if [ ! -e h8.png ]; then convert -crop $tilesize$xoff4$yoff4  dark.png   
h8.png; fi

echo " done."

#
# build the board: assemble all tiles to one 8x8 matrix 
# in the usual style of a chess board.
#
echo "Assembling the board..."
montage -geometry $tilesize$tilespec -tile 8x8 h1.png h2.png h3.png h4.png 
h5.png h6.png h7.png h8.png g1.png g2.png g3.png g4.png g5.png g6.png g7.png 
g8.png f1.png f2.png f3.png f4.png f5.png f6.png f7.png f8.png e1.png e2.png 
e3.png e4.png e5.png e6.png e7.png e8.png d1.png d2.png d3.png d4.png d5.png 
d6.png d7.png d8.png c1.png c2.png c3.png c4.png c5.png c6.png c7.png c8.png 
b1.png b2.png b3.png b4.png b5.png b6.png b7.png b8.png a1.png a2.png a3.png 
a4.png a5.png a6.png a7.png a8.png board.png

#
# Set the board on it's background:
#   1) create the boards frame
#   2) set everythig on the "table"
#
montage -size $framesize -texture frame.png -geometry $frame1 -tile 1x1 
board.png board1.png

montage -size $boardsize -texture back.png -geometry $bkgsize -tile 1x1 
board1.png shredderboard.png

#
# Remove the created files
#
rm a?.png b?.png c?.png d?.png e?.png f?.png g?.png h?.png
rm lite.png dark.png back.png frame.png board.png board1.png

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Scid-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scid-users

Reply via email to