r2523 - people/synrg/xjig
Ben Armstrong
synrg at alioth.debian.org
Wed Apr 4 14:23:25 UTC 2007
Author: synrg
Date: 2007-04-04 14:23:24 +0000 (Wed, 04 Apr 2007)
New Revision: 2523
Modified:
people/synrg/xjig/xjig-menu
people/synrg/xjig/xjig-menu.6
Log:
Support xjig switches, prescale image
Modified: people/synrg/xjig/xjig-menu
===================================================================
--- people/synrg/xjig/xjig-menu 2007-04-04 11:26:58 UTC (rev 2522)
+++ people/synrg/xjig/xjig-menu 2007-04-04 14:23:24 UTC (rev 2523)
@@ -5,7 +5,7 @@
PROGRAM="`basename ${0}`"
DESCRIPTION="front-end to launch xjig"
-VERSION="1.1"
+VERSION="1.2"
COPYRIGHT="${PROGRAM}, version ${VERSION}
Copyright (C) 2007 Ben Armstrong <synrg at sanctuary.nslug.ns.ca>
@@ -27,15 +27,20 @@
On Debian systems, the complete text of the GNU General Public License
can be found in /usr/share/common-licenses/GPL file."
-USAGE="${PROGRAM} [-p|--pieces XxY] [-s|--scale XxY] [-d|--directory DIR] [FILENAME]
- ${PROGRAM} -m|--make [-p|--pieces XxY] [-s|--scale XxY] [-d|--directory DIR] [--desktop-directory DIR] [FILENAME]"
+USAGE="${PROGRAM} [COMMON-OPTIONS] [FILENAME]
+ ${PROGRAM} -m|--make [--desktop-directory DIR] [COMMON-OPTIONS] [FILENAME]"
HELP="\
---pieces XxY number of pieces to make on the X and Y axes
---scale XxY scaled image X and Y axis dimensions (default: 640x480)
---directory DIR directory to search for image files
---desktop-directory DIR directory where desktop link will be made (default: $HOME/Desktop)
+COMMON-OPTIONS
+-p|--pieces XxY number of pieces to make on the X and Y axes
+-s|--scale XxY scaled image X and Y axis size (default: 640x480)
+-d|--directory DIR directory to search for image files
+--switches switches to pass to xjig (default: -no_flip -side 2)
+
+MAKE-OPTIONS
--make make a link to the specified puzzle in the desktop directory and exit
+--desktop-directory DIR directory where desktop link will be made (default: \$HOME/Desktop)
+
FILENAME png, jpeg or ppm image
Examples:
@@ -108,6 +113,8 @@
if [ -z "$scale" ] ; then scale="640x480"; fi
if [ -z "$desktop_directory" ] ; then desktop_directory="${XJIG_DESKTOP_DIRECTORY}"; fi
if [ -z "$desktop_directory" ] ; then desktop_directory="${HOME}/Desktop"; fi
+ if [ -z "$switches" ] ; then switches="${XJIG_SWITCHES}"; fi
+ if [ -z "$switches" ] ; then switches="-no_flip -side 2"; fi
}
Cleanup ()
@@ -146,8 +153,7 @@
Arguments ()
{
- ARGUMENTS="`getopt --longoptions pieces:,directory:,scale:,make,desktop_directory:,help,usage,version --name=${PROGRAM} --options p:d:mhuv --shell sh -- "${@}"`"
-
+ ARGUMENTS="`getopt --longoptions pieces:,directory:,scale:,make,desktop_directory:,switches:,help,usage,version --name=${PROGRAM} --options p:d:mhuv --shell sh -- "${@}"`"
if [ "${?}" != "0" ]
then
Error "${PROGRAM}: getopt error" >&2
@@ -179,6 +185,10 @@
desktop_directory="${2}" ; shift 2
;;
+ --switches)
+ switches="${2}" ; shift 2
+ ;;
+
-h|--help)
Help; shift
;;
@@ -238,7 +248,10 @@
tmpout=`tempfile --prefix=xjig --suffix=.jpg`
if [ -x /usr/bin/convert ] ; then
tmperr=`tempfile --prefix=xjigconv --suffix=.log`
- convert "${1}" "$tmpout" 2>"$tmperr"
+ # Notes: Aspect ratio is preserved by 'convert -resize'. Without
+ # shrinking large images beforehand, xjig can run out of memory.
+ # See http://bugs.debian.org/225314
+ convert -resize $scale "${1}" "$tmpout" 2>"$tmperr"
CheckError ${?}
outfile="$tmpout"
trap "Cleanup" EXIT HUP INT QUIT BUS PIPE TERM
@@ -250,8 +263,8 @@
Xjig ()
{
tmperr=`tempfile --prefix=xjigxjig --suffix=.log`
- # FIXME: make everything configurable/overridable (e.g. -no_flip, -side 2)
- xjig -no_flip -side 2 -wh $scale_height -wh $scale_width -w $width -h $height -file "${1}" 2>"$tmperr"
+ # FIXME: make everything configurable/overridable (e.g. -no_flip, -side 2)
+ xjig -w $width -h $height -file "${1}" $XJIG_SWITCHES 2>"$tmperr"
err=$?
if [ $err -eq 1 ] ; then
grep -q 'X connection to .* broken (explicit kill or server shutdown).' $tmperr
Modified: people/synrg/xjig/xjig-menu.6
===================================================================
--- people/synrg/xjig/xjig-menu.6 2007-04-04 11:26:58 UTC (rev 2522)
+++ people/synrg/xjig/xjig-menu.6 2007-04-04 14:23:24 UTC (rev 2523)
@@ -1,32 +1,34 @@
-.TH XJIG-MENU "6" "April 2007" "xjig-menu, version 1.1" "Games"
+.TH XJIG-MENU "6" "April 2007" "xjig-menu, version 1.2" "Games"
.SH NAME
-xjig-menu, \- manual page for xjig-menu, version 1.1
+xjig-menu, \- manual page for xjig-menu, version 1.2
.SH DESCRIPTION
xjig\-menu \- front\-end to launch xjig
.PP
-Usage:
-.IP
-xjig\-menu [\-p|\-\-pieces XxY] [\-s|\-\-scale XxY] [\-d|\-\-directory DIR] [FILENAME]
-.IP
-xjig\-menu \fB\-m\fR|\-\-make [\-p|\-\-pieces XxY] [\-s|\-\-scale XxY] [\-d|\-\-directory DIR] [\-\-desktop\-directory DIR] [FILENAME]
-.IP
+.SH USAGE
+.PP
+xjig\-menu [COMMON\-OPTIONS] [FILENAME]
+.PP
+xjig\-menu \fB\-m\fR|\-\-make [\-\-desktop\-directory DIR] [COMMON\-OPTIONS] [FILENAME]
+.PP
xjig\-menu [\-h|\-\-help]
-.IP
+.PP
xjig\-menu [\-u|\-\-usage]
-.IP
+.PP
xjig\-menu [\-v|\-\-version]
+.SH COMMON\-OPTIONS
.PP
-\fB\-\-pieces\fR XxY number of pieces to make on the X and Y axes
+\fB\-p\fR|\-\-pieces XxY number of pieces to make on the X and Y axes
.PP
-\fB\-\-scale\fR XxY scaled image X and Y axis dimensions (default: 640x480)
+\fB\-s\fR|\-\-scale XxY scaled image X and Y axis size (default: 640x480)
.PP
-\fB\-\-directory\fR DIR directory to search for image files
+\fB\-d\fR|\-\-directory DIR directory to search for image files
.PP
-\fB\-\-desktop\-directory\fR DIR directory where desktop link will be made (default: $HOME/Desktop)
+\fB\-\-switches\fR switches to pass to xjig (default: \fB\-no_flip\fR \fB\-side\fR 2)
+.SH MAKE\-OPTIONS
.PP
\fB\-\-make\fR make a link to the specified puzzle in the desktop directory and exit
.PP
-FILENAME png, jpeg or ppm image
+\fB\-\-desktop\-directory\fR DIR directory where desktop link will be made (default: $HOME/Desktop)
.SH EXAMPLES
.PP
To make a 5x4 (20 piece) puzzle from scene.jpg
More information about the Pkg-games-commits
mailing list