--- xjig-2.4.orig/README +++ xjig-2.4/README @@ -13,9 +13,9 @@ Description: XJig is a puzzle, that tries to replicate a jigsaw puzzle on the - screen as close as possible. Gif-images can be loaded and sliced - into pieces and as in every jigsaw puzzle, the goal is to - set the parts together again. + screen as close as possible. GIFs, JPEGs, and PPMs can be loaded + and sliced into pieces and as in every jigsaw puzzle, the goal + is to set the parts together again. Special effects: - Tiles are freely rotatable with intuitive pointer movement. --- xjig-2.4.orig/Imakefile +++ xjig-2.4/Imakefile @@ -27,21 +27,23 @@ XCOMM which default file should be loaded if no option is set - JIG_DEFAULT = \"tina.gif\" + JIG_DEFAULT = \"/usr/share/games/xjig/tina.gif\" XCOMM ####################################################################### SRCS = xjig.C objects.C stack.C imgbuff.C puzzle.C \ real.C vec2.C vec2list.C mat2.C \ - color_mapper.C gif_image.C gifx_image.C + color_mapper.C base_image.C gif_image.C ximage.C \ + ppm_image.C jpeg_image.C CXXFLAGS = $(USE_MIT_SHM) $(RANG_CHECK) - LOCAL_LIBRARIES = $(XLIB) -lm + LOCAL_LIBRARIES = $(XLIB) -ljpeg -lnetpbm -lm OBJS = xjig.o objects.o stack.o imgbuff.o puzzle.o \ real.o vec2.o vec2list.o mat2.o \ - color_mapper.o gif_image.o gifx_image.o + color_mapper.o base_image.o gif_image.o ximage.o \ + ppm_image.o jpeg_image.o @@ -49,6 +51,7 @@ $(RM) $@ $(CXX) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS) +AllTarget(xjig) InstallProgram(xjig,$(BINDIR)) InstallManPage(xjig,$(MANDIR)) DependTarget() --- xjig-2.4.orig/xjig-random.man +++ xjig-2.4/xjig-random.man @@ -0,0 +1,25 @@ +.TH xjig-random 6 "23 June 1999" "" +.SH NAME +xjig-random \- a random jigsaw puzzle +.SH SYNOPSIS +.B xjig-random + +.SH DESCRIPTION +.I xjig-random +selects a random image from the /usr/share/games/xjig directory and loads +it into xjig. +.PP +Command-line options may be specified and will be passed through to +xjig. + +.SH "SEE ALSO" +X(1), xjig(6) + +.SH COPYRIGHT +Copyright 1999 Dave Holland +.PP +Permission to use, copy, modify, and distribute this software for any +purpose and without fee is hereby granted, provided that the above +copyright notice appear in all copies. + +.fi --- xjig-2.4.orig/base_image.H +++ xjig-2.4/base_image.H @@ -0,0 +1,60 @@ +#ifndef __base_image_h +#define __base_image_h + +typedef unsigned char byte; +typedef int boolean; + +#define OPTION_EXTENSION (0x10) +#define REMOVETILE_EXTENSION (0x11) +#define FLATTILE_EXTENSION (0x12) +#define SUBSIZE_EXTENSION (0x13) +#define SCALEINFO_START (0x20) +#define COMMENT_EXTENSION (0xFE) + +class Image { + public: + Image( const char *filename, int autocrop=1 ); + Image(); + virtual ~Image(); + + virtual const char *GetExtensionData( unsigned char code ) { return 0; } + + const char *Name() { return name; } + int Width() { return width; } + int Height() { return height; } + const byte* Data() { return data; } + + int CropImage(int x1,int y1, int x2, int y2); + int CropImage(); + + void Rotate90(); + + protected: + virtual int LoadImageFile(const char *fname); + virtual int LoadImageFile(FILE *fp) { + /* This can only be reached if a child class fails to provide either + * one of the LoadImageFile() methods. I can't figure a way of + * making that a compile-time error. Think of these 2 methods as + * "jointly pure virtual". */ + fprintf(stderr, + "internal error: LoadImageFile() methods missing\n"); + exit(1); + } + void CloseImage(); + void DefaultBackground(); + + protected: + char *name; + int width, height; // image dimensions + byte *data; // image data + byte Red[256], Green[256], Blue[256]; // Colormap-Data + boolean HasColormap; + int ColorMapSize; /* number of colors */ + int Background; /* background color */ + + public: + int GetNCols() { return ColorMapSize; } + int GetColor(int id, unsigned short *red, unsigned short *green, unsigned short *blue); +}; + +#endif --- xjig-2.4.orig/jpeg_image.C +++ xjig-2.4/jpeg_image.C @@ -0,0 +1,98 @@ +#include +#include +#include +#include + +#include "jpeg_image.H" + +#undef XJIG_JPEG_DEBUG + +jpegImage::jpegImage(const char *filename, int autocrop ) + : Image(filename, autocrop) +{ + LoadImageFile( filename ); + if (autocrop) CropImage(); +} + +/*****************************/ +int jpegImage::LoadImageFile(FILE *fp) +/*****************************/ +{ + struct jpeg_decompress_struct cinfo; + struct jpeg_error_mgr jerr; + int i, j, copied_lines; + + cinfo.err = jpeg_std_error(&jerr); + jpeg_create_decompress(&cinfo); + jpeg_stdio_src(&cinfo, fp); + jpeg_read_header(&cinfo, TRUE); + + /* Ask for palettized RGB output */ + cinfo.out_color_space = JCS_RGB; + cinfo.quantize_colors = TRUE; + + jpeg_start_decompress(&cinfo); + + width=cinfo.output_width; + height=cinfo.output_height; + +#ifdef XJIG_JPEG_DEBUG + fprintf(stderr, "jpeg width=%d height=%d\n", width, height); + if(cinfo.output_components!=1) { + fprintf(stderr, "Not getting palettized output from libjpeg!\n"); + exit(1); + } +#endif + + data=(byte *)malloc(width*height*sizeof *data); + if(!data) { + fprintf(stderr, "Not enough memory to store jpeg data"); + exit(1); + } + + JSAMPARRAY lines=(JSAMPARRAY)malloc(cinfo.rec_outbuf_height*sizeof *lines); + if(!lines) { + fprintf(stderr, "Not enough memory to for temporary jpeg buffer"); + exit(1); + } + for(i=0 ; i +# $Xorg: Imake.tmpl,v 1.4 2000/08/17 19:41:46 cpqbld Exp $ +# $XdotOrg: xc/config/cf/Imake.tmpl,v 1.9 2005/01/24 06:37:31 daniels Exp $ +# +# +# +# +# $XFree86: xc/config/cf/Imake.tmpl,v 3.155 2003/12/24 18:58:41 dickey Exp $ +# ---------------------------------------------------------------------- + +all:: + +.SUFFIXES: .i + +# $XdotOrg: xc/config/cf/Imake.cf,v 1.7 2005/03/02 11:20:29 gisburn Exp $ +# $Xorg: Imake.cf,v 1.4 2000/08/17 19:41:45 cpqbld Exp $ + +# $XFree86: xc/config/cf/Imake.cf,v 3.88 2003/12/16 21:30:21 herrb Exp $ + +# Keep cpp from replacing path elements containing i486/i586/i686 + +# ----------------------------------------------------------------------- +# site-specific configuration parameters that need to come before +# the platform-specific parameters - edit site.def to change + +# site: $TOG: site.sample /main/r64_final/1 1998/02/05 16:28:49 kaleb $ + +# site: $XFree86: xc/config/cf/site.def,v 3.24 2000/06/25 20:17:29 dawes Exp $ + +# $XFree86: xc/config/cf/xf86site.def,v 3.186 2003/06/25 18:06:22 eich Exp $ + +# ---------------------------------------------------------------------- +# platform-specific configuration parameters - edit linux.cf to change + +# $XdotOrg: xc/config/cf/linux.cf,v 1.24 2005/03/06 01:05:00 branden Exp $ +# platform: $Xorg: linux.cf,v 1.3 2000/08/17 19:41:47 cpqbld Exp $ + +# platform: $XFree86: xc/config/cf/linux.cf,v 3.220 2003/12/30 22:38:33 tsi Exp $ + +# operating system: Linux 2.6.32-5-686 i686 [ELF] (2.6.32) +# libc: (6.11.3) +# binutils: (220) + +# $Xorg: lnxLib.rules,v 1.3 2000/08/17 19:41:47 cpqbld Exp $ +# $XFree86: xc/config/cf/lnxLib.rules,v 3.52 2003/10/31 20:49:03 herrb Exp $ + +# $XdotOrg: xc/config/cf/xorg.cf,v 1.44 2005/01/27 03:50:46 ajax Exp $ + +# $Xorg: xfree86.cf,v 1.4 2000/08/17 19:41:49 cpqbld Exp $ + +XORG_VERSION_CURRENT = (((6) * 10000000) + ((9) * 100000) + ((0) * 1000) + 0) +RELEASE_VERSION = RELEASE-1 + +AFB_DEFS = -DUSE_AFB + +DRIVERSDKDIR = $(USRLIBDIR)/Server +DRIVERSDKMODULEDIR = $(USRLIBDIR)/Server/modules +DRIVERSDKINCLUDEDIR = $(USRLIBDIR)/Server/include + + XF86SRC = $(SERVERSRC)/hw/xfree86 + XF86COMSRC = $(XF86SRC)/common + XF86PARSERSRC = $(XF86SRC)/parser + XF86OSSRC = $(XF86SRC)/os-support + XF86DRIVERSRC = $(XF86SRC)/drivers + DRIVERSRC = $(XF86DRIVERSRC) + + XFREE86DOCDIR = $(DOCDIR) + XFREE86PSDOCDIR = $(DOCPSDIR) + XFREE86PDFDOCDIR = $(DOCPDFDIR) + XFREE86HTMLDOCDIR = $(DOCHTMLDIR) +XFREE86JAPANESEDOCDIR = $(DOCDIR)/Japanese + +# $Xorg: xf86.rules,v 1.3 2000/08/17 19:41:48 cpqbld Exp $ + +# $XFree86: xc/config/cf/xf86.rules,v 3.34tsi Exp $ + + SELINUX_LDFLAGS = + + SELINUX_INCLUDES = -I/usr/include/selinux + + SELINUX_CFLAGS = -DHAVE_SELINUX + + SELINUX_LIBS = -lselinux + +# ---------------------------------------------------------------------- +# site-specific configuration parameters that go after +# the platform-specific parameters - edit site.def to change + +# site: $TOG: site.sample /main/r64_final/1 1998/02/05 16:28:49 kaleb $ + +# site: $XFree86: xc/config/cf/site.def,v 3.24 2000/06/25 20:17:29 dawes Exp $ + +# --------------------------------------------------------------------- +# Imake rules for building libraries, programs, scripts, and data files +# rules: $Xorg: Imake.rules,v 1.3 2000/08/17 19:41:46 cpqbld Exp $ +# rules: $XdotOrg: xc/config/cf/Imake.rules,v 1.8 2005/02/01 22:27:00 ajax Exp $ +# +# +# +# +# rules: $XFree86: xc/config/cf/Imake.rules,v 3.128 2003/11/15 03:25:17 dawes Exp $ + +.PHONY: all interfaces install install.man install.lib install.sdk depend includes cleandir + + _NULLCMD_ = @ echo -n + +X_BYTE_ORDER = X_LITTLE_ENDIAN + +GLIDE2INCDIR = /usr/include/glide + +GLIDE3INCDIR = /usr/include/glide3 + +GLIDE3LIBNAME = glide3 + +TKLIBNAME = tk8.4 + +TKLIBDIR = /usr/lib + +TCLLIBNAME = tcl8.4 + +TCLIBDIR = /usr/lib + + PATHSEP = / + SHELL = /bin/sh -e + + TOP = . + CURRENT_DIR = . + + IMAKE = imake + DEPEND = gccmakedep + MKDIRHIER = mkdir -p + REVPATH = revpath + EXPORTLISTGEN = + RMAN = /usr/bin/rman + RMANBASENAME = rman + RMANOPTIONS = + CONFIGSRC = $(TOP)/config + IMAKESRC = $(CONFIGSRC)/imake + DEPENDSRC = $(CONFIGSRC)/util + + INCROOT = /usr/include + USRLIBDIR = /usr/lib + VARDIR = /var + VARLIBDIR = $(VARDIR)/lib + SYSTEMUSRLIBDIR = /usr/lib + SYSTEMUSRINCDIR = /usr/include + SHLIBDIR = /usr/lib + LINTLIBDIR = $(USRLIBDIR)/lint + MANPATH = /usr/share/man + MANSOURCEPATH = $(MANPATH)/man + MANDIR = $(MANSOURCEPATH)$(MANSECT) + SYSCALLMANDIR = $(MANSOURCEPATH)$(SYSCALLMANSECT) + LIBMANDIR = $(MANSOURCEPATH)$(LIBMANSECT) + DRIVERMANDIR = $(MANSOURCEPATH)4 + FILEMANDIR = $(MANSOURCEPATH)$(FILEMANSECT) + GAMEMANDIR = $(MANSOURCEPATH)$(GAMEMANSECT) + MISCMANDIR = $(MANSOURCEPATH)7 + ADMMANDIR = $(MANSOURCEPATH)$(ADMMANSECT) + ICONDIR = "/usr/share/icons" + XCURSORPATH = "~/.icons:/usr/share/icons:/usr/share/pixmaps" + DRIVERMANDIR = $(MANSOURCEPATH)4 + LOGDIRECTORY = $(VARDIR)/log + + VARRUNDIR = $(VARDIR)/run + + VARDBDIR = $(VARDIR)/lib + + AR = ar clq + +# Nice try but useless: make will inherit BOOTSTRAPCFLAGS +# from top Makefile + BOOTSTRAPCFLAGS = + + CC = gcc -m32 + AS = gcc -m32 -c -x assembler + +.SUFFIXES: .cc + + CXX = c++ -m32 + + CXXFILT = c++filt + + CXXLIB = -lstdc++ + + CXXDEBUGFLAGS = -g -O2 -fno-strict-aliasing +CXXDEPENDINCLUDES = + CXXEXTRA_DEFINES = +CXXEXTRA_INCLUDES = + CXXSTD_DEFINES = -Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $(CXXPROJECT_DEFINES) + CXXOPTIONS = + CXXINCLUDES = $(INCLUDES) $(TOP_INCLUDES) $(CXXEXTRA_INCLUDES) + CXXDEFINES = $(CXXINCLUDES) $(CXXSTD_DEFINES) $(THREADS_CXXDEFINES) $(DEFINES) $(CXXEXTRA_DEFINES) + CXXFLAGS = $(CXXDEBUGFLAGS) $(CXXOPTIONS) $(THREADS_CXXFLAGS) $(CXXDEFINES) + + COMPRESS = compress + GZIPCMD = gzip + + CPP = cpp $(STD_CPP_DEFINES) + RAWCPP = cpp -undef $(STD_CPP_OPTIONS) + PREPROCESSCMD = gcc -m32 -E $(STD_CPP_DEFINES) + + INSTALL = install + INSTALLFLAGS = -c + + LD = gcc -m32 -nostdlib + + LEX = flex -l + M4 = m4 + M4FLAGS = + LEXLIB = -lfl + YACC = bison -y + CCYACC = bison -y + + LINT = lint + + LINTLIBFLAG = -C + LINTOPTS = -axz + LN = ln -s + MAKE = make + MV = mv -f + CP = cp + + RANLIB = ranlib + + RANLIBINSTFLAGS = + + RM = rm -f + PERL = perl + PERLOPTS = + PERLENVSETUP = env LC_ALL=C + + MANSECT = 1 + SYSCALLMANSECT = 2 + LIBMANSECT = 3 + DRIVERMANSECT = 4 + FILEMANSECT = 5 + GAMEMANSECT = 6 + MISCMANSECT = 7 + ADMMANSECT = 8 + MANSRCSECT = s + MANNEWSECT = n + PROJECTMANSUFFIX = x + MANSUFFIX = $(MANSECT)$(PROJECTMANSUFFIX) + SYSCALLMANSUFFIX = $(SYSCALLMANSECT)$(PROJECTMANSUFFIX) + LIBMANSUFFIX = $(LIBMANSECT)$(PROJECTMANSUFFIX) + DRIVERMANSUFFIX = 4x + FILEMANSUFFIX = $(FILEMANSECT)$(PROJECTMANSUFFIX) + GAMEMANSUFFIX = $(GAMEMANSECT)$(PROJECTMANSUFFIX) + MISCMANSUFFIX = 7x + ADMMANSUFFIX = $(ADMMANSECT)$(PROJECTMANSUFFIX) + ADMINMANSUFFIX = 8 + MANSRCSUFFIX = man + MANNEWSUFFIX = _man + MANDEFS = -D__apploaddir__=$(XAPPLOADDIR) -D__filemansuffix__=$(FILEMANSECT)$(PROJECTMANSUFFIX) -D__osfilemansuffix__=$(FILEMANSECT) -D__libmansuffix__=$(LIBMANSECT)$(PROJECTMANSUFFIX) -D__oslibmansuffix__=$(LIBMANSECT) -D__mansuffix__=$(MANSECT)$(PROJECTMANSUFFIX) -D__osmansuffix__=$(MANSECT) -D__syscallmansuffix__=$(SYSCALLMANSECT)$(PROJECTMANSUFFIX) -D__ossysmansuffix__=$(SYSCALLMANSECT) -D__gamemansuffix__=$(GAMEMANSECT)$(PROJECTMANSUFFIX) -D__osgamemansuffix__=$(GAMEMANSECT) -D__miscmansuffix__=$(MISCMANSECT)$(PROJECTMANSUFFIX) -D__osmiscmansuffix__=$(MISCMANSECT) -D__admmansuffix__=$(ADMMANSECT)$(PROJECTMANSUFFIX) -D__osadmmansuffix__=$(ADMMANSECT) -D__miscmansuffix__=$(MISCMANSECT)$(PROJECTMANSUFFIX) -D__osmiscmansuffix__=$(MISCMANSECT) -D__drivermansuffix__=$(DRIVERMANSECT)$(PROJECTMANSUFFIX) -D__osdrivermansuffix__=$(DRIVERMANSECT) -D__adminmansuffix__=$(ADMINMANSUFFIX) -D__projectroot__=$(PROJECTROOT) -D__xconfigfile__=$(XCONFIGFILE) -D__xconfigdir__=$(XCONFIGDIR) -D__xlogfile__=$(XLOGFILE) -D__xservername__=$(XSERVERNAME) -D__appmansuffix__=$(MANSECT)$(PROJECTMANSUFFIX) $(XORGMANDEFS) $(VENDORMANDEFS) + + COMPRESSMANCMD = gzip -n + + TROFF = groff -Tps + NROFF = nroff + + MSMACROS = -ms + MANMACROS = -man + TBL = tbl + EQN = eqn + NEQN = neqn + COL = col + COLFLAGS = -b + + MODCC = gcc -m32 + + MODCPP = cpp + MODCFLAGS = $(CFLAGS) + MODAS = gcc -m32 -c -x assembler + MODASFLAGS = + + MODLD = gcc -m32 -nostdlib + + MODLDFLAGS = +MODLDCOMBINEFLAGS = -r + MODAR = ar clq + + MODRANLIB = ranlib + + DVIPS = dvips + LATEX = latex + + STD_INCLUDES = + STD_CPP_OPTIONS = -traditional + STD_CPP_DEFINES = -traditional -Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $(PROJECT_DEFINES) + STD_DEFINES = -Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $(PROJECT_DEFINES) + EXTRA_LOAD_FLAGS = + EXTRA_LDOPTIONS = + EXTRA_LIBRARIES = + TAGS = ctags + + PARALLELMFLAGS = + + SHAREDCODEDEF = + SHLIBDEF = + + SHLIBLDFLAGS = -shared $(SHLIBGLOBALSFLAGS) + + NOSTDLIB = -nostdlib + POSTNOSTDLIB = -Wl,-Bstatic -lgcc -Wl,-Bdynamic + + PICFLAGS = -fPIC + + CXXPICFLAGS = -fPIC + + PROTO_DEFINES = -DFUNCPROTO=15 -DNARROWPROTO + + INSTPGMFLAGS = + + INSTBINFLAGS = -m 0755 + INSTUIDFLAGS = -m 4711 + INSTLIBFLAGS = -m 0644 + INSTINCFLAGS = -m 0444 + INSTMANFLAGS = -m 0444 + INSTDATFLAGS = -m 0444 + INSTKMEMFLAGS = -m 4711 + + PROJECTROOT = /usr + + CDEBUGFLAGS = -g -O2 -fno-strict-aliasing + CCOPTIONS = + + ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(INSTALLED_INCLUDES) $(STD_INCLUDES) + ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(PROTO_DEFINES) $(THREADS_DEFINES) $(MODULE_DEFINES) $(DEFINES) $(EXTRA_DEFINES) + CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(THREADS_CFLAGS) $(MODULE_CFLAGS) $(ALLDEFINES) + LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES) $(DEPEND_DEFINES) + LDPRELIB = $(INSTALLED_LIBS) + LDPOSTLIB = + LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) $(EXTRA_LDOPTIONS) $(THREADS_LDFLAGS) $(LOCAL_LDFLAGS) $(LDPRELIBS) + CXXLDOPTIONS = $(CXXDEBUGFLAGS) $(CXXOPTIONS) $(EXTRA_LDOPTIONS) $(THREADS_CXXLDFLAGS) $(LOCAL_LDFLAGS) $(LDPRELIBS) + + LDLIBS = $(LDPOSTLIBS) $(THREADS_LIBS) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) + + CCLINK = $(CC) + + CXXLINK = $(CXX) + + LDSTRIPFLAGS = -x + LDCOMBINEFLAGS = -r + DEPENDFLAGS = + DEPEND_DEFINES = + +# Not sure this belongs here + TKLIBDIR = /usr/lib + TKINCDIR = /usr/include + TKLIBNAME = tk8.4 + TKLIBRARY = -L$(TKLIBDIR) -l$(TKLIBNAME) + TCLLIBDIR = /usr/lib + TCLINCDIR = /usr/include + TCLLIBNAME = tcl8.4 + TCLLIBRARY = -L$(TCLLIBDIR) -l$(TCLLIBNAME) + + MACROFILE = linux.cf + RM_CMD = $(RM) + + IMAKE_DEFINES = + IMAKE_WARNINGS = -Wundef + + IRULESRC = $(CONFIGDIR) + IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES) $(IMAKE_WARNINGS) + + ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/X11.tmpl $(IRULESRC)/site.def $(IRULESRC)/$(MACROFILE) $(IRULESRC)/xfree86.cf $(IRULESRC)/xf86.rules $(IRULESRC)/xorgsite.def $(IRULESRC)/host.def $(EXTRA_ICONFIGFILES) + +# $Xorg: X11.rules,v 1.4 2000/08/17 19:41:46 cpqbld Exp $ + +# $XFree86: xc/config/cf/X11.rules,v 1.6 2001/01/17 16:22:31 dawes Exp $ + +# ---------------------------------------------------------------------- +# X Window System Build Parameters and Rules +# $XdotOrg: xc/config/cf/X11.tmpl,v 1.52 2005/09/22 23:54:18 alanc Exp $ +# $Xorg: X11.tmpl,v 1.6 2000/08/17 19:41:46 cpqbld Exp $ +# +# +# +# +# $XFree86: xc/config/cf/X11.tmpl,v 1.248 2004/02/16 04:07:37 dawes Exp $ + +XORGRELSTRING = `echo 6 9 0 | sed -e 's/ /./g' -e 's/^/Version\\\ /'` + XORGMANNAME = X Version 11 + +STICKY_DEFINES = -DHAS_STICKY_DIR_BIT + +FCHOWN_DEFINES = -DHAS_FCHOWN + +# ----------------------------------------------------------------------- +# X Window System make variables; these need to be coordinated with rules + + XTOP = $(TOP) + BINDIR = /usr/bin + BUILDINCROOT = $(TOP)/exports + BUILDINCDIR = $(BUILDINCROOT)/include + BUILDINCTOP = ../.. + BUILDLIBDIR = $(TOP)/exports/lib + BUILDLIBTOP = ../.. + BUILDBINDIR = $(TOP)/exports/bin + BUILDBINTOP = ../.. + BUILDMODULEDIR = $(BUILDLIBDIR)/modules + BUILDI18NDIR = $(BUILDLIBDIR)/locale + BUILDMODULETOP = $(BUILDLIBTOP)/.. + XBUILDINCROOT = $(XTOP)/exports + XBUILDINCDIR = $(XBUILDINCROOT)/include/X11 + XBUILDINCTOP = ../../.. + XBUILDBINDIR = $(XBUILDINCROOT)/bin + INCDIR = $(INCROOT) + ADMDIR = /usr/adm + LIBDIR = /usr/lib/X11 + SHAREDIR = /usr/share/X11 + LIBEXECDIR = /usr/libexec + MODULEDIR = $(USRLIBDIR)/modules + TOP_X_INCLUDES = + XBINDIR = $(PROJECTROOT)/bin + + INSTSRCDIR = /usr/src + + ETCX11DIR = /etc/X11 + + CONFDIR = $(ETCX11DIR) + + DOCDIR = $(LIBDIR)/doc + DOCHTMLDIR = $(DOCDIR)/html + DOCPSDIR = $(DOCDIR)/PostScript + DOCPDFDIR = $(DOCDIR)/PDF + FONTDIR = /usr/share/fonts/X11 + ENCODINGSDIR = /usr/share/fonts/X11/encodings + XINITDIR = $(LIBDIR)/xinit + XDMDIR = $(LIBDIR)/xdm + XDMVARDIR = $(VARLIBDIR)/xdm + TWMDIR = $(LIBDIR)/twm + XSMDIR = $(LIBDIR)/xsm + NLSDIR = $(LIBDIR)/nls + XLOCALEDIR = $(LIBDIR)/locale + LBXPROXYDIR = $(LIBDIR)/lbxproxy + PROXYMANAGERDIR = $(LIBDIR)/proxymngr + XPRINTDIR = $(LIBDIR)/xserver + XAPPLOADDIR = /etc/X11/app-defaults + FONTCFLAGS = -t + + INSTAPPFLAGS = $(INSTDATFLAGS) + + RGB = $(XBINDIR)/rgb + FONTC = $(XBINDIR)/bdftopcf + MKFONTSCALE = $(XBINDIR)/mkfontscale + MKFONTDIR = $(XBINDIR)/mkfontdir + MKHTMLINDEX = $(XBINDIR)/mkhtmlindex + UCS2ANY = $(XBINDIR)/ucs2any + BDFTRUNCATE = $(XBINDIR)/bdftruncate + UCSMAPPREFIX = $(FONTDIR)/util/map- + XCURSORGEN = $(XBINDIR)/xcursorgen + + HTMLINDEXCMD = HtmlIndexCmd + + DOCUTILSRC = $(XTOP)/doc/util + CLIENTSRC = $(TOP)/clients + DEMOSRC = $(TOP)/demos + XDOCMACROS = $(DOCUTILSRC)/macros.t + XIDXMACROS = $(DOCUTILSRC)/indexmacros.t + PROGRAMSRC = $(TOP)/programs + LIBSRC = $(XTOP)/lib + FONTSRC = $(XTOP)/fonts + ENCODINGSSRC = $(FONTSRC)/encodings + INCLUDESRC = $(BUILDINCROOT)/include + XINCLUDESRC = $(INCLUDESRC)/X11 + SERVERSRC = $(XTOP)/programs/Xserver + CONTRIBSRC = $(XTOP)/../contrib + UNSUPPORTEDSRC = $(XTOP)/unsupported + DOCSRC = $(XTOP)/doc + RGBSRC = $(XTOP)/programs/rgb + BDFTOPCFSRC = $(PROGRAMSRC)/bdftopcf + MKFONTDIRSRC = $(PROGRAMSRC)/mkfontdir + FONTSERVERSRC = $(PROGRAMSRC)/xfs + FONTINCSRC = $(XTOP)/include/fonts + EXTINCSRC = $(XTOP)/include/extensions + FTSOURCEDIR = FreeTypeSrcDir + DRMSRCDIR = $(TOP)/extras/drm + MESASRCDIR = $(TOP)/extras/Mesa + OGLSAMPLESRCDIR = $(TOP)/extras/ogl-sample + PSWRAPSRC = $(XTOP)/config/pswrap + TRANSCOMMSRC = $(LIBSRC)/xtrans + TRANS_INCLUDES = -I$(TRANSCOMMSRC) + CONNECTION_FLAGS = -DUNIXCONN -DTCPCONN $(STICKY_DEFINES) $(FCHOWN_DEFINES) -DIPv6 +XTRANS_FAILDEFINES = -DFAIL_HARD + + VENDORMANNAME = X.Org + VENDORMANVERSION = `echo 6 9 0 | sed -e 's/ /./g' -e 's/^/Version\\\ /'` + XORGMANDEFS = -D__xorgversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" + VENDORMANDEFS = -D__vendorversion__="$(VENDORMANVERSION) $(VENDORMANNAME)" + VENDORNAME = The X.Org Foundation + VENDORNAMESHORT = X.Org + + VENDORWEBSUPPORT = http://wiki.X.Org + +VENDORSUPPORTDEFS = -D__VENDORDWEBSUPPORT__='"$(VENDORWEBSUPPORT)"' + + XKBDEFRULES = xorg + XKBDEFRULESDEFS = -D__XKBDEFRULES__='"$(XKBDEFRULES)"' + + XCONFIGFILE = xorg.conf + XCONFIGDIR = $(LIBDIR) + XLOGFILE = Xorg + XSERVERNAME = Xorg + + XENVLIBDIR = $(USRLIBDIR) + CLIENTENVSETUP = LD_LIBRARY_PATH=$(XENVLIBDIR) XLOCALEDIR=$(BUILDLIBDIR)/locale + +# $Xorg: lnxLib.tmpl,v 1.3 2000/08/17 19:41:47 cpqbld Exp $ +# $XFree86: xc/config/cf/lnxLib.tmpl,v 3.19 2003/10/15 22:47:48 herrb Exp $ + + XLIBSRC = $(LIBSRC)/X11 + +SOXLIBREV = 6.2 +DEPXONLYLIB = +XONLYLIB = -lX11 + +LINTXONLY = $(LINTLIBDIR)/llib-lX11.ln + + DEPXLIBONLY = $(DEPXONLYLIB) + XLIBONLY = $(XONLYLIB) + LINTXONLYLIB = $(LINTXONLY) + + XEXTLIBSRC = $(LIBSRC)/Xext + +SOXEXTREV = 6.4 +DEPEXTENSIONLIB = +EXTENSIONLIB = -lXext + +LINTEXTENSION = $(LINTLIBDIR)/llib-lXext.ln + +LINTEXTENSIONLIB = $(LINTEXTENSION) + DEPXLIB = $(DEPEXTENSIONLIB) $(DEPXONLYLIB) + XLIB = $(EXTENSIONLIB) $(XONLYLIB) + LINTXLIB = $(LINTXONLYLIB) + + XSSLIBSRC = $(LIBSRC)/Xss + +SOXSSREV = 1.0 +DEPXSSLIB = +XSSLIB = -lXss + +LINTXSS = $(LINTLIBDIR)/llib-lXss.ln + + XXF86MISCLIBSRC = $(LIBSRC)/Xxf86misc + +SOXXF86MISCREV = 1.1 +DEPXXF86MISCLIB = +XXF86MISCLIB = -lXxf86misc + +LINTXXF86MISC = $(LINTLIBDIR)/llib-lXxf86misc.ln + + XXF86VMLIBSRC = $(LIBSRC)/Xxf86vm + +SOXXF86VMREV = 1.0 +DEPXXF86VMLIB = +XXF86VMLIB = -lXxf86vm + +LINTXXF86VM = $(LINTLIBDIR)/llib-lXxf86vm.ln + + XXF86DGALIBSRC = $(LIBSRC)/Xxf86dga + +SOXXF86DGAREV = 1.0 +DEPXXF86DGALIB = +XXF86DGALIB = -lXxf86dga + +LINTXXF86DGA = $(LINTLIBDIR)/llib-lXxf86dga.ln + + XXF86RUSHLIBSRC = $(LIBSRC)/Xxf86rush + +SOXXF86RUSHREV = 1.0 +DEPXXF86RUSHLIB = +XXF86RUSHLIB = -lXxf86rush + +LINTXXF86RUSH = $(LINTLIBDIR)/llib-lXxf86rush.ln + + XVLIBSRC = $(LIBSRC)/Xv + +SOXVREV = 1.0 +DEPXVLIB = +XVLIB = -lXv + +LINTXV = $(LINTLIBDIR)/llib-lXv.ln + + XVMCLIBSRC = $(LIBSRC)/XvMC + +SOXVMCREV = 1.0 +DEPXVMCLIB = +XVMCLIB = -lXvMC + +LINTXVMC = $(LINTLIBDIR)/llib-lXvMC.ln + + XINERAMALIBSRC = $(LIBSRC)/Xinerama + +SOXINERAMAREV = 1.0 +DEPXINERAMALIB = +XINERAMALIB = -lXinerama + +LINTXINERAMA = $(LINTLIBDIR)/llib-lXinerama.ln + + XRESLIBSRC = $(LIBSRC)/XRes + +SOXRESREV = 1.0 +DEPXRESLIB = +XRESLIB = -lXRes + +LINTXRES = $(LINTLIBDIR)/llib-lXRes.ln + + DMXLIBSRC = $(LIBSRC)/dmx + +SODMXREV = 1.0 +DEPDMXLIB = +DMXLIB = -ldmx + +LINTDMX = $(LINTLIBDIR)/llib-ldmx.ln + + DPSLIBSRC = $(LIBSRC)/dps + +DEPDPSLIB = $(USRLIBDIR)/libdps.a +DPSLIB = -ldps + +LINTDPS = $(LINTLIBDIR)/llib-ldps.ln + + DPSTKLIBSRC = $(LIBSRC)/dpstk + +DEPDPSTKLIB = $(USRLIBDIR)/libdpstk.a +DPSTKLIB = -ldpstk + +LINTDPSTK = $(LINTLIBDIR)/llib-ldpstk.ln + + PSRESLIBSRC = $(LIBSRC)/psres + +DEPPSRESLIB = $(USRLIBDIR)/libpsres.a +PSRESLIB = -lpsres + +LINTPSRES = $(LINTLIBDIR)/llib-lpsres.ln + + GLULIBSRC = $(LIBSRC)/GLU + +SOGLUREV = 1.3 +DEPGLULIB = +GLULIB = -lGLU + +LINTGLU = $(LINTLIBDIR)/llib-lGLU.ln + + GLXLIBSRC = $(LIBSRC)/GL + +SOGLREV = 1.2 +DEPGLXLIB = +GLXLIB = -lGL + +LINTGLX = $(LINTLIBDIR)/llib-lGL.ln + + GLWIDGETSRC = $(LIBSRC)/GLw + +DEPGLWLIB = $(USRLIBDIR)/libGLw.a +GLWLIB = -lGLw + +LINTGLW = $(LINTLIBDIR)/llib-lGLw.ln + +XRENDERDIR = /usr +XRENDERLIBDIR = /usr/lib +XRENDERINCDIR = /usr/include +XRENDERLIB = -L$(XRENDERLIBDIR) -lXrender +DEPXRENDERLIB = + +XRENDERINCLUDES = -I$(XRENDERINCDIR) + + XRANDRLIBSRC = $(LIBSRC)/Xrandr + +SOXRANDRREV = 2.0 +DEPXRANDRLIB = +XRANDRLIB = -lXrandr + +LINTXRANDR = $(LINTLIBDIR)/llib-lXrandr.ln + + XFIXESLIBSRC = $(LIBSRC)/Xfixes + +SOXFIXESREV = 3.0 +DEPXFIXESLIB = +XFIXESLIB = -lXfixes + +LINTXFIXES = $(LINTLIBDIR)/llib-lXfixes.ln + + XDAMAGELIBSRC = $(LIBSRC)/Xdamage + +SOXDAMAGEREV = 1.0 +DEPXDAMAGELIB = +XDAMAGELIB = -lXdamage + +LINTXDAMAGE = $(LINTLIBDIR)/llib-lXdamage.ln + +XCOMPOSITELIBSRC = $(LIBSRC)/Xcomposite + +SOXCOMPOSITEREV = 1.0 +DEPXCOMPOSITELIB = +XCOMPOSITELIB = -lXcomposite + +LINTXCOMPOSITE = $(LINTLIBDIR)/llib-lXcomposite.ln + +XEVIELIBSRC = $(LIBSRC)/Xevie + +SOXEVIEREV = 1.0 +DEPXEVIELIB = +XEVIELIB = -lXevie + +LINTXEVIE = $(LINTLIBDIR)/llib-lXevie.ln + +XCURSORDIR = /usr +XCURSORLIBDIR = /usr/lib +XCURSORINCDIR = /usr/include +XCURSORLIB = -L$(XCURSORLIBDIR) -lXcursor + +XCURSORINCLUDES=-I$(XCURSORINCDIR) $(XRENDERINCLUDES) + + APPLEWMLIBSRC = $(LIBSRC)/apple + +DEPAPPLEWMLIB = $(USRLIBDIR)/libAppleWM.a +APPLEWMLIB = -lAppleWM + +LINTAPPLEWM = $(LINTLIBDIR)/llib-lAppleWM.ln + + WINDOWSWMLIBSRC = $(LIBSRC)/windows + +DEPWINDOWSWMLIB = $(USRLIBDIR)/libWindowsWM.a +WINDOWSWMLIB = -lWindowsWM + +LINTWINDOWSWM = $(LINTLIBDIR)/llib-lWindowsWM.ln + + XFONTCACHELIBSRC = $(LIBSRC)/Xfontcache + +DEPXFONTCACHELIB = $(USRLIBDIR)/libXfontcache.a +XFONTCACHELIB = -lXfontcache + +LINTXFONTCACHE = $(LINTLIBDIR)/llib-lXfontcache.ln + + XAUTHSRC = $(LIBSRC)/Xau + +SOXAUTHREV = 6.0 +DEPXAUTHLIB = +XAUTHLIB = -lXau + +LINTXAUTH = $(LINTLIBDIR)/llib-lXau.ln + + XDMCPLIBSRC = $(LIBSRC)/Xdmcp + +SOXDMCPREV = 6.0 +DEPXDMCPLIB = +XDMCPLIB = -lXdmcp + +LINTXDMCP = $(LINTLIBDIR)/llib-lXdmcp.ln + + XMUSRC = $(LIBSRC)/Xmu + +SOXMUREV = 6.2 +DEPXMULIB = +XMULIB = -lXmu + +LINTXMU = $(LINTLIBDIR)/llib-lXmu.ln + + XMUUSRC = $(LIBSRC)/Xmuu + +SOXMUUREV = 1.0 +DEPXMUULIB = +XMUULIB = -lXmuu + +LINTXMUU = $(LINTLIBDIR)/llib-lXmuu.ln + + OLDXLIBSRC = $(LIBSRC)/oldX + +DEPOLDXLIB = $(USRLIBDIR)/liboldX.a +OLDXLIB = -loldX + +LINTOLDX = $(LINTLIBDIR)/llib-loldX.ln + + XPLIBSRC = $(LIBSRC)/Xp + +SOXPREV = 6.2 +DEPXPLIB = +XPLIB = -lXp + +LINTXP = $(LINTLIBDIR)/llib-lXp.ln + + TOOLKITSRC = $(LIBSRC)/Xt + +SOXTREV = 6.0 +DEPXTOOLONLYLIB = +XTOOLONLYLIB = -lXt + +LINTXTOOLONLY = $(LINTLIBDIR)/llib-lXt.ln + + DEPXTOOLLIB = $(DEPXTOOLONLYLIB) $(DEPSMLIB) $(DEPICELIB) + XTOOLLIB = $(XTOOLONLYLIB) $(SMLIB) $(ICELIB) + LINTXTOOLLIB = $(LINTXTOOLONLYLIB) + + XALIBSRC = $(LIBSRC)/Xa + +SOXAREV = 1.0 +DEPXALIB = +XALIB = -lXa + +LINTXA = $(LINTLIBDIR)/llib-lXa.ln + + AWIDGETSRC = $(LIBSRC)/Xaw + +SOXAWREV = 8.0 +DEPXAWLIB = +XAWLIB = -lXaw + +LINTXAW = $(LINTLIBDIR)/llib-lXaw.ln + + AWIDGET7SRC = $(LIBSRC)/Xaw7 + +SOXAW7REV = 7.0 +DEPXAW7LIB = +XAW7LIB = -lXaw + +LINTXAW7 = $(LINTLIBDIR)/llib-lXaw.ln + + AWIDGET6SRC = $(LIBSRC)/Xaw6 + +SOXAW6REV = 6.1 +DEPXAW6LIB = +XAW6LIB = -lXaw + +LINTXAW6 = $(LINTLIBDIR)/llib-lXaw.ln + + XILIBSRC = $(LIBSRC)/Xi + +SOXINPUTREV = 6.0 +DEPXILIB = +XILIB = -lXi + +LINTXI = $(LINTLIBDIR)/llib-lXi.ln + + XTESTLIBSRC = $(LIBSRC)/Xtst + +SOXTESTREV = 6.1 +DEPXTESTLIB = +XTESTLIB = -lXtst + +LINTXTEST = $(LINTLIBDIR)/llib-lXtst.ln + +DEPXBSDLIB = $(USRLIBDIR)/libXbsd.a +XBSDLIB = -lXbsd + +LINTXBSD = $(LINTLIBDIR)/llib-lXbsd.ln + + ICESRC = $(LIBSRC)/ICE + +SOICEREV = 6.4 +DEPICELIB = +ICELIB = -lICE + +LINTICE = $(LINTLIBDIR)/llib-lICE.ln + + SMSRC = $(LIBSRC)/SM + +SOSMREV = 6.0 +DEPSMLIB = +SMLIB = -lSM + +LINTSM = $(LINTLIBDIR)/llib-lSM.ln + + XKEYSRC = $(LIBSRC)/Xkey + +SOXKEYREV = 6.0 +DEPXKEYLIB = +XKEYLIB = -lXkey + +LINTXKEY = $(LINTLIBDIR)/llib-lXkey.ln + + FSLIBSRC = $(LIBSRC)/FS + +SOFSREV = 6.0 +DEPFSLIB = +FSLIB = -lFS + +LINTFS = $(LINTLIBDIR)/llib-lFS.ln + + FONTLIBSRC = $(LIBSRC)/font + +DEPFONTLIB = $(USRLIBDIR)/libXfont.a +FONTLIB = -L$(FREETYPELIBDIR) -L$(FONTLIBSRC) -lXfont + +LINTXFONT = $(LINTLIBDIR)/llib-lXfont.ln +# +DEPXFONTLIB = $(USRLIBDIR)/libXfont.a +XFONTLIB = -lXfont + +LINTXFONT = $(LINTLIBDIR)/llib-lXfont.ln + + FONTSTUBLIBSRC = $(FONTLIBSRC)/stubs + +DEPFONTSTUBLIB = $(USRLIBDIR)/libfntstubs.a +FONTSTUBLIB = -lfntstubs + +LINTFONTSTUB = $(LINTLIBDIR)/llib-lfntstubs.ln + DEPFONTLIB = $(DEPXFONTLIB) $(DEPFONTSTUBLIB) + FONTLIB = $(XFONTLIB) $(FONTSTUBLIB) $(FREETYPE2LIB) + + FONTENCLIBSRC = $(LIBSRC)/fontenc + +DEPXFONTENCLIB = $(USRLIBDIR)/libfontenc.a +XFONTENCLIB = -lfontenc + +LINTXFONTENC = $(LINTLIBDIR)/llib-lfontenc.ln + + XPMLIBSRC = $(LIBSRC)/Xpm + +SOXPMREV = 4.11 +DEPXPMLIB = +XPMLIB = -lXpm + +LINTXPM = $(LINTLIBDIR)/llib-lXpm.ln + +FREETYPE2DIR = /usr +FREETYPE2LIBDIR = /usr/lib +FREETYPE2INCDIR = /usr/include + +FREETYPE2LIB = -lfreetype + +FREETYPE2INCLUDES = -I$(FREETYPE2INCDIR)/freetype2 -I$(FREETYPE2INCDIR)/freetype2/config + +FREETYPE2DEFINES = -DFREETYPE2 + + EXPATLIBSRC = $(LIBSRC)/expat + +SOEXPATREV = 0.4 +DEPEXPATLIB = +EXPATLIB = -lexpat + +LINTEXPAT = $(LINTLIBDIR)/llib-lexpat.ln + +EXPATDIR = /usr +EXPATLIBDIR = /usr/lib +EXPATINCDIR = /usr/include + +EXPATINCLUDES = + +EXPATLIB = -lexpat + +EXPATDEFINES = -DEXPAT + +XFTDIR = /usr +XFTLIBDIR = /usr/lib +XFTINCDIR = /usr/include +XFTLIB = -L$(XFTLIBDIR) -lXft + +XFTINCLUDES= -I$(XFTINCDIR) $(FONTCONFIGINCLUDES) $(FREETYPE2INCLUDES) $(XRENDERINCLUDES) + +FONTCONFIGDIR = /usr +FONTCONFIGLIBDIR = /usr/lib +FONTCONFIGINCDIR = /usr/include +FONTCONFIGBINDIR = /usr/bin + +FONTCONFIGLIB = -lfontconfig + +FONTCONFIGINCLUDES = + +FCCACHE = $(FONTCONFIGBINDIR)/fc-cache + +FONTCONFIGDEFINES = -DFONTCONFIG + +LIBPNGINCDIR = /usr/include + +LIBPNGINC= + +LIBPNGDIR = /usr +LIBPNGLIBDIR = /usr/lib +LIBPNGINCDIR = /usr/include + +LIBPNGLIB = -lpng + + XKBFILELIBSRC = $(LIBSRC)/xkbfile + +SOXKBFILEREV = 1.0 +DEPXKBFILELIB = +XKBFILELIB = -lxkbfile + +LINTXKBFILE = $(LINTLIBDIR)/llib-lxkbfile.ln + + XKBCOMPCMD = $(XBINDIR)/xkbcomp + + XKBUILIBSRC = $(LIBSRC)/xkbui + +SOXKBUIREV = 1.0 +DEPXKBUILIB = +XKBUILIB = -lxkbui + +LINTXKBUI = $(LINTLIBDIR)/llib-lxkbui.ln + +EXTRAXAWREQS = + +EXTRAXAWCLIENTDEPLIBS = + +EXTRAXAWCLIENTLIBS = + + XTRAPLIBSRC = $(LIBSRC)/XTrap + +SOXTRAPREV = 6.4 +DEPXTRAPLIB = +XTRAPLIB = -lXTrap + +LINTXTRAP = $(LINTLIBDIR)/llib-lXTrap.ln + + DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB) + + DEPLIBS1 = $(DEPLIBS) + DEPLIBS2 = $(DEPLIBS) + DEPLIBS3 = $(DEPLIBS) + DEPLIBS4 = $(DEPLIBS) + DEPLIBS5 = $(DEPLIBS) + DEPLIBS6 = $(DEPLIBS) + DEPLIBS7 = $(DEPLIBS) + DEPLIBS8 = $(DEPLIBS) + DEPLIBS9 = $(DEPLIBS) + DEPLIBS10 = $(DEPLIBS) + + XFTPRELOADPATTERN = libXft.so.? + XRENDERPRELOADPATTERN = libXrender.so.? + XFONTPRELOADPATTERN = libXfont*.so.? + +XMULIBONLY = -lXmu +XMULIB = $(XMULIBONLY) $(XTOOLLIB) $(XLIB) + + CONFIGDIR = $(LIBDIR)/config + + USRLIBDIRPATH = $(USRLIBDIR) + LDPRELIBS = $(INSTALLED_LIBS) + LDPOSTLIBS = + TOP_INCLUDES = $(TOP_X_INCLUDES) + PROJECT_DEFINES = + VENDOR_DEFINES = -DXVENDORNAME='"$(VENDORNAME)"' -DXVENDORNAMESHORT='"$(VENDORNAMESHORT)"' + +CXXPROJECT_DEFINES = + +# ---------------------------------------------------------------------- +# start of Imakefile + +# ===================================================================== +# Imakefile - xjig v2.4 - Helmut.Hoenig@hub.de - July 24, 1996 +# ===================================================================== + +# set the compiler that you like, +# gcc should suit, since the libraries are not needed. But I had problem +# with the optimize-options on gcc-2.7.0. You should try to use +# optimization on your version, but if it doesn't work, a compiler bug +# might be the reason... + +# CXX = gcc -g + +# On some machines (like on linux) you can gain speed by using the +# MIT-SHM extension for transfering images to the server via shared +# memory. If your system doesn't support that or if you don't see any +# enhancement, you could remove the -DUSE_MIT_SHM flag from the CXXFLAGS. + + USE_MIT_SHM = -DUSE_MIT_SHM + +# There is a speed optimization in not doing any checks about crossing +# the image boundaries during the texture mapping routines. Some extra +# memory therefore surround the image for not crashing due to nonallocated +# memory access. You can switch range-checking on by uncommenting the +# following flag. + +# RANG_CHECK = -DRANGE_CHECK + +# which default file should be loaded if no option is set + + JIG_DEFAULT = \"/usr/share/games/xjig/tina.gif\" + +# ####################################################################### + + SRCS = xjig.C objects.C stack.C imgbuff.C puzzle.C real.C vec2.C vec2list.C mat2.C color_mapper.C base_image.C gif_image.C ximage.C ppm_image.C jpeg_image.C + + CXXFLAGS = $(USE_MIT_SHM) $(RANG_CHECK) + + LOCAL_LIBRARIES = $(XLIB) -ljpeg -lnetpbm -lm + + OBJS = xjig.o objects.o stack.o imgbuff.o puzzle.o real.o vec2.o vec2list.o mat2.o color_mapper.o base_image.o gif_image.o ximage.o ppm_image.o jpeg_image.o + +xjig: $(OBJS) $(DEPLIBS) + $(RM) $@ + $(CXX) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS) + +all:: xjig + +install:: xjig + @if [ -d $(DESTDIR)$(BINDIR) ]; then \ + set +x; \ + else \ + if [ -h $(DESTDIR)$(BINDIR) ]; then \ + (set -x; rm -f $(DESTDIR)$(BINDIR)); \ + fi; \ + (set -x; $(MKDIRHIER) $(DESTDIR)$(BINDIR)); \ + fi + $(INSTALL) $(INSTALLFLAGS) $(INSTPGMFLAGS) xjig $(DESTDIR)$(BINDIR)/xjig + +all:: xjig.$(MANNEWSUFFIX) + +xjig.$(MANNEWSUFFIX): xjig.$(MANSRCSUFFIX) + $(RM) $@ + if test -z "$(PREPROCESSMANPAGES)" ; then \ + cd `dirname xjig` && \ + $(LN) `basename xjig.$(MANSRCSUFFIX)` `basename $@`; \ + else \ + $(RAWCPP) $(MANDEFS) $(EXTRAMANDEFS) \ + < xjig.$(MANSRCSUFFIX) | sed -e '/^# *[0-9][0-9]* *.*$$/d' -e '/^#line *[0-9][0-9]* *.*$$/d' -e '/^[ ]*XCOMM$$/s/XCOMM/#/' -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/#/' -e '/^[ ]*XHASH/s/XHASH/#/' -e '/\@\@$$/s/\@\@$$/\\/' >$@; \ + fi + +cleandir:: + $(RM) xjig.$(MANNEWSUFFIX) + +install.man:: xjig.$(MANNEWSUFFIX) + @if [ -d $(DESTDIR)$(MANDIR) ]; then \ + set +x; \ + else \ + if [ -h $(DESTDIR)$(MANDIR) ]; then \ + (set -x; rm -f $(DESTDIR)$(MANDIR)); \ + fi; \ + (set -x; $(MKDIRHIER) $(DESTDIR)$(MANDIR)); \ + fi + $(INSTALL) $(INSTALLFLAGS) $(INSTMANFLAGS) xjig.$(MANNEWSUFFIX) $(DESTDIR)$(MANDIR)/xjig.$(MANSUFFIX) + +depend:: + $(DEPEND) $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- $(SRCS) + +cleandir:: + $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut "#"* + +xjig.o: + $(CXX) $(CXXFLAGS) -DJIG_DEFAULT=$(JIG_DEFAULT) -c xjig.C -o $@ + +# .C.o: +# $(CXX) $(CFLAGS) -c $< -o $@ + +# ---------------------------------------------------------------------- +# common rules for all Makefiles - do not edit + +.c.i: + $(RM) $@ + $(CC) -E $(CFLAGS) $(_NOOP_) $*.c > $@ + +.SUFFIXES: .ii + +.cc.ii: + $(RM) $@ + $(CC) -E $(CFLAGS) $(_NOOP_) $*.cc > $@ + +.SUFFIXES: .s + +.c.s: + $(RM) $@ + $(CC) -S $(CFLAGS) $(_NOOP_) $*.c + +.cc.s: + $(RM) $@ + $(CC) -S $(CFLAGS) $(_NOOP_) $*.cc + +emptyrule:: + +cleandir:: + $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut "#"* + +Makefile:: + -@if [ -f Makefile ]; then set -x; \ + $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \ + else exit 0; fi + $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) + +tags:: + $(TAGS) -w *.[ch] + $(TAGS) -xw *.[ch] > TAGS + +man_keywords:: + +html_index:: + +clean:: cleandir + +distclean:: cleandir + + PREPROCESSMANPAGES = true + +# ---------------------------------------------------------------------- +# empty rules for directories that do not have SUBDIRS - do not edit + +install:: + @echo "install in $(CURRENT_DIR) done" + +install.man:: + @echo "install.man in $(CURRENT_DIR) done" + +install.sdk:: + @echo "install.sdk in $(CURRENT_DIR) done" + +Makefiles:: + +includes:: + +depend:: + +distclean:: + $(RM) Makefile Makefile.dep + +# ---------------------------------------------------------------------- +# dependencies generated by makedepend + +# DO NOT DELETE +xjig.o: xjig.C global.h /usr/include/stdlib.h /usr/include/features.h \ + /usr/include/bits/predefs.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i486-linux-gnu/4.4.5/include/stddef.h \ + /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/bits/byteswap.h /usr/include/xlocale.h \ + /usr/include/sys/types.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/time.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/stdio.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/lib/gcc/i486-linux-gnu/4.4.5/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/math.h /usr/include/bits/huge_val.h \ + /usr/include/bits/huge_valf.h /usr/include/bits/huge_vall.h \ + /usr/include/bits/inf.h /usr/include/bits/nan.h \ + /usr/include/bits/mathdef.h /usr/include/bits/mathcalls.h \ + /usr/include/X11/Xlib.h /usr/include/X11/X.h \ + /usr/include/X11/Xfuncproto.h /usr/include/X11/Xosdefs.h \ + /usr/include/X11/Xutil.h /usr/include/X11/keysym.h \ + /usr/include/X11/keysymdef.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/environments.h \ + /usr/include/bits/confname.h /usr/include/getopt.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/sys/ucontext.h \ + /usr/include/bits/sigthread.h /usr/include/X11/cursorfont.h \ + /usr/include/X11/extensions/shape.h \ + /usr/include/X11/extensions/shapeconst.h /usr/include/X11/Xos.h \ + /usr/include/string.h /usr/include/fcntl.h /usr/include/bits/fcntl.h \ + /usr/include/bits/uio.h /usr/include/sys/stat.h /usr/include/bits/stat.h \ + /usr/include/sys/time.h /usr/include/X11/Xarch.h objects.H stack.H \ + vec2.h real.h vec2list.h mat2.h ximage.H base_image.H color_mapper.H \ + imgbuff.H puzzle.H cursor.h +objects.o: objects.C global.h /usr/include/stdlib.h \ + /usr/include/features.h /usr/include/bits/predefs.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i486-linux-gnu/4.4.5/include/stddef.h \ + /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/bits/byteswap.h /usr/include/xlocale.h \ + /usr/include/sys/types.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/time.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/stdio.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/lib/gcc/i486-linux-gnu/4.4.5/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/math.h /usr/include/bits/huge_val.h \ + /usr/include/bits/huge_valf.h /usr/include/bits/huge_vall.h \ + /usr/include/bits/inf.h /usr/include/bits/nan.h \ + /usr/include/bits/mathdef.h /usr/include/bits/mathcalls.h \ + /usr/include/X11/Xlib.h /usr/include/X11/X.h \ + /usr/include/X11/Xfuncproto.h /usr/include/X11/Xosdefs.h \ + /usr/include/X11/Xutil.h /usr/include/X11/keysym.h \ + /usr/include/X11/keysymdef.h /usr/include/X11/Xmd.h \ + /usr/include/X11/extensions/shape.h \ + /usr/include/X11/extensions/shapeconst.h objects.H stack.H vec2.h real.h \ + vec2list.h mat2.h ximage.H base_image.H imgbuff.H color_mapper.H \ + puzzle.H rotate.H +stack.o: stack.C /usr/include/stdio.h /usr/include/features.h \ + /usr/include/bits/predefs.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i486-linux-gnu/4.4.5/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/lib/gcc/i486-linux-gnu/4.4.5/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/bits/waitflags.h \ + /usr/include/bits/waitstatus.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/bits/byteswap.h \ + /usr/include/xlocale.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/strings.h /usr/include/X11/Xlib.h \ + /usr/include/X11/X.h /usr/include/X11/Xfuncproto.h \ + /usr/include/X11/Xosdefs.h global.h /usr/include/math.h \ + /usr/include/bits/huge_val.h /usr/include/bits/huge_valf.h \ + /usr/include/bits/huge_vall.h /usr/include/bits/inf.h \ + /usr/include/bits/nan.h /usr/include/bits/mathdef.h \ + /usr/include/bits/mathcalls.h /usr/include/X11/Xutil.h \ + /usr/include/X11/keysym.h /usr/include/X11/keysymdef.h stack.H objects.H \ + vec2.h real.h vec2list.h mat2.h ximage.H base_image.H +imgbuff.o: imgbuff.C global.h /usr/include/stdlib.h \ + /usr/include/features.h /usr/include/bits/predefs.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i486-linux-gnu/4.4.5/include/stddef.h \ + /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/bits/byteswap.h /usr/include/xlocale.h \ + /usr/include/sys/types.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/time.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/stdio.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/lib/gcc/i486-linux-gnu/4.4.5/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/math.h /usr/include/bits/huge_val.h \ + /usr/include/bits/huge_valf.h /usr/include/bits/huge_vall.h \ + /usr/include/bits/inf.h /usr/include/bits/nan.h \ + /usr/include/bits/mathdef.h /usr/include/bits/mathcalls.h \ + /usr/include/X11/Xlib.h /usr/include/X11/X.h \ + /usr/include/X11/Xfuncproto.h /usr/include/X11/Xosdefs.h \ + /usr/include/X11/Xutil.h /usr/include/X11/keysym.h \ + /usr/include/X11/keysymdef.h imgbuff.H +puzzle.o: puzzle.C global.h /usr/include/stdlib.h /usr/include/features.h \ + /usr/include/bits/predefs.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i486-linux-gnu/4.4.5/include/stddef.h \ + /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/bits/byteswap.h /usr/include/xlocale.h \ + /usr/include/sys/types.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/time.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/stdio.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/lib/gcc/i486-linux-gnu/4.4.5/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/math.h /usr/include/bits/huge_val.h \ + /usr/include/bits/huge_valf.h /usr/include/bits/huge_vall.h \ + /usr/include/bits/inf.h /usr/include/bits/nan.h \ + /usr/include/bits/mathdef.h /usr/include/bits/mathcalls.h \ + /usr/include/X11/Xlib.h /usr/include/X11/X.h \ + /usr/include/X11/Xfuncproto.h /usr/include/X11/Xosdefs.h \ + /usr/include/X11/Xutil.h /usr/include/X11/keysym.h \ + /usr/include/X11/keysymdef.h puzzle.H vec2.h real.h objects.H stack.H \ + vec2list.h mat2.h +real.o: real.C global.h /usr/include/stdlib.h /usr/include/features.h \ + /usr/include/bits/predefs.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i486-linux-gnu/4.4.5/include/stddef.h \ + /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/bits/byteswap.h /usr/include/xlocale.h \ + /usr/include/sys/types.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/time.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/stdio.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/lib/gcc/i486-linux-gnu/4.4.5/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/math.h /usr/include/bits/huge_val.h \ + /usr/include/bits/huge_valf.h /usr/include/bits/huge_vall.h \ + /usr/include/bits/inf.h /usr/include/bits/nan.h \ + /usr/include/bits/mathdef.h /usr/include/bits/mathcalls.h \ + /usr/include/X11/Xlib.h /usr/include/X11/X.h \ + /usr/include/X11/Xfuncproto.h /usr/include/X11/Xosdefs.h \ + /usr/include/X11/Xutil.h /usr/include/X11/keysym.h \ + /usr/include/X11/keysymdef.h real.h +vec2.o: vec2.C global.h /usr/include/stdlib.h /usr/include/features.h \ + /usr/include/bits/predefs.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i486-linux-gnu/4.4.5/include/stddef.h \ + /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/bits/byteswap.h /usr/include/xlocale.h \ + /usr/include/sys/types.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/time.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/stdio.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/lib/gcc/i486-linux-gnu/4.4.5/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/math.h /usr/include/bits/huge_val.h \ + /usr/include/bits/huge_valf.h /usr/include/bits/huge_vall.h \ + /usr/include/bits/inf.h /usr/include/bits/nan.h \ + /usr/include/bits/mathdef.h /usr/include/bits/mathcalls.h \ + /usr/include/X11/Xlib.h /usr/include/X11/X.h \ + /usr/include/X11/Xfuncproto.h /usr/include/X11/Xosdefs.h \ + /usr/include/X11/Xutil.h /usr/include/X11/keysym.h \ + /usr/include/X11/keysymdef.h vec2.h real.h +vec2list.o: vec2list.C global.h /usr/include/stdlib.h \ + /usr/include/features.h /usr/include/bits/predefs.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i486-linux-gnu/4.4.5/include/stddef.h \ + /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/bits/byteswap.h /usr/include/xlocale.h \ + /usr/include/sys/types.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/time.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/stdio.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/lib/gcc/i486-linux-gnu/4.4.5/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/math.h /usr/include/bits/huge_val.h \ + /usr/include/bits/huge_valf.h /usr/include/bits/huge_vall.h \ + /usr/include/bits/inf.h /usr/include/bits/nan.h \ + /usr/include/bits/mathdef.h /usr/include/bits/mathcalls.h \ + /usr/include/X11/Xlib.h /usr/include/X11/X.h \ + /usr/include/X11/Xfuncproto.h /usr/include/X11/Xosdefs.h \ + /usr/include/X11/Xutil.h /usr/include/X11/keysym.h \ + /usr/include/X11/keysymdef.h vec2list.h vec2.h real.h mat2.h +mat2.o: mat2.C global.h /usr/include/stdlib.h /usr/include/features.h \ + /usr/include/bits/predefs.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i486-linux-gnu/4.4.5/include/stddef.h \ + /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/bits/byteswap.h /usr/include/xlocale.h \ + /usr/include/sys/types.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/time.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/stdio.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/lib/gcc/i486-linux-gnu/4.4.5/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/math.h /usr/include/bits/huge_val.h \ + /usr/include/bits/huge_valf.h /usr/include/bits/huge_vall.h \ + /usr/include/bits/inf.h /usr/include/bits/nan.h \ + /usr/include/bits/mathdef.h /usr/include/bits/mathcalls.h \ + /usr/include/X11/Xlib.h /usr/include/X11/X.h \ + /usr/include/X11/Xfuncproto.h /usr/include/X11/Xosdefs.h \ + /usr/include/X11/Xutil.h /usr/include/X11/keysym.h \ + /usr/include/X11/keysymdef.h mat2.h real.h vec2.h +color_mapper.o: color_mapper.C /usr/include/X11/Xlib.h \ + /usr/include/sys/types.h /usr/include/features.h \ + /usr/include/bits/predefs.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/time.h \ + /usr/lib/gcc/i486-linux-gnu/4.4.5/include/stddef.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/bits/byteswap.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/X11/X.h /usr/include/X11/Xfuncproto.h \ + /usr/include/X11/Xosdefs.h /usr/include/stdio.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/lib/gcc/i486-linux-gnu/4.4.5/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/bits/waitflags.h \ + /usr/include/bits/waitstatus.h /usr/include/xlocale.h \ + /usr/include/alloca.h color_mapper.H +base_image.o: base_image.C /usr/include/stdlib.h /usr/include/features.h \ + /usr/include/bits/predefs.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i486-linux-gnu/4.4.5/include/stddef.h \ + /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/bits/byteswap.h /usr/include/xlocale.h \ + /usr/include/sys/types.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/time.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/stdio.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/lib/gcc/i486-linux-gnu/4.4.5/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/string.h base_image.H +gif_image.o: gif_image.C /usr/include/stdlib.h /usr/include/features.h \ + /usr/include/bits/predefs.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i486-linux-gnu/4.4.5/include/stddef.h \ + /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/bits/byteswap.h /usr/include/xlocale.h \ + /usr/include/sys/types.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/time.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/stdio.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/lib/gcc/i486-linux-gnu/4.4.5/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/string.h gif_image.H base_image.H +ximage.o: ximage.C global.h /usr/include/stdlib.h /usr/include/features.h \ + /usr/include/bits/predefs.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i486-linux-gnu/4.4.5/include/stddef.h \ + /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/bits/byteswap.h /usr/include/xlocale.h \ + /usr/include/sys/types.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/time.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/stdio.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/lib/gcc/i486-linux-gnu/4.4.5/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/math.h /usr/include/bits/huge_val.h \ + /usr/include/bits/huge_valf.h /usr/include/bits/huge_vall.h \ + /usr/include/bits/inf.h /usr/include/bits/nan.h \ + /usr/include/bits/mathdef.h /usr/include/bits/mathcalls.h \ + /usr/include/X11/Xlib.h /usr/include/X11/X.h \ + /usr/include/X11/Xfuncproto.h /usr/include/X11/Xosdefs.h \ + /usr/include/X11/Xutil.h /usr/include/X11/keysym.h \ + /usr/include/X11/keysymdef.h /usr/include/string.h \ + /usr/include/X11/Xmd.h ximage.H base_image.H color_mapper.H gif_image.H \ + ppm_image.H jpeg_image.H reset_image.H +ppm_image.o: ppm_image.C /usr/include/stdlib.h /usr/include/features.h \ + /usr/include/bits/predefs.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i486-linux-gnu/4.4.5/include/stddef.h \ + /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/bits/byteswap.h /usr/include/xlocale.h \ + /usr/include/sys/types.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/time.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/stdio.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/lib/gcc/i486-linux-gnu/4.4.5/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/string.h /usr/include/ppm.h /usr/include/pgm.h \ + /usr/include/pbm.h /usr/include/pm.h /usr/include/pm_config.h \ + /usr/include/fcntl.h /usr/include/bits/fcntl.h /usr/include/bits/uio.h \ + /usr/include/sys/stat.h /usr/include/bits/stat.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/environments.h \ + /usr/include/bits/confname.h /usr/include/getopt.h /usr/include/ctype.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/netpbm-shhopt.h /usr/include/ppmcmap.h ppm_image.H \ + base_image.H +jpeg_image.o: jpeg_image.C /usr/include/stdlib.h /usr/include/features.h \ + /usr/include/bits/predefs.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i486-linux-gnu/4.4.5/include/stddef.h \ + /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/bits/byteswap.h /usr/include/xlocale.h \ + /usr/include/sys/types.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/time.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/stdio.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/lib/gcc/i486-linux-gnu/4.4.5/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/string.h /usr/include/jpeglib.h /usr/include/jconfig.h \ + /usr/include/jmorecfg.h jpeg_image.H base_image.H --- xjig-2.4.orig/jpeg_image.H +++ xjig-2.4/jpeg_image.H @@ -0,0 +1,15 @@ +#ifndef __jpeg_image_h +#define __jpeg_image_h + +#include "base_image.H" + +class jpegImage : public Image { + public: + jpegImage( const char *filename, int autocrop=1 ); + + protected: + int LoadImageFile(FILE *fp); + int LoadImageFile(const char *fname) {return Image::LoadImageFile(fname);} +}; + +#endif --- xjig-2.4.orig/xjig.man +++ xjig-2.4/xjig.man @@ -1,4 +1,4 @@ -.TH xjig 1 "July-23-1996" "X Version 11" +.TH xjig 6 "July-23-1996" "X Version 11" .SH NAME xjig \- the jigsaw puzzle .SH SYNOPSIS @@ -11,8 +11,9 @@ pieces together. If you like, you can watch the time that you spent for it. .PP -Any image-file in gif-format can be used as the source for the puzzle, which -is then randomly created regarding the sizes selected by the options. +Any image-file in GIF, JPEG, or PPM format can be used as the source for the +puzzle, which is then randomly created regarding the sizes selected by the +options. .PP The control should be as intuitive as possible in the way that you will usually pull the freely rotatable pieces at one edge, drag them to the desired @@ -80,10 +81,12 @@ .B -w \fIx\fP Select number of tiles in horizontal direction. The Images are automatically rotated in portrait orientation before they are sliced. Therefore \fIx\fP -usually should be smaller than \fIy\fP of the next option. +usually should be smaller than \fIy\fP of the next option. The default +is four. .TP 12 .B -h \fIy\fP -Select number of tiles in vertical direction respectively. +Select number of tiles in vertical direction respectively. The default +is six. .TP 12 .B -ts \fIn\fP Select average tile width. Instead of explicitly specifying the number of tiles --- xjig-2.4.orig/base_image.C +++ xjig-2.4/base_image.C @@ -0,0 +1,239 @@ +/* This file was split off from gif_image.C; look there for the impressive + pedigree. */ + +#include +#include +#include + +#include "base_image.H" + +#define False 0 +#define True 1 +#define DEBUG 0 + +#define minpix 10 + +Image::Image(const char *filename, int autocrop ) +{ + name = strrchr((char *)filename,'/'); + if (name) name=strdup(name+1); + else name=strdup(filename); + + /*can't call virtual from constructor, so child class will have to do this:*/ + /*LoadImageFile( filename );*/ + + /*this depends on the image being loaded, so child class has to do it too:*/ + /*if (autocrop&&!fastinfo_flag) CropImage();*/ +} + +Image::Image() { + name=strdup("dummy"); + ColorMapSize=128; + for (int i=0;i<128;i++) { + Red[i] = 255 * ((i>>5)&0x03) / 3; + Green[i] = 255 * ((i>>2)&0x07) / 7; + Blue[i] = 255 * (i&0x03) / 3; + } + width =1; + height=1; + data =(byte*)malloc(1); +} + +Image::~Image() { + free(name); + CloseImage(); +} + +int Image::GetColor(int id, unsigned short *red, unsigned short *green, unsigned short *blue) { + *red =Red[id] | Red[id]<<8; + *green=Green[id] | Green[id]<<8; + *blue =Blue[id] | Blue[id]<<8; + return 0; +} + +void Image::Rotate90() { +byte *ndata; +int help; + + if (!(ndata = (byte *)malloc(width*height))) { + fprintf(stderr,"not enough memory to flip image"); + exit(-1); + } + + for (int y=0;ywidth || w<0 || y1<0 || y2>height || h<0) { + fprintf(stderr,"unable to crop (%d,%d)-(%d,%d)\n", x1,y1,x2,y2); + fprintf(stderr,"image size: %dx%d\n", width, height ); + exit(-1); + } + + for (int i=0;i=minpix) break; + } + } + if (count>=minpix) break; + y1=i; + } + for (i=Height()-1;i>=0; i--) { + int flag[256]; + int count=0; + ptr = data + (i*Width()); + for (j=0;j<256;j++) flag[j]=0; + for (j=0; j=minpix) break; + } + } + if (count>=minpix) break; + y2=i; + } + + for (i=0; i=minpix) break; + } + } + if (count>=minpix) break; + x1=i; + } + for (i=Width()-1;i>=0;i--) { + int flag[256]; + int count=0; + ptr = data + i; + for (j=0;j<256;j++) flag[j]=0; + for (j=0; j=minpix) break; + } + } + if (count>=minpix) break; + x2=i; + } + + x1++; x2--; y1++; y2--; + if (x2<=x1||y2<=y1) return 1; + + CropImage(x1,y1,x2,y2); + return 0; +} + + +void Image::CloseImage() +{ +#if (0) + if (LocalCmap) + { + XFreeColormap(theDisp, LocalCmap); + LocalCmap=0; + } + else + { + int i,j; + unsigned long pixels[256]; + + for (j=i=0;i0 && i<256) { + Red[i]=Green[i]=Blue[i]=0; + Background=i; + ++ColorMapSize; + } +} --- xjig-2.4.orig/stack.C +++ xjig-2.4/stack.C @@ -13,8 +13,8 @@ #ifndef _objects_h # include "objects.H" #endif -#ifndef _gifx_image_h -# include "gifx_image.H" +#ifndef _ximage_h +# include "ximage.H" #endif --- xjig-2.4.orig/xjig.C +++ xjig-2.4/xjig.C @@ -1,6 +1,10 @@ #include "global.h" +#include // for time() +#include // for getpid() +#include // for getpid() + #include #ifdef PINUP_DEFAULT # include @@ -42,7 +46,7 @@ # include "objects.H" #endif -#include "gifx_image.H" +#include "ximage.H" #include "color_mapper.H" #include "imgbuff.H" #include "puzzle.H" @@ -118,27 +122,19 @@ int angle=0; // preset angles for debugging class Puzzle *p; // Collection of all puzzle pieces -class GifPixmap *pm; // Original pixmap for the puzzle tiles +class XjigPixmap *pm; // Original pixmap for the puzzle tiles class Port *port; // Port (Display synonym) for color mapping class ObjectStack *stk; // administrator object for all viewable objects class ImageBuffer *img_buf; // memory for rotating image (probably shared) // =========================================================================== -static unsigned char b[2]; - static void my_srand( unsigned seed ) { - b[0]=seed&0xff; - b[1]=seed>>8; + srand(seed); } int my_rand(void) { - unsigned long s1=b[0]<<8|b[1]; - s1+=12345; - s1*=s1; - b[0]=(unsigned char)((s1>>8)&0xff); - b[1]=(unsigned char)((s1>>16)&0xff); - return (s1>>8)&0xffff; + return rand(); } // =========================================================================== @@ -301,7 +297,7 @@ void usage() { printf( "usage : xjig []\n" ); printf( "\n" ); - printf( "options: -file : use gif-image in \n" ); + printf( "options: -file : use image in \n" ); printf( " -w : number of tiles in x direction\n" ); printf( " -h : number of tiles in y direction\n" ); printf( " -ts : set average tile size\n" ); @@ -362,13 +358,13 @@ void scan_args( int argc, char **argv ) { for (int i=1;iGetExtensionData( OPTION_EXTENSION ); if (options) { char opt_buffer[256]; @@ -637,7 +633,10 @@ img_buf = new ImageBuffer(); // initialize puzzle game - my_srand( random_seed ); + if(random_seed>0) + my_srand( random_seed ); + else + my_srand(time(NULL)+getpid()); p = new Puzzle(); p->Init(width,height,dx,dy, pm->GetExtensionData( FLATTILE_EXTENSION ) ); @@ -668,7 +667,7 @@ XSync(dpy,0); while (!XPending(dpy)) { struct timeval timeout; - struct fd_set readfds; + /*struct*/ fd_set readfds; int nfds; FD_ZERO( &readfds ); --- xjig-2.4.orig/fmt_image.H.stub +++ xjig-2.4/fmt_image.H.stub @@ -0,0 +1,26 @@ +#ifndef __fmt_image_h +#define __fmt_image_h + +#include "base_image.H" + +class fmtImage : public Image { + public: + fmtImage( const char *filename, int autocrop=1 ); + fmtImage(); + ~fmtImage(); + + /* This function may be omitted if the file format doesn't support it. + * Just delete the following line and the function definition in the + * corresponding .C file */ + const char *GetExtensionData( unsigned char code ); + + protected: + /* OPTION 1: The fmt class loader takes a FILE* */ + int LoadImageFile(FILE *fp); + int LoadImageFile(const char *fname) {return Image::LoadImageFile(fname);} + + /* OPTION 2: The fmt class loader takes a filename */ + /*int LoadImageFile(const char *fname);*/ +}; + +#endif --- xjig-2.4.orig/objects.C +++ xjig-2.4/objects.C @@ -9,8 +9,8 @@ #ifndef _objects_h # include "objects.H" #endif -#ifndef _gifx_image_h -# include "gifx_image.H" +#ifndef _ximage_h +# include "ximage.H" #endif #ifndef _imgbuff_h # include "imgbuff.H" @@ -73,6 +73,8 @@ double PieceFrameSetup::spx[] = { 1, 2.5, 5, 7, 7, 5, 5, 6, 8,13 }; double PieceFrameSetup::spy[] = { 13,12.5,11, 8, 5, 2, 0,-2,-3,-3 }; +//double PieceFrameSetup::spx[] = { 1, 2, 4, 5, 7, 8, 9, 10,11,13 }; +//double PieceFrameSetup::spy[] = { 13, 12,10, 9, 7, 6, 5, 4, 3, 1 }; PieceFrameSetup::PieceFrameSetup() { @@ -969,7 +971,7 @@ } void MoveablePiece::DispatchPress( XButtonEvent * xbutton ) { - if (xbutton->state&ControlMask) { + if (side_lock<0 && xbutton->state&ControlMask) { // printf( "doing the flip ...\n" ); mystack->Raise(this); FlipOver( Vec2(xbutton->x,xbutton->y) ); @@ -1070,7 +1072,7 @@ } turnflag=0; } - else if (xbutton->time-start_time<150&&xbutton->button==Button2&&!(xbutton->state&~Button2Mask)) { + else if (side_lock<0 && xbutton->time-start_time<300&&xbutton->button==Button2&&!(xbutton->state&~Button2Mask)) { FlipOver(Vec2(xbutton->x,xbutton->y)); } else if (xbutton->state&Button1Mask) --- xjig-2.4.orig/ppm_image.C +++ xjig-2.4/ppm_image.C @@ -0,0 +1,120 @@ +#include +#include +#include +extern "C" { +#include +#include +} + +#include "ppm_image.H" + +#undef XJIG_PPM_DEBUG + +ppmImage::ppmImage(const char *filename, int autocrop ) + : Image(filename, autocrop) +{ + LoadImageFile( filename ); + if (autocrop) CropImage(); +} + +/*****************************/ +int ppmImage::LoadImageFile(FILE *fp) +/*****************************/ +{ + pixval maxval; + pixel **ppmdata; + int ncolors, i, j; + colorhist_vector colors; + colorhash_table hash; + int fake_argc=1; + char *fake_argv[]={"xjig-ppm-loader", 0}; + + ppm_init(&fake_argc, fake_argv); + ppmdata=ppm_readppm(fp, &width, &height, &maxval); +#ifdef XJIG_PPM_DEBUG + fprintf(stderr, "ppm width=%d height=%d maxval=%d\n", + width, height, (int)maxval); +#endif + + /* Scale the color values up or down to 24 bits (RGB=888), which is what + * the xjig core expects. */ + if(maxval!=255) + for(i=0;i256) { + fprintf(stderr, + "ppm image contains %d colors\n" + "Stupid Color Reduction activated.\n" + "For better quality, use ppmquant to reduce colors.\n", + ncolors); + + /* Stupid Color Reduction is an RGB=332 colormap. */ + int r, g, b; + i=0; + for(r=0;r<8;++r) + for(g=0;g<8;++g) + for(b=0;b<4;++b) { + Red[i] = r*32; + Green[i] = g*32; + Blue[i] = b*64; + ++i; + } + + ColorMapSize=256; + + data=(byte *)malloc(width*height*sizeof *data); + if(!data) { + fprintf(stderr, "Not enough memory to store ppm data"); + exit(1); + } + for(i=0;i>3) | (b>>6); + } + } else { + ColorMapSize=ncolors; + + hash=ppm_colorhisttocolorhash(colors, ncolors); + for(i=0;i 22 June 1999 + +@files=(); + +foreach $dir ('/usr/share/games/xjig', '/usr/local/lib/games/xjig', $ENV{'HOME'}."/.xjig") { + opendir(DIR, $dir) || next; + @s = grep { /^[^\.]/ && -s "$dir/$_" } readdir(DIR); + push @files, map ( $dir.'/'.$_, @s ); + closedir(DIR); +} + +if ($#files == -1) { die "couldn't find any files to choose from!\n"; } + +$index = rand @files; +chomp($file = $files[$index]); + +exec "/usr/games/xjig",@ARGV,"-file","$file" || die "Couldn't start xjig: $!\n"; --- xjig-2.4.orig/Makefile.HP-UX +++ xjig-2.4/Makefile.HP-UX @@ -24,11 +24,12 @@ LD = $(CXX) -LIBS = -lXext -lX11 -lm +LIBS = -lXext -lX11 -ljpeg -lnetpbm -lm OBJS = xjig.o objects.o stack.o imgbuff.o puzzle.o \ real.o vec2.o vec2list.o mat2.o \ - color_mapper.o gif_image.o gifx_image.o + color_mapper.o base_image.o gif_image.o \ + ppm_image.o jpeg_image.o ximage.o PROGRAM = xjig @@ -53,32 +54,34 @@ vec2list.o: vec2list.C mat2.o: mat2.C color_mapper.o: color_mapper.C +base_image.o: base_image.C gif_image.o: gif_image.C -gifx_image.o: gifx_image.C +ppm_image.o: ppm_image.C +jpeg_image.o: jpeg_image.C +ximage.o: ximage.C # ----------------------------------------------------------------------- # dependencies generated by makedepend # DO NOT DELETE -color_mapper.o: color_mapper.H -gif_image.o: gif_image.H -gifx_image.o: global.h gifx_image.H gif_image.H color_mapper.H reset_image.H -imgbuff.o: global.h imgbuff.H -mat2.o: global.h mat2.h real.h vec2.h -mat2_x.o: global.h vec2.h vec2list.h mat2.h real.h -matrix.o: global.h matrix.h vector.h real.h -matrix_x.o: global.h vec2.h vec3.h real.h matrix.h vector.h -objects.o: global.h objects.H stack.H vec2.h vec2list.h mat2.h real.h -objects.o: gifx_image.H gif_image.H imgbuff.H color_mapper.H puzzle.H -objects.o: rotate.H -puzzle.o: global.h puzzle.H objects.H stack.H vec2.h vec2list.h mat2.h real.h -real.o: global.h real.h -stack.o: global.h stack.H objects.H vec2.h vec2list.h mat2.h real.h -stack.o: gifx_image.H gif_image.H -vec2.o: global.h vec2.h -vec2list.o: global.h vec2list.h mat2.h real.h vec2.h -vec3.o: global.h vec3.h real.h -vector.o: global.h vector.h real.h vec2.h vec3.h -xjig.o: global.h objects.H stack.H vec2.h vec2list.h mat2.h real.h -xjig.o: gifx_image.H gif_image.H color_mapper.H imgbuff.H puzzle.H cursor.h +base_image.o: base_image.C base_image.H +color_mapper.o: color_mapper.C color_mapper.H +gif_image.o: gif_image.C gif_image.H base_image.H +imgbuff.o: imgbuff.C global.h imgbuff.H +jpeg_image.o: jpeg_image.C jpeg_image.H base_image.H +mat2.o: mat2.C global.h mat2.h real.h vec2.h +objects.o: objects.C global.h objects.H stack.H vec2.h real.h vec2list.h \ + mat2.h ximage.H base_image.H imgbuff.H color_mapper.H puzzle.H rotate.H +ppm_image.o: ppm_image.C ppm_image.H base_image.H +puzzle.o: puzzle.C global.h puzzle.H vec2.h real.h objects.H stack.H \ + vec2list.h mat2.h +real.o: real.C global.h real.h +stack.o: stack.C global.h stack.H objects.H vec2.h real.h vec2list.h \ + mat2.h ximage.H base_image.H +vec2.o: vec2.C global.h vec2.h real.h +vec2list.o: vec2list.C global.h vec2list.h vec2.h real.h mat2.h +ximage.o: ximage.C global.h ximage.H base_image.H color_mapper.H \ + gif_image.H ppm_image.H jpeg_image.H reset_image.H +xjig.o: xjig.C global.h objects.H stack.H vec2.h real.h vec2list.h mat2.h \ + ximage.H base_image.H color_mapper.H imgbuff.H puzzle.H cursor.h --- xjig-2.4.orig/gif_image.H +++ xjig-2.4/gif_image.H @@ -1,15 +1,7 @@ #ifndef __gif_image_h #define __gif_image_h -typedef unsigned char byte; -typedef int boolean; - -#define OPTION_EXTENSION (0x10) -#define REMOVETILE_EXTENSION (0x11) -#define FLATTILE_EXTENSION (0x12) -#define SUBSIZE_EXTENSION (0x13) -#define SCALEINFO_START (0x20) -#define COMMENT_EXTENSION (0xFE) +#include "base_image.H" class Extension { public: @@ -30,34 +22,16 @@ friend class GifImage; }; -class GifImage { +class GifImage : public Image { public: GifImage( const char *filename, int autocrop=1 ); GifImage(); ~GifImage(); - const char *Name() { return name; } - int Width() { return width; } - int Height() { return height; } - const byte* Data() { return data; } - const char *GetExtensionData( unsigned char code ); - void GetSize( int *h, int *w ); - long GetAverageColor(); - - int CropImage(int x1,int y1, int x2, int y2); - int CropImage(); - - void AddLock(class GifXImage *locker); - void RemoveLock(class GifXImage *locker); - - void Recolor( class GifImage *gif_p ); - void AddAt( int x, int y, class GifImage *gif2 ); - - void Rotate90(); protected: - int LoadGIF(const char *fname); + int LoadImageFile(const char *fname); int ReadImageData(FILE *fp); // read raw raster data into buffer int DecodeImage(); // decode data into image static int ReadCode(); @@ -66,26 +40,9 @@ int ColorDicking(); #endif void ReadColormap(FILE *fp); - void CloseGif(); protected: - char *name; - int width, height; // image dimensions - byte *data; // image data - byte Red[256], Green[256], Blue[256]; // Colormap-Data - boolean HasColormap; - int ColorMapSize; /* number of colors */ - int Background; /* background color */ - - int lockcount; /* number of lockers */ - Extension *first; - - public: - int GetNCols() { return ColorMapSize; } - int GetColor(int id, unsigned short *red, unsigned short *green, unsigned short *blue); - -friend class GifXImage; }; #endif --- xjig-2.4.orig/README.beyondgif +++ xjig-2.4/README.beyondgif @@ -0,0 +1,52 @@ +Notes in random order: + +The internal data format for xjig's images shows its GIF heritage: it uses an +8-bit palette. To support non-paletted images, there are 3 ways to go: + 1. Convert the image to an 8-bit palette while loading it. This implies a + loss of quality if the image contains more than 256 distinct colors. + 2. Make xjig use a non-paletted internal representation. This requires + touching a lot of code that has nothing to do with the image file loader, + so it would be more work. And then palettized images would have to be + converted to truecolor while loading. + 3. Make xjig capable of using either pseudocolor or truecolor as its + internal representation, and let the image file loader choose which one is + appropriate. This would be a LOT more work. +So I'm doing it the easy way. + +Actually converting an image with lots of colors to a 256-color palette is +not "easy" if you want it to look good afterward, but that's not important +right now. A good quantize() routine should be integrated into xjig. It would +even be useful for GIFs, if the display doesn't have a lot of empty slots in +its default colormap. + +If there is a *serious* shortage of empty slots in the default colormap, +using a private colormap would be good, regardless of image format. + +The following things are no longer GIF-specific and should be renamed: + gif_cols + +In GIFs, xjig looks for command line options and other xjig-specific +extensions embedded in the image file. This seems crazy. I'll leave open the +possibility of implementing it in other formats, but don't hold your breath. + +I hate C++, so any code that I've touched will probably end up looking more +C-like than before. This is not an accident. + +ppm was the first new image format I supported, because libppm (libnetpbm) +was very easy to use. jpeg came next because libjpeg has its own quantizer, +which is a big help. I wish I could call that quantizer independently from +the rest of libjpeg... it would be useful for improving the ppm loader. Oh +well, I guess #include "ppmquant.c" shouldn't be too hard to pull off. PNG +should be the next format to be supported, but libpng's documentation is +frightening. + +Autodetection of image format would be a good thing to have, but choosing a +loader based on filename suffix is a little bit easier so I'll do it that way +first. In any case there should be a command line option to force the use of +a specific loader. + +Although I'm working with Debian's patched source, everything I'm doing +should be applicable upstream. Slight problem: I don't know if there is a +surviving upstream. I might be it. For better usability outside Debian, there +should be configuration options to omit image types whose libraries are not +present. --- xjig-2.4.orig/Makefile.Linux +++ xjig-2.4/Makefile.Linux @@ -1,6 +1,6 @@ ### compiler section -CXX = gcc -Wall -fstrength-reduce -fpcc-struct-return +CXX = g++ -Wall -fstrength-reduce -fpcc-struct-return CXXFLAGS = -g -DUSE_MIT_SHM ### default file to be used, when no options are set @@ -24,7 +24,7 @@ LD = $(CXX) -LIBS = -lXext -lX11 -lm +LIBS = -lXext -lX11 -ljpeg -lnetpbm -lm OBJS = xjig.o \ objects.o \ @@ -36,8 +36,11 @@ vec2list.o \ mat2.o \ color_mapper.o \ + base_image.o \ gif_image.o \ - gifx_image.o + ppm_image.o \ + jpeg_image.o \ + ximage.o PROGRAM = xjig @@ -62,32 +65,34 @@ vec2list.o: vec2list.C mat2.o: mat2.C color_mapper.o: color_mapper.C +base_image.o: base_image.C gif_image.o: gif_image.C -gifx_image.o: gifx_image.C +ppm_image.o: ppm_image.C +jpeg_image.o: jpeg_image.C +ximage.o: ximage.C # ----------------------------------------------------------------------- # dependencies generated by makedepend # DO NOT DELETE -color_mapper.o: color_mapper.H -gif_image.o: gif_image.H -gifx_image.o: global.h gifx_image.H gif_image.H color_mapper.H reset_image.H -imgbuff.o: global.h imgbuff.H -mat2.o: global.h mat2.h real.h vec2.h -mat2_x.o: global.h vec2.h vec2list.h mat2.h real.h -matrix.o: global.h matrix.h vector.h real.h -matrix_x.o: global.h vec2.h vec3.h real.h matrix.h vector.h -objects.o: global.h objects.H stack.H vec2.h vec2list.h mat2.h real.h -objects.o: gifx_image.H gif_image.H imgbuff.H color_mapper.H puzzle.H -objects.o: rotate.H -puzzle.o: global.h puzzle.H objects.H stack.H vec2.h vec2list.h mat2.h real.h -real.o: global.h real.h -stack.o: global.h stack.H objects.H vec2.h vec2list.h mat2.h real.h -stack.o: gifx_image.H gif_image.H -vec2.o: global.h vec2.h -vec2list.o: global.h vec2list.h mat2.h real.h vec2.h -vec3.o: global.h vec3.h real.h -vector.o: global.h vector.h real.h vec2.h vec3.h -xjig.o: global.h objects.H stack.H vec2.h vec2list.h mat2.h real.h -xjig.o: gifx_image.H gif_image.H color_mapper.H imgbuff.H puzzle.H cursor.h +base_image.o: base_image.C base_image.H +color_mapper.o: color_mapper.C color_mapper.H +gif_image.o: gif_image.C gif_image.H base_image.H +imgbuff.o: imgbuff.C global.h imgbuff.H +jpeg_image.o: jpeg_image.C jpeg_image.H base_image.H +mat2.o: mat2.C global.h mat2.h real.h vec2.h +objects.o: objects.C global.h objects.H stack.H vec2.h real.h vec2list.h \ + mat2.h ximage.H base_image.H imgbuff.H color_mapper.H puzzle.H rotate.H +ppm_image.o: ppm_image.C ppm_image.H base_image.H +puzzle.o: puzzle.C global.h puzzle.H vec2.h real.h objects.H stack.H \ + vec2list.h mat2.h +real.o: real.C global.h real.h +stack.o: stack.C global.h stack.H objects.H vec2.h real.h vec2list.h \ + mat2.h ximage.H base_image.H +vec2.o: vec2.C global.h vec2.h real.h +vec2list.o: vec2list.C global.h vec2list.h vec2.h real.h mat2.h +ximage.o: ximage.C global.h ximage.H base_image.H color_mapper.H \ + gif_image.H ppm_image.H jpeg_image.H reset_image.H +xjig.o: xjig.C global.h objects.H stack.H vec2.h real.h vec2list.h mat2.h \ + ximage.H base_image.H color_mapper.H imgbuff.H puzzle.H cursor.h --- xjig-2.4.orig/ximage.C +++ xjig-2.4/ximage.C @@ -0,0 +1,169 @@ + +#include "global.h" + +#include +#include +#include +#include +#include +#include + +#include "ximage.H" +#include "color_mapper.H" +#include "gif_image.H" +#include "ppm_image.H" +#include "jpeg_image.H" + +XjigXImage::XjigXImage(class Port *port,const char *filename,int autocrop) +: p(port) { + const char *suffix = strrchr(filename, '.'); + if(suffix && (!strcasecmp(suffix, ".jpg") || + !strcasecmp(suffix, ".jpeg") || + !strcasecmp(suffix, ".jpe"))) + img=new jpegImage(filename, autocrop); + else if(suffix && (!strcasecmp(suffix, ".ppm") || + !strcasecmp(suffix, ".pgm") || + !strcasecmp(suffix, ".pbm"))) + img=new ppmImage(filename, autocrop); + else + img=new GifImage(filename, autocrop); + xwidth = Width(); + xheight = Height(); + dpy=p->GetDisplay(); + scr=DefaultScreen(dpy); + ximage = 0; + gif_cols=0; + SetupMapper(); +#ifndef RANGE_CHECK + offset_rows=(int)(sqrt((double)xwidth*(double)xwidth+(double)xheight*(double)xheight)/2.0)+1; +#else + offset_rows=0; +#endif +} + +XjigXImage::~XjigXImage() { + DropData(); + if (gif_cols) delete [] gif_cols; +} + +void XjigXImage::SetupMapper() { + if (gif_cols) delete [] gif_cols; + SetupTrueMapper(); +} + +void XjigXImage::SetupTrueMapper() { + gif_cols=new unsigned long[GetNCols()]; + for (int i=0;iGetMapper()->alloc_color(&def); + } +} + +void XjigXImage::TraceMapper() { + for (int i=0;i>8, def.green>>8, def.blue>>8, gif_cols[i] ); + } +} + +void XjigXImage::CreateData( int w, int h ) { + xwidth = w; + xheight = h; +#ifndef RANGE_CHECK + offset_rows=(int)(sqrt((double)w*(double)w+(double)h*(double)h)/2.0)+1; +#else + offset_rows=0; +#endif + DropData(); + switch(texture_mode) { + case 1: Reset8(); break; + case 2: Reset16(); break; + case 3: Reset32(); break; + default: fprintf( stderr, "depth not supported\n" ); + exit(0); + } +} + +void XjigXImage::DropData() { + if (ximage) { + delete [] (ximage->data-offset_bytes); + ximage->data = 0L; + XDestroyImage(ximage); + ximage=0; + } +} + +unsigned long XjigXImage::GetPixel(int x, int y) { + if (x<0||x>=xwidth||y<0||y>=xheight) { + return 0; + } + else { + return XGetPixel(ximage,x,y); + } +} + +/*----------------------------------------------------------------------------*/ +#define DATA_TYPE CARD32 +#define DATA_PAD 4 +void XjigXImage::Reset32() { +# include "reset_image.H" +} +#undef DATA_TYPE +#undef DATA_PAD +/*----------------------------------------------------------------------------*/ +#define DATA_TYPE CARD16 +#define DATA_PAD 2 +void XjigXImage::Reset16() { +# include "reset_image.H" +} +#undef DATA_TYPE +#undef DATA_PAD +/*----------------------------------------------------------------------------*/ +#define DATA_TYPE CARD8 +#define DATA_PAD 1 +void XjigXImage::Reset8() { +# include "reset_image.H" +} +#undef DATA_TYPE +#undef DATA_PAD + +// ======================================================================== + +XjigPixmap::XjigPixmap( Port *port, const char *filename, int autocrop ) +: XjigXImage(port,filename,autocrop) { +int w, h; + + pixmap=0; + + const char *ext=GetExtensionData( SUBSIZE_EXTENSION ); + + if (ext&&sscanf( ext, "%dx%d", &w, &h)==2) { + xmult=XjigXImage::Width()/w; + ymult=XjigXImage::Height()/h; + } + else { + xmult=1; + ymult=1; + } +} + +XjigPixmap::~XjigPixmap() { + if (pixmap) XFreePixmap(dpy,pixmap); +} + +Pixmap XjigPixmap::GetPixmap() { + if (!pixmap) { + pixmap=XCreatePixmap(dpy,RootWindow(dpy,scr),xwidth,xheight,DefaultDepth(dpy,scr)); + XPutImage(dpy,pixmap,DefaultGC(dpy,scr),GetImage(),0,0,0,0,xwidth,xheight); + } + return pixmap; +} + +void XjigPixmap::CreateData(int w,int h) { + w*=xmult; + h*=ymult; + if (pixmap) { XFreePixmap(dpy,pixmap); pixmap=0; } + XjigXImage::CreateData(w,h); +} --- xjig-2.4.orig/ximage.H +++ xjig-2.4/ximage.H @@ -0,0 +1,84 @@ +#ifndef __ximage_h +#define __ximage_h + +#include "base_image.H" + +class XjigXImage { + public: + XjigXImage( class Port *port, const char *filename, int autocrop=0); + ~XjigXImage(); + + // Size Information + int XWidth() { return xwidth; } + int XHeight() { return xheight; } + void GetXSize( int *w, int *h ) { *w=xwidth; *h=xheight; } + + void CreateData( int w, int h ); + void SetupMapper(); + void SetupTrueMapper(); + void TraceMapper(); + + XImage *GetImage() { + if (!ximage) CreateData(xwidth,xheight); + return ximage; + } + unsigned long GetPixel( int x, int y ); + + public: + void DropData(); + void Reset8(); + void Reset16(); + void Reset32(); + + Display *dpy; + int scr; + + XImage *ximage; + int xwidth, xheight; + int offset_rows; // rows befor and ahead of the image + int offset_bytes; // to prevent overwrite when optimized + + unsigned long *gif_cols; + class Port *p; + + /* Can't inherit Image because it has a pure virtual function and + * XjigXImage needs to be instantiated. So instead, let it contain a + * pointer to one and forward all the necessary methods. */ + Image *img; + int Width() { return img->Width(); } + int Height() { return img->Height(); } + const char *GetExtensionData( unsigned char code ) + { return img->GetExtensionData(code); } + int CropImage(int x1,int y1, int x2, int y2) + { return img->CropImage(x1,y1,x2,y2); } + int CropImage() { return img->CropImage(); } + void Rotate90() { img->Rotate90(); } + int GetNCols() { return img->GetNCols(); } + int GetColor(int id, unsigned short *red, + unsigned short *green, unsigned short *blue) + { return img->GetColor(id, red, green, blue); } + const byte* Data() { return img->Data(); } +}; + +class XjigPixmap : public XjigXImage { + public: + XjigPixmap( class Port *port, const char *filename, int autocrop=0); + ~XjigPixmap(); + + Pixmap GetPixmap(); + void CreateData( int w, int h ); + + int Width() { return XjigXImage::Width()/xmult; } + int Height() { return XjigXImage::Height()/ymult; } + int XWidth() { return XjigXImage::XWidth()/xmult; } + int XHeight() { return XjigXImage::XHeight()/ymult; } + + int IsTwinPixmap() { return ymult==2; } + + private: + Pixmap pixmap; + + int xmult,ymult; +}; + +#endif --- xjig-2.4.orig/global.h +++ xjig-2.4/global.h @@ -101,7 +101,7 @@ extern int maxsnapretries; // max. possible retries to snap the snapped extern class Puzzle *p; // Collection of all puzzle pieces -extern class GifPixmap *pm; // Original pixmap for the puzzle tiles +extern class XjigPixmap *pm; // Original pixmap for the puzzle tiles extern class Port *port; // Port (Display synonym) for color mapping extern class ObjectStack *stk; // administrator object for all viewable objects extern class ImageBuffer *img_buf;// memory for rotating image (probably shared) --- xjig-2.4.orig/fmt_image.C.stub +++ xjig-2.4/fmt_image.C.stub @@ -0,0 +1,70 @@ +#include +#include +#include + +#include "fmt_image.H" + +fmtImage::fmtImage(const char *filename, int autocrop ) + : Image(filename, autocrop) +{ + LoadImageFile( filename ); + if (autocrop) CropImage(); +} + +fmtImage::fmtImage() { + /*nothing*/ +} + +fmtImage::~fmtImage() { + /*nothing*/ +} + +/* This function may be omitted if the file format doesn't support it. Just + * delete the following line and the prototype in the corresponding .H file. */ +const char *fmtImage::GetExtensionData( unsigned char code ) { return 0; } + + +/* + LoadImageFile must fill in the following fields: + int width, height; // image dimensions + byte *data; // image data + byte Red[256], Green[256], Blue[256]; // Colormap-Data + boolean HasColormap; + int ColorMapSize; // number of colors + int Background; // background color + The data is one byte per pixel, the bytes index the Red[], Green[], and + Blue[] arrays, so you have 24-bit color with an 8-bit palette. If the + image format contains more than 256 distinct colors, LoadImageFile must + quantize it down to 256. You must malloc the data, but don't worry about + freeing it. The superclass will take care of that. + + If there are any errors opening the file or decoding the image, the best + that can be done is to print an error message to stderr and exit(). + + I'm not sure what the HasColormap field is for. In the GIF loader, it + might end up as 0 depending on the file headers. What kind of GIF doesn't + have a palette? Fortunately nothing outside the GIF loader uses it. I + decree that it shall be set to 1 by all loaders until I figure out what + it's good for. + + The Background field isn't used either, but it's probably a good idea to + set it. If your image file doesn't have a "background" color, call + DefaultBackground() after you've filled in all the other fields and one + will be chosen for you. + + The return value is also not used anywhere, but to be consistent with the + GIF loader you should return 0 to indicate success. + + If you prefer to open and close the image file yourself, you can take a + const char *filename arg instead of FILE *fp. If you take the FILE *fp + arg, all you have to do is read from it. + + Obviously, there is room for improvement in the interface. + */ +/*****************************/ +int fmtImage::LoadImageFile(FILE *fp) +/*****************************/ +{ + fprintf(stderr, "This file format is just a stub!\n"); + exit(1); +} --- xjig-2.4.orig/gif_image.C +++ xjig-2.4/gif_image.C @@ -42,7 +42,6 @@ #define DEBUG 0 #define quiet 1 -#define minpix 10 #define fastinfo_flag 0 void Extension::AddData( char *ndata, int nlen ) { @@ -55,40 +54,20 @@ } GifImage::GifImage(const char *filename, int autocrop ) -: lockcount(0) { + : Image(filename, autocrop) +{ first=0; - LoadGIF( filename ); - name = strrchr(filename,'/'); - if (name) name=strdup(name+1); - else name=strdup(filename); + LoadImageFile( filename ); if (autocrop&&!fastinfo_flag) CropImage(); } GifImage::GifImage() { first=0; - name=strdup("dummy"); - lockcount=0; - ColorMapSize=128; - for (int i=0;i<128;i++) { - Red[i] = 255 * ((i>>5)&0x03) / 3; - Green[i] = 255 * ((i>>2)&0x07) / 7; - Blue[i] = 255 * (i&0x03) / 3; - } - width =1; - height=1; - data =(byte*)malloc(1); } GifImage::~GifImage() { - if (lockcount) { - fprintf( stderr, "ERROR: GifImage::~GifImage: image still locked\n" ); - } - if (first) delete first; - - free(name); - CloseGif(); } const char *GifImage::GetExtensionData( unsigned char code ) { @@ -100,156 +79,6 @@ return 0; } -int GifImage::GetColor(int id, unsigned short *red, unsigned short *green, unsigned short *blue) { - *red =Red[id] | Red[id]<<8; - *green=Green[id] | Green[id]<<8; - *blue =Blue[id] | Blue[id]<<8; - return 0; -} - -void GifImage::Recolor( class GifImage *gif_p ) { -int mapper[256]; -int i,j; - - for (i=0;iColorMapSize;j++) { - int dr = (gif_p->Red[j] -Red[i]); - int dg = (gif_p->Green[j]-Green[i]); - int db = (gif_p->Blue[j] -Blue[i]); - int d = dr*dr + dg*dg + db*db; - if (dColorMapSize;j++) { - Red[j] = gif_p->Red[j]; - Green[j] = gif_p->Green[j]; - Blue[j] = gif_p->Blue[j]; - } - ColorMapSize = gif_p->ColorMapSize; -} - -void GifImage::Rotate90() { -byte *ndata; -int help; - - if (!(ndata = (byte *)malloc(width*height))) { - fprintf(stderr,"not enough memory to flip image"); - exit(-1); - } - - for (int y=0;yWidth(); -int y22=y21+gif_p->Height(); - -int nwidth,nheight; -byte *ndata=0; - - if (x21>=0) { - if (x22>Width()) nwidth=x22; - else nwidth=Width(); - } - else { - if (x22>Width()) nwidth=gif_p->Width(); - else nwidth=(-x21)+Width(); - } - if (y21>=0) { - if (y22>Height()) nheight=y22; - else nheight=Height(); - } - else { - if (y22>Height()) nheight=gif_p->Height(); - else nheight=(-y21)+Height(); - } - - if (nwidth>Width()||nheight>Height()) { - if (!(ndata = (byte *)malloc(nwidth*nheight))) { - fprintf(stderr,"not enough memory for image"); - exit(-1); - } - - /* move first image */ - memset( ndata, 0, nwidth*nheight ); - int offx = (x21<0)?-x21:0; - int offy = (y21<0)?-y21:0; - for (int y=0;yColorMapSize ); - for (int i=0;iColorMapSize;i++) { - printf( "%3d: %02x %02x %02x %02x %02x %02x\n", i, - Red[i], Green[i], Blue[i], - gif_p->Red[i], gif_p->Green[i], gif_p->Blue[i] ); - } -#endif - - int offx = (x21>=0)?x21:0; - int offy = (y21>=0)?y21:0; - for (int y=0;yHeight();y++) { - memcpy( ndata+offx+(offy+y)*nwidth, gif_p->data+y*gif_p->Width(), gif_p->Width() ); - } - - if (ndata!=data) { - free(data); - data = ndata; - height = nheight; - width = nwidth; - } -} - -void GifImage::AddLock(class GifXImage * /*locker*/ ) { - lockcount++; -} -void GifImage::RemoveLock(class GifXImage * /*locker*/ ) { - if (!--lockcount) { - delete this; - } -} - -void GifImage::GetSize( int *w, int *h ) { - *w = Width(); - *h = Height(); -} - -long GifImage::GetAverageColor() { -long erg; -int i; - - erg=0; - for (i=Width()*Height();i>0;i--) { - erg+=10*Red[*data]; - erg+=5*Green[*data]; - erg+=Blue[*data]; - data++; - } - return erg; -} - #define IMAGESEP 0x2c #define EXTENSION 0x21 #define INTERLACEMASK 0x40 @@ -290,7 +119,7 @@ /*****************************/ -int GifImage::LoadGIF(const char *fname) +int GifImage::LoadImageFile(const char *fname) /*****************************/ { register byte ch; @@ -313,8 +142,8 @@ if ( (fread(gifheader, sizeof(gifheader), 1, fp)!=1) || ( (strncmp((char*)gifheader, id, 3)!=0) && (strncmp((char*)gifheader, "FIG", 3)!=0) ) ) - { fprintf(stderr,"'%s' not a GIF file\n", fname ); - return 1; + { fprintf(stderr,"'%s' not a GIF, JPG or PPM file\n", fname ); + exit(1); } if (strncmp((char*)gifheader+3, "87a", 3) && strncmp((char*)gifheader+3,"89a",3)) @@ -403,106 +232,6 @@ return 0; } -int GifImage::CropImage(int x1,int y1, int x2, int y2) { -int w = x2-x1; -int h = y2-y1; - - if (x1<0 || x2>width || w<0 || y1<0 || y2>height || h<0) { - fprintf(stderr,"unable to crop (%d,%d)-(%d,%d)\n", x1,y1,x2,y2); - fprintf(stderr,"image size: %dx%d\n", width, height ); - exit(-1); - } - - for (int i=0;i=minpix) break; - } - } - if (count>=minpix) break; - y1=i; - } - for (i=Height()-1;i>=0; i--) { - int flag[256]; - int count=0; - ptr = data + (i*Width()); - for (j=0;j<256;j++) flag[j]=0; - for (j=0; j=minpix) break; - } - } - if (count>=minpix) break; - y2=i; - } - - for (i=0; i=minpix) break; - } - } - if (count>=minpix) break; - x1=i; - } - for (i=Width()-1;i>=0;i--) { - int flag[256]; - int count=0; - ptr = data + i; - for (j=0;j<256;j++) flag[j]=0; - for (j=0; j=minpix) break; - } - } - if (count>=minpix) break; - x2=i; - } - - x1++; x2--; y1++; y2--; - if (x2<=x1||y2<=y1) return 1; - - CropImage(x1,y1,x2,y2); - return 0; -} - int GifImage::DecodeImage() { /* Start reading the raster data. First we get the intial code size @@ -709,31 +438,3 @@ } NumUsed=0; } - - -void GifImage::CloseGif() -{ -#if (0) - if (LocalCmap) - { - XFreeColormap(theDisp, LocalCmap); - LocalCmap=0; - } - else - { - int i,j; - unsigned long pixels[256]; - - for (j=i=0;i. + +This package was put together by Dave Holland +from sources obtained from ftp.x.org:/contrib/games/xjig-2.4.tgz + +For changes made to the source for the Debian version of xjig, see +the file /usr/share/doc/xjig/changelog.Debian.gz + +For copyright information, see the file /usr/share/doc/xjig/copyright + +This package includes "xjig-random", a perl script which runs xjig with +a random image from /usr/share/games/xjig/* . This script is called by +xjig's Debian menu entry. + +Dave Holland --- xjig-2.4.orig/debian/menu +++ xjig-2.4/debian/menu @@ -0,0 +1 @@ +?package(xjig):needs="x11" section="Games/Puzzles" title="Xjig" command="/usr/games/xjig-random" --- xjig-2.4.orig/debian/desktop +++ xjig-2.4/debian/desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Name=xjig +Comment=A jigsaw puzzle +Exec=/usr/games/xjig-random +#Icon=none +Terminal=false +Type=Application +Categories=Game; --- xjig-2.4.orig/debian/dirs +++ xjig-2.4/debian/dirs @@ -0,0 +1,3 @@ +/usr/games +/usr/lib/games/xjig +/usr/man/man6 --- xjig-2.4.orig/debian/changelog +++ xjig-2.4/debian/changelog @@ -0,0 +1,144 @@ +xjig (2.4-14) unstable; urgency=low + + * Added .desktop file (closes: #708581) + + -- Dave Holland Tue, 21 May 2013 11:58:30 +0100 + +xjig (2.4-13) unstable; urgency=low + + * Minimal fix for FTBFS (closes: #560447) + * Move example image to /usr/share/games/xjig to keep Lintian happy + + -- Dave Holland Wed, 13 Jan 2010 14:38:00 +0000 + +xjig (2.4-12) unstable; urgency=low + + * Build-depends on xutils-dev (closes: #485550) + * xjig-random now handles spaces in filenames (closes: #422018) + * No longer build-depends on x-dev (closes: #515416) + * Don't allow piece flipping in single sided mode (thanks, Ben + Armstrong) (closes: #417902) + + -- Dave Holland Tue, 05 May 2009 15:24:17 +0100 + +xjig (2.4-11.1) unstable; urgency=low + + * NMU + * debian/rules: Adapt to new imake behaviour of installing stuff to /usr/bin + (Closes: #373693) + * Do menu file transition, install it in /usr/share/menu + + -- Marc 'HE' Brockschmidt Thu, 15 Jun 2006 10:44:42 +0200 + +xjig (2.4-11) unstable; urgency=low + + * update xlibs-dev build dependency (thanks, John Wright) + (closes: #346404) + + -- Dave Holland Tue, 10 Jan 2006 12:03:26 +0000 + +xjig (2.4-10) unstable; urgency=low + + * the /usr/doc symlink is no more (closes: #345282) + + -- Dave Holland Fri, 6 Jan 2006 13:27:32 +0000 + +xjig (2.4-9) unstable; urgency=low + + * increased the delay threshold on middle-click (thanks to Richard + Fojta for the suggestion) + * now supports JPEG and PPM images (many thanks to Alan Curry for + the patch) (closes: #239134) + * rebuilt with g++ 4.0.2-4 + + -- Dave Holland Fri, 2 Dec 2005 13:00:45 +0000 + +xjig (2.4-8) unstable; urgency=low + + * rebuilt in "sid" using g++ 3.3 (closes: #210502). + + -- Dave Holland Thu, 18 Sep 2003 13:18:34 +0000 + +xjig (2.4-7) unstable; urgency=low + + * change build-depends to xlibs-dev (closes: #170143). + * support DEB_BUILD_OPTIONS + * now conforms to Standards 3.5.8.0 + + -- Dave Holland Mon, 25 Nov 2002 14:03:23 +0000 + +xjig (2.4-6) unstable; urgency=low + + * Added detail to man page (closes #139281). + * Fixed segfault with various command line arguments. + * Fixed mode of xjig-random (closes #96000). + * Used Carl Johnson's idea for better randomness (closes #137436). + * Fixed some small errors in README.debian. + + -- Dave Holland Thu, 3 Oct 2002 17:08:30 +0100 + +xjig (2.4-5.1) unstable; urgency=medium + + * Non-maintainer upload. + * Added Build-Depends, fixes Bug#84647. + + -- Lenart Janos Sat, 24 Feb 2001 02:28:59 +0100 + +xjig (2.4-5) frozen unstable; urgency=low + + * Added Yann Dirson's patch for xjig-random (fixes #43599). + * Conforms to Standards 3.1.1.1. + * Changed maintainer email address. + + -- Dave Holland Thu, 13 Jan 2000 13:37:29 +0000 + +xjig (2.4-4.1) unstable; urgency=low + + * Non-maintainer upload during bug-squashing party. + * Recompilation with new libstdc++2.10 (closes #53218). + + -- Christian Kurz Sat, 8 Jan 2000 15:34:54 +0100 + +xjig (2.4-4) unstable; urgency=low + + * debian/rules: changed "cp" to "install" for postinst, postrm + (fixes #40161) -- thanks to Roman Hodek. + + -- Dave Holland Fri, 25 Jun 1999 09:21:50 +0100 + +xjig (2.4-3) unstable; urgency=low + + * Exits gracefully if supplied image is not a GIF (fixes #10666). + * Added menu file, call update-menus (fixes #15063). + * Added xjig-random (fixes #24476). + * Compiled with g++ 2.91.60-5 (egcs) (fixes #29075). + + -- Dave Holland Tue, 22 Jun 1999 17:34:12 +0100 + +xjig (2.4-2.2) frozen unstable; urgency=low + + * Non maintainer upload. + * Recompiled with g++/libstdc++2.9. + * debian/rules: Set CXX. + * Install debian/changelog. + * Install xjig into /usr/games. + + -- Matthias Klose Mon, 14 Dec 1998 14:38:47 +0200 + +xjig (2.4-2.1) unstable; urgency=low + + * Non-maintainer release. + * Libc6 compile. + + -- Martin Mitchell Wed, 12 Nov 1997 04:38:05 +1100 + +xjig (2.4-2) unstable; urgency=low + + * Source package now conforms to Debian Standards 2.1.0.0 (fixes #9520) + * Changed maintainer email address + + -- Dave Holland Mon, 12 May 1997 13:18:47 +0100 + +Local variables: +mode: debian-changelog +End: --- xjig-2.4.orig/debian/copyright +++ xjig-2.4/debian/copyright @@ -0,0 +1,73 @@ +This package was debianized by Dave Holland dave@zenda.demon.co.uk on +Mon, 12 May 1997 13:18:47 +0100. + +It was downloaded from ftp.x.org:/contrib/games/xjig-2.4.tgz + +Copyright: + + Copyright 1996, Helmut Hoenig, Heiligenhaus/Bad Camberg + + email (for any comments): + Helmut.Hoenig@hub.de + + smail (for gifts :-) + Helmut Hoenig + Hopfenstrasse 8a + 65520 Bad Camberg + GERMANY + + ******************************************************** + + By the way, I am collecting banknotes! If you want + to join into my collection, get any bill of your + country, sign it on the backside and send it to me + so I will pin it on my world map. + (Don't forget the exact location for the pin :-) + But you can also just send me a picture postcard ... + + ******************************************************** + + Permission to use, copy, modify, and distribute this soft- + ware for any purpose and without fee is hereby granted, + provided that the above copyright notice appear in all + copies + + ----------------------------------------------------------------------------- + + The demo picture supplied with the package + (which I can set together by heart in the meantime) + was taken from Panorama-Disk 124 with license free photo's by + + Dr. Lothar Rossipaul + Verlagsgesellschaft mbH + Menzinger Str. 37 + 80638 München + + ----------------------------------------------------------------------------- + + The loading routine for gif images was extracted from the gif-loader + of the xv-package. It was rearranged, enclosed into a C++-class and + enhanced to use extension data for some game specific features. + + Here is the copyright note, that was contained in the original loader: + +| xvgif.c - GIF loading code for 'xv'. Based strongly on... +| +| gif2ras.c - Converts from a Compuserve GIF (tm) image to a Sun Raster image. +| +| Copyright (c) 1988, 1989 by Patrick J. Naughton +| +| Author: Patrick J. Naughton +| naughton@wind.sun.com +| +| Permission to use, copy, modify, and distribute this software and its +| documentation for any purpose and without fee is hereby granted, +| provided that the above copyright notice appear in all copies and that +| both that copyright notice and this permission notice appear in +| supporting documentation. +| +| This file is provided AS IS with no warranties of any kind. The author +| shall have no liability with respect to the infringement of copyrights, +| trade secrets or any patents by this file or any part thereof. In no +| event will the author be liable for any lost revenue or profits or +| other special, indirect and consequential damages. --- xjig-2.4.orig/debian/rules +++ xjig-2.4/debian/rules @@ -0,0 +1,97 @@ +#!/usr/bin/make -f +# Sample debian.rules file - for GNU Hello (1.3). +# Copyright 1994,1995 by Ian Jackson. +# I hereby give you perpetual unlimited permission to copy, +# modify and relicense this file, provided that you do not remove +# my name from the file itself. (I assert my moral right of +# paternity under the Copyright, Designs and Patents Act 1988.) +# This file may have to be extensively modified + +package=xjig +CXX=c++ -g -Wall +INSTALL = install +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) + INSTALL += -s +endif +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CXX += -O0 +else + CXX += -O2 +endif + + + +build: + $(checkdir) + xmkmf # djh + make depend # djh + cp xjig.man xjig.6 + if [ -x configure ]; then ./configure --prefix=/usr; fi + make CXX="$(CXX)" + + touch build + +clean: + $(checkdir) + -rm -f build + -rm -f xjig xjig.6 + [ ! -f Makefile ] || $(MAKE) clean + -rm `find . -name "*~"` + -rm -rf debian/tmp debian/files* core debian/substvars + +binary-indep: checkroot build + $(checkdir) +# There are no architecture-independent files to be uploaded +# generated by this package. If there were any they would be +# made here. + +binary-arch: checkroot build + $(checkdir) + -rm -rf debian/tmp + install -d debian/tmp/DEBIAN debian/tmp/usr/share/doc/xjig debian/tmp/usr/share/man/man6 + if [ -x configure ]; then \ + make install CXX="$(CXX)" prefix=`pwd`/debian/tmp/usr ;\ + else \ + make install CXX="$(CXX)" DESTDIR=`pwd`/debian/tmp; \ + fi + mkdir -p debian/tmp/usr/share/games/xjig + cp tina.gif debian/tmp/usr/share/games/xjig + cp README* debian/README.debian debian/tmp/usr/share/doc/xjig + cp debian/changelog debian/tmp/usr/share/doc/xjig/changelog.Debian + mkdir -p debian/tmp/usr/share/menu + cp debian/menu debian/tmp/usr/share/menu/xjig + mkdir -p debian/tmp/usr/share/applications + cp debian/desktop debian/tmp/usr/share/applications/xjig.desktop + gzip -9v debian/tmp/usr/share/doc/xjig/* + cp debian/copyright debian/tmp/usr/share/doc/xjig + cp xjig.6 debian/tmp/usr/share/man/man6 + cp xjig-random.man debian/tmp/usr/share/man/man6/xjig-random.6 + gzip -9v debian/tmp/usr/share/man/man6/* + mkdir -p debian/tmp/usr/games + chmod a+rx xjig-random + cp xjig-random debian/tmp/usr/games + $(INSTALL) debian/tmp/usr/bin/xjig debian/tmp/usr/games/. + rm -rf debian/tmp/usr/bin + install -m 755 debian/prerm debian/postinst debian/postrm debian/tmp/DEBIAN + dpkg-shlibdeps debian/tmp/usr/games/xjig + dpkg-gencontrol -isp + chown -R root.root debian/tmp + chmod -R go=rX debian/tmp + dpkg --build debian/tmp .. + +define checkdir + test -f debian/rules +endef + +# Below here is fairly generic really + +binary: binary-indep binary-arch + +source diff: + @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false + +checkroot: + $(checkdir) + test root = "`whoami`" + +.PHONY: binary binary-arch binary-indep clean checkroot --- xjig-2.4.orig/debian/prerm +++ xjig-2.4/debian/prerm @@ -0,0 +1,6 @@ +#!/bin/sh +set -e + +if [ \( "$1" = "upgrade" -o "$1" = "remove" \) -a -L /usr/doc/xjig ]; then + rm -f /usr/doc/xjig +fi --- xjig-2.4.orig/debian/control +++ xjig-2.4/debian/control @@ -0,0 +1,21 @@ +Source: xjig +Section: games +Priority: optional +Maintainer: Dave Holland +Standards-Version: 3.5.8.0 +Build-Depends: libx11-dev, libxext-dev, libnetpbm10-dev, libjpeg-dev, xutils-dev + +Package: xjig +Architecture: any +Depends: ${shlibs:Depends} +Description: An X11 jigsaw puzzle + xjig is a puzzle that tries to replicate a jigsaw puzzle on the screen + as closely as possible. Any GIF, JPEG or PPM image may be loaded and cut + into pieces. The goal (as with any jigsaw puzzle) is to reassemble the + original picture. + . + Tiles may be freely rotated by use of the mouse, flipped (for + double-sided puzzles) and even shown as shaped windows on the desktop + (fast machine/video card recommended for the latter!). An example image + is provided in /usr/share/games/xjig . +