Initial Commit

This commit is contained in:
juan 2021-08-02 21:45:24 +08:00
commit d4ac44b77c
34 changed files with 5897 additions and 0 deletions

99
ANNOUNCE Normal file
View File

@ -0,0 +1,99 @@
Since version 1.0 was very broken (released in a hurry) there
is bugfixing 1.1. Only known problem at the moment is that aaflip
don't work at non intel platforms. There is many fixes and also
some new features. Most notable are MS-DOS version, support for
all p?m file formats, user interface for aaflip and asciiview
script that browses many image formats using ImageMagick or NetPBM
tools.
What does this software do then ?
=================================
aview is an high quality ascii-art image(pnm) browser and
animation(fli/flc) player usefull especially with lynx browser.
Supports: dos (VGA + MDA), stdio, curses, slang, X11, gpm, linux-console
Features
========
o High quality ascii art rendering
o Portable
o Save into many formats (html, text, ansi, more/less etc...)
o Contrast, Bright, Gamma control
o Image zooming/unzooming
o Three dithering modes
o Hidden "bonus" features :)
o Inversion
o Support for bright, dim, inverse attributes/extended
character set
What is PNM file format?
========================
PNM if an graphics format similiar to GIF, JPEG, PNG, TIFF and
others. Aview uses it because of its simplicity. Many free or shareware
conversion tools from other graphics format exist (ImageMagick, NetPBM
for UNIX, alchemy for DOS and others.) So you should use aview to
browse images in many graphics format. UNIX version has script that
does conversion automatically (using eighter NetPBM (preffered way)
or ImageMagic conversion program. FIFO is used to do not waste your
disc space so conversion is fully transparent. Under DOS and other
operating systems you probably need to do it yourself.
ChangeLog
=========
o Fixed bugs in Makefile
o Do not require efence anymore
o Configure script
o Fixed memory leak in flip.c
o Hide cursor
o Extended documentation
o Faster animation preloading
o Uses faster memcpy/memset functions
o image.c now reads P1 - P6 file formats (pgm, ppm, pnm both raw/ascii)
o gifview obsoleted by asciiview - new script that uses eighter
imagemagick or netpbm tools to convert image using fifo.
So it is fast and saves memory/disk space
o Added some keys into aaflip - contrast, bright, gamma tunning etc.
Press 'H' for help
Where to find Aview
===================
Just join our mailing list: `aa@horac.ta.jcu.cz'. Send:
subscribe aa
to majordomo@horac.ta.jcu.cz
All programs covered under AA-project can be obtained at
`ftp://ftp.ta.jcu.cz://pub/aa'.
Or just browse our homepage at `http://www.ta.jcu.cz://aa'. A ton of
examples of ascii-art generated by aalib, pointers to other AA-Project
resources etc.
AA-Project
==========
dT8 8Tb
dT 8 8 Tb
dT 8 8 Tb
<PROJECT><PROJECT>
dT 8 8 Tb
dT 8 8 Tb
Three goals of AA-Project:
1. Port all important software (like Doom, Second Reality, X windows
etc..) on AA-lib.
2. Port AA-lib on all available platforms (mainly ZX-Spectrum and
Sharp).
3. Force IBM to start manufacturing MDA cards again.
AA-project was started by Jan Hubicka. In that times just a few
people knew about it. Then a new demo named BB has been relased to show
the power of AA-lib technology. Now the project is freely available and
anyone can help.

8
AUTHORS Normal file
View File

@ -0,0 +1,8 @@
Jan Hubicka <hubicka@freesoft.cz>
- Original code, maitainer
Kamil Toman <toman@artax.karlin.mff.cuni.cz>
- Maitenance of version 1.2
Ladislav Michl
- Number of fixes and improvements
Michael Bramer
- Debian package maitainer; author of manual pages.

339
COPYING Normal file
View File

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

25
ChangeLog Normal file
View File

@ -0,0 +1,25 @@
Changed in version 1.3
o Fixed asciiview script to properly fall back to imagemagick
o Added manual pages
o Converted to automake
o Fixed crashes and compilation problems.
Changes in version 1.2
o Updated for aalib-1.1
o Better 'u' menu
Changes in version 1.1
o Fixed bugs in Makefile
o Do not require efence anymore
o Configure script
o Fixed memory leak in flip.c
o Hide cursor
o Extended documentation
o Faster animation preloading
o Uses faster memcpy/memset functions
o image.c now reads P1 - P6 file formats (pgm, ppm, pnm both raw/ascii)
o gifview obsoleted by asciiview - new script that uses eighter
imagemagick or netpbm tools to convert image using fifo.
So it is fast and saves memory/disk space
o Added some keys into aaflip - contrast, bright, gamma tunning etc.
Press 'H' for help
Changes in version 1.0
o First version (released in a hurry and very broken)

12
INSTALL Normal file
View File

@ -0,0 +1,12 @@
To compile Aview at UNIX enviroment use:
./configure
make
make install
This should work in most cases. I believe.
MS-DOS users:
make -f Makefile.dos

6
Makefile.am Normal file
View File

@ -0,0 +1,6 @@
bin_PROGRAMS = aview aaflip
aview_SOURCES = image.c main.c shrink.c ui.c
aaflip_SOURCES = flip.c general.c
bin_SCRIPTS = asciiview
man_MANS = aview.1 asciiview.1
EXTRA_DIST = fli.h general.h shrink.h ui.h TODO README.flip ANNOUNCE aview.lsm image.h aview.1 asciiview.1 asciiview

438
Makefile.in Normal file
View File

@ -0,0 +1,438 @@
# Makefile.in generated automatically by automake 1.4 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = .
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
AALIB_CFLAGS = @AALIB_CFLAGS@
AALIB_CONFIG = @AALIB_CONFIG@
AALIB_LIBS = @AALIB_LIBS@
CC = @CC@
MAKEINFO = @MAKEINFO@
PACKAGE = @PACKAGE@
VERSION = @VERSION@
bin_PROGRAMS = aview aaflip
aview_SOURCES = image.c main.c shrink.c ui.c
aaflip_SOURCES = flip.c general.c
bin_SCRIPTS = asciiview
man_MANS = aview.1 asciiview.1
EXTRA_DIST = fli.h general.h shrink.h ui.h TODO README.flip ANNOUNCE aview.lsm image.h aview.1 asciiview.1 asciiview
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES =
PROGRAMS = $(bin_PROGRAMS)
DEFS = @DEFS@ -I. -I$(srcdir) -I.
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
aview_OBJECTS = image.o main.o shrink.o ui.o
aview_LDADD = $(LDADD)
aview_DEPENDENCIES =
aview_LDFLAGS =
aaflip_OBJECTS = flip.o general.o
aaflip_LDADD = $(LDADD)
aaflip_DEPENDENCIES =
aaflip_LDFLAGS =
SCRIPTS = $(bin_SCRIPTS)
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
man1dir = $(mandir)/man1
MANS = $(man_MANS)
NROFF = nroff
DIST_COMMON = README ./stamp-h.in AUTHORS COPYING ChangeLog INSTALL \
Makefile.am Makefile.in NEWS TODO aclocal.m4 config.h.in configure \
configure.in install-sh missing mkinstalldirs
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP_ENV = --best
SOURCES = $(aview_SOURCES) $(aaflip_SOURCES)
OBJECTS = $(aview_OBJECTS) $(aaflip_OBJECTS)
all: all-redirect
.SUFFIXES:
.SUFFIXES: .S .c .o .s
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
$(ACLOCAL_M4): configure.in
cd $(srcdir) && $(ACLOCAL)
config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
cd $(srcdir) && $(AUTOCONF)
config.h: stamp-h
@if test ! -f $@; then \
rm -f stamp-h; \
$(MAKE) stamp-h; \
else :; fi
stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES= CONFIG_HEADERS=config.h \
$(SHELL) ./config.status
@echo timestamp > stamp-h 2> /dev/null
$(srcdir)/config.h.in: $(srcdir)/stamp-h.in
@if test ! -f $@; then \
rm -f $(srcdir)/stamp-h.in; \
$(MAKE) $(srcdir)/stamp-h.in; \
else :; fi
$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOHEADER)
@echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null
mostlyclean-hdr:
clean-hdr:
distclean-hdr:
-rm -f config.h
maintainer-clean-hdr:
mostlyclean-binPROGRAMS:
clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
distclean-binPROGRAMS:
maintainer-clean-binPROGRAMS:
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(bindir)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
if test -f $$p; then \
echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
list='$(bin_PROGRAMS)'; for p in $$list; do \
rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
done
.c.o:
$(COMPILE) -c $<
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
mostlyclean-compile:
-rm -f *.o core *.core
clean-compile:
distclean-compile:
-rm -f *.tab.c
maintainer-clean-compile:
aview: $(aview_OBJECTS) $(aview_DEPENDENCIES)
@rm -f aview
$(LINK) $(aview_LDFLAGS) $(aview_OBJECTS) $(aview_LDADD) $(LIBS)
aaflip: $(aaflip_OBJECTS) $(aaflip_DEPENDENCIES)
@rm -f aaflip
$(LINK) $(aaflip_LDFLAGS) $(aaflip_OBJECTS) $(aaflip_LDADD) $(LIBS)
install-binSCRIPTS: $(bin_SCRIPTS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(bindir)
@list='$(bin_SCRIPTS)'; for p in $$list; do \
if test -f $$p; then \
echo " $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \
$(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
else if test -f $(srcdir)/$$p; then \
echo " $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \
$(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
else :; fi; fi; \
done
uninstall-binSCRIPTS:
@$(NORMAL_UNINSTALL)
list='$(bin_SCRIPTS)'; for p in $$list; do \
rm -f $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
done
install-man1:
$(mkinstalldirs) $(DESTDIR)$(man1dir)
@list='$(man1_MANS)'; \
l2='$(man_MANS)'; for i in $$l2; do \
case "$$i" in \
*.1*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
else file=$$i; fi; \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \
$(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \
done
uninstall-man1:
@list='$(man1_MANS)'; \
l2='$(man_MANS)'; for i in $$l2; do \
case "$$i" in \
*.1*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \
rm -f $(DESTDIR)$(man1dir)/$$inst; \
done
install-man: $(MANS)
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-man1
uninstall-man:
@$(NORMAL_UNINSTALL)
$(MAKE) $(AM_MAKEFLAGS) uninstall-man1
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -o $$here/TAGS)
mostlyclean-tags:
clean-tags:
distclean-tags:
-rm -f TAGS ID
maintainer-clean-tags:
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
-rm -rf $(distdir)
GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz
mkdir $(distdir)/=build
mkdir $(distdir)/=inst
dc_install_base=`cd $(distdir)/=inst && pwd`; \
cd $(distdir)/=build \
&& ../configure --srcdir=.. --prefix=$$dc_install_base \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) dist
-rm -rf $(distdir)
@banner="$(distdir).tar.gz is ready for distribution"; \
dashes=`echo "$$banner" | sed s/./=/g`; \
echo "$$dashes"; \
echo "$$banner"; \
echo "$$dashes"
dist: distdir
-chmod -R a+r $(distdir)
GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
-rm -rf $(distdir)
dist-all: distdir
-chmod -R a+r $(distdir)
GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
-rm -rf $(distdir)
distdir: $(DISTFILES)
-rm -rf $(distdir)
mkdir $(distdir)
-chmod 777 $(distdir)
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
flip.o: flip.c general.h fli.h
general.o: general.c general.h
image.o: image.c config.h
main.o: main.c image.h ui.h config.h
shrink.o: shrink.c image.h shrink.h
ui.o: ui.c shrink.h image.h
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
all-recursive-am: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
install-exec-am: install-binPROGRAMS install-binSCRIPTS
install-exec: install-exec-am
install-data-am: install-man
install-data: install-data-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS uninstall-man
uninstall: uninstall-am
all-am: Makefile $(PROGRAMS) $(SCRIPTS) $(MANS) config.h
all-redirect: all-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
$(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(bindir) \
$(DESTDIR)$(mandir)/man1
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
mostlyclean-am: mostlyclean-hdr mostlyclean-binPROGRAMS \
mostlyclean-compile mostlyclean-tags \
mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-hdr clean-binPROGRAMS clean-compile clean-tags \
clean-generic mostlyclean-am
clean: clean-am
distclean-am: distclean-hdr distclean-binPROGRAMS distclean-compile \
distclean-tags distclean-generic clean-am
distclean: distclean-am
-rm -f config.status
maintainer-clean-am: maintainer-clean-hdr maintainer-clean-binPROGRAMS \
maintainer-clean-compile maintainer-clean-tags \
maintainer-clean-generic distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
maintainer-clean: maintainer-clean-am
-rm -f config.status
.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile uninstall-binSCRIPTS install-binSCRIPTS \
install-man1 uninstall-man1 install-man uninstall-man tags \
mostlyclean-tags distclean-tags clean-tags maintainer-clean-tags \
distdir info-am info dvi-am dvi check check-am installcheck-am \
installcheck all-recursive-am install-exec-am install-exec \
install-data-am install-data install-am install uninstall-am uninstall \
all-redirect all-am all installdirs mostlyclean-generic \
distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

4
NEWS Normal file
View File

@ -0,0 +1,4 @@
News since version 1.2
- Turned to automake
- Bugfixes
- Compilation fixed on glibc2 based systems

111
README Normal file
View File

@ -0,0 +1,111 @@
What does this software do then ?
=================================
aview is an high quality ascii-art image(pnm) browser and
animation(fli/flc) player usefull especially with lynx browser.
Supports: dos (VGA + MDA), stdio, curses, slang, X11, gpm, linux-console
Features
========
o High quality ascii art rendering
o Portable
o Save into many formats (html, text, ansi, more/less etc...)
o Contrast, Bright, Gamma control
o Image zooming/unzooming
o Three dithering modes
o Hidden "bonus" features :)
o Inversion
o Support for bright, dim, inverse attributes/extended
character set
What is PNM file format?
========================
PNM if an graphics format similiar to GIF, JPEG, PNG, TIFF and
others. Aview uses it because of its simplicity. Many free or shareware
conversion tools from other graphics format exist (ImageMagick, NetPBM
for UNIX, alchemy for DOS and others.) So you should use aview to
browse images in many graphics format. UNIX version has script that
does conversion automatically (using eighter NetPBM (preffered way)
or ImageMagic conversion program. FIFO is used to do not waste your
disc space so conversion is fully transparent. Under DOS and other
operating systems you probably need to do it yourself.
Usage
=====
UNIX:
asciiview [filenames] [options]
to browse any image format supported by NetPBM or ImageMagick. Use OTHERS
way if you don't have installed these tools
options should be listed using aview or aaflip program when used w/o
parameters
OTHERS:
aview [options] [filename]
To browse pbm pgm ppm or pnm image.
aaflip [options] [filename]
to browse fli or flc animation
Once aview is started use 'H' for help about keys.
How this all started
====================
Once upon a time we've (my friend Kamil and I) bought two old
Herculeses as secondary monitors. We didn't know for that time that our
Diamond Stealths 64 cards would become obsolete soon. The next day we
downloaded the logo of Linux Texas Users Group - nice silly penguin
looking like a cowboy! It was so exciting logo ... we decided that we
couldn't live without it and we wanted to see it at boot time as a logo
on our secondary monitors. There was a small problem - Hercules doesn't
support color graphics. So we decided to convert the penguin image to
ascii art using netpbm tools.
The output was very ugly because the converting algorithm was
absolutly stupid. During the night I designed a new convertor that
used a font bitmap to creat an aproximation table. The output wasn't
very good since the algorithm wasn't tuned so well. Many months this
small piece of code was waiting on my disc for the day "D". Meanwhile I
started a new project XaoS (a fractal zoomer) with my friend Thomas.
And then I got an idea: Ascii Art Mandelbrots! I was really impressed
by the result! XaoS was faster, portable and looking much better than
ever before. I found a new way to go ...
AA-Project
==========
dT8 8Tb
dT 8 8 Tb
dT 8 8 Tb
<PROJECT><PROJECT>
dT 8 8 Tb
dT 8 8 Tb
Three goals of AA-Project:
1. Port all important software (like Doom, Second Reality, X windows
etc..) on AA-lib.
2. Port AA-lib on all available platforms (mainly ZX-Spectrum and
Sharp).
3. Force IBM to start manufacturing MDA cards again.
AA-project was started by Jan Hubicka. In that times just a few
people knew about it. Then a new demo named BB has been relased to show
the power of AA-lib technology. Now the project is freely available and
anyone can help.
Where to find Aview
===================
All programs covered under AA-project can be obtained at
`http://aa-project.sourceforge.net'.

98
README.flip Normal file
View File

@ -0,0 +1,98 @@
aaflip -- an ascii arted flic player for aalib
Version 0.3
This is modifies version of flip(flic animation file player, see bellow)
that works in text mode.
ORIGINAL FLIP README
====================
flip -- a flic file player for the Linux console
Version 0.3
By John Remyn
This is a non-X flic animation file player for Linux. A VGA compatible card
is required.
Flic files can usually be recognized by the .fli or .flc extensions at the
end of their filenames. Fli files are limited to a resolution of 320x200,
while flc files can have any resolution.
The binary requires svgalib to be installed (svgalib can be found at
sunsite.unc.edu: /pub/Linux/libs).
The default method of playing is to load the first frame of the animation
sequence and display it. After this the remainder of the flic file is loaded
into memory, and the animation starts. The animation ends when q or ctrl-c
is pressed. There are some flags that control the way the flic file is
handled:
-a Remove frames from memory after processing. Using this option
leaves more memory for other processes, but relies on the buffer
cache for continuous animation.
-b Process frames immediately as they are loaded. When using this
option the animation frames are shown as soon as the player has read
them, so you don't have to wait until the entire file has been
read. The disadvantage is that the animation becomes jumpy if the
speed set by the animation is higher than the speed of loading.
-c Keep the screen black while loading the animation. This conflicts
with option b, which can give interesting results.
-f This removes the clock synchronization. This is just for fun, so
you can show off the speed of your computer :-)
-n <number>
Play the flic file <number> times.
-s <delay>
Sets the delay between frames to <delay>*0.01 seconds. Option -s 0
is the same as -f.
- Causes flip to read the flic file from stdin. Using this with option
-a may cause trouble since backward seeks are done.
Other options are:
-v Shows some information about the flic file being played.
-? Shows a bit of help.
Flc files:
Flc files with resolutions higher than 320x200 are now supported, out of the
3 files I could find, 2 work OK, 1 works almost OK.
There are some considerations to be made when playing big flic files. If the
file fits completely into memory, there are no problems. However when memory
is short Linux swaps pages out of memory, which can happen while a frame is
being decoded. This is not only slow but also results in very ugly
animation. Animation improves when option -a is used, in which case there
will be much less swapping (there still is a lot of disk/buffer-cache access
going on though). Using option -b is also advisable since the animation
won't be smooth anyway.
Bugs:
- X and Y offsets are not handled.
- Flic files with resolutions smaller (or bigger) than the screen size are
probably not handled correctly, but I have yet to see one.
- At least one of the flc files I have displays a few pixels of trash in a
place where they should definately not be. This could be caused by
incorrect handling of a page break. When I feel motivated enough I'll try
and fix it.
Release history:
V0.3a Added support for FLC files with resolutions greater than 320x200.
(A real pain)
V0.2a Added decoding of DELTA_FLC chunks, so some flc files can also be
played. Changed the command line parameters. Removed some small
bugs.
V0.1 First release, only just capable of playing fli files.
John Remyn (author) (boogyman@xs4all.hacktic.nl may work soon)
Harm Hanemaayer hhanemaa@cs.ruu.nl (for mail)

1
TODO Normal file
View File

@ -0,0 +1 @@
o Make aaflip working at non intel platforms

297
aclocal.m4 vendored Normal file
View File

@ -0,0 +1,297 @@
dnl aclocal.m4 generated automatically by aclocal 1.4
dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
dnl PARTICULAR PURPOSE.
# Do all the work for Automake. This macro actually does too much --
# some checks are only needed if your package does certain things.
# But this isn't really a big deal.
# serial 1
dnl Usage:
dnl AM_INIT_AUTOMAKE(package,version, [no-define])
AC_DEFUN(AM_INIT_AUTOMAKE,
[AC_REQUIRE([AC_PROG_INSTALL])
PACKAGE=[$1]
AC_SUBST(PACKAGE)
VERSION=[$2]
AC_SUBST(VERSION)
dnl test to see if srcdir already configured
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
fi
ifelse([$3],,
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
AC_REQUIRE([AM_SANITY_CHECK])
AC_REQUIRE([AC_ARG_PROGRAM])
dnl FIXME This is truly gross.
missing_dir=`cd $ac_aux_dir && pwd`
AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
AC_REQUIRE([AC_PROG_MAKE_SET])])
#
# Check to make sure that the build environment is sane.
#
AC_DEFUN(AM_SANITY_CHECK,
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
echo timestamp > conftestfile
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
if test "[$]*" = "X"; then
# -L didn't work.
set X `ls -t $srcdir/configure conftestfile`
fi
if test "[$]*" != "X $srcdir/configure conftestfile" \
&& test "[$]*" != "X conftestfile $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
alias in your environment])
fi
test "[$]2" = conftestfile
)
then
# Ok.
:
else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
rm -f conftest*
AC_MSG_RESULT(yes)])
dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
dnl The program must properly implement --version.
AC_DEFUN(AM_MISSING_PROG,
[AC_MSG_CHECKING(for working $2)
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
if ($2 --version) < /dev/null > /dev/null 2>&1; then
$1=$2
AC_MSG_RESULT(found)
else
$1="$3/missing $2"
AC_MSG_RESULT(missing)
fi
AC_SUBST($1)])
# Like AC_CONFIG_HEADER, but automatically create stamp file.
AC_DEFUN(AM_CONFIG_HEADER,
[AC_PREREQ([2.12])
AC_CONFIG_HEADER([$1])
dnl When config.status generates a header, we must update the stamp-h file.
dnl This file resides in the same directory as the config header
dnl that is generated. We must strip everything past the first ":",
dnl and everything past the last "/".
AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
<<am_indx=1
for am_file in <<$1>>; do
case " <<$>>CONFIG_HEADERS " in
*" <<$>>am_file "*<<)>>
echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
;;
esac
am_indx=`expr "<<$>>am_indx" + 1`
done<<>>dnl>>)
changequote([,]))])
# Configure paths for AALIB
# Jan Hubicka 4/22/2001
# stolen from Sam Lantinga 9/21/99
# stolen from Manish Singh
# stolen back from Frank Belew
# stolen from Manish Singh
# Shamelessly stolen from Owen Taylor
dnl AM_PATH_AALIB([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Test for AALIB, and define AALIB_CFLAGS and AALIB_LIBS
dnl
AC_DEFUN(AM_PATH_AALIB,
[dnl
dnl Get the cflags and libraries from the aalib-config script
dnl
AC_ARG_WITH(aalib-prefix,[ --with-aalib-prefix=PFX Prefix where AALIB is installed (optional)],
aalib_prefix="$withval", aalib_prefix="")
AC_ARG_WITH(aalib-exec-prefix,[ --with-aalib-exec-prefix=PFX Exec prefix where AALIB is installed (optional)],
aalib_exec_prefix="$withval", aalib_exec_prefix="")
AC_ARG_ENABLE(aalibtest, [ --disable-aalibtest Do not try to compile and run a test AALIB program],
, enable_aalibtest=yes)
if test x$aalib_exec_prefix != x ; then
aalib_args="$aalib_args --exec-prefix=$aalib_exec_prefix"
if test x${AALIB_CONFIG+set} != xset ; then
AALIB_CONFIG=$aalib_exec_prefix/bin/aalib-config
fi
fi
if test x$aalib_prefix != x ; then
aalib_args="$aalib_args --prefix=$aalib_prefix"
if test x${AALIB_CONFIG+set} != xset ; then
AALIB_CONFIG=$aalib_prefix/bin/aalib-config
fi
fi
AC_PATH_PROG(AALIB_CONFIG, aalib-config, no)
min_aalib_version=ifelse([$1], ,0.11.0,$1)
AC_MSG_CHECKING(for AALIB - version >= $min_aalib_version)
no_aalib=""
if test "$AALIB_CONFIG" = "no" ; then
no_aalib=yes
else
AALIB_CFLAGS=`$AALIB_CONFIG $aalibconf_args --cflags`
AALIB_LIBS=`$AALIB_CONFIG $aalibconf_args --libs`
aalib_major_version=`$AALIB_CONFIG $aalib_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
aalib_minor_version=`$AALIB_CONFIG $aalib_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
aalib_micro_version=`$AALIB_CONFIG $aalib_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
if test "x$enable_aalibtest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $AALIB_CFLAGS"
LIBS="$LIBS $AALIB_LIBS"
dnl
dnl Now check if the installed AALIB is sufficiently new. (Also sanity
dnl checks the results of aalib-config to some extent
dnl
rm -f conf.aalibtest
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "aalib.h"
char*
my_strdup (char *str)
{
char *new_str;
if (str)
{
new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
strcpy (new_str, str);
}
else
new_str = NULL;
return new_str;
}
int main (int argc, char *argv[])
{
int major, minor, micro;
char *tmp_version;
/* This hangs on some systems (?)
system ("touch conf.aalibtest");
*/
{ FILE *fp = fopen("conf.aalibtest", "a"); if ( fp ) fclose(fp); }
/* HP/UX 9 (%@#!) writes to sscanf strings */
tmp_version = my_strdup("$min_aalib_version");
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
printf("%s, bad version string\n", "$min_aalib_version");
exit(1);
}
if (($aalib_major_version > major) ||
(($aalib_major_version == major) && ($aalib_minor_version > minor)) ||
(($aalib_major_version == major) && ($aalib_minor_version == minor) && ($aalib_micro_version >= micro)))
{
return 0;
}
else
{
printf("\n*** 'aalib-config --version' returned %d.%d.%d, but the minimum version\n", $aalib_major_version, $aalib_minor_version, $aalib_micro_version);
printf("*** of AALIB required is %d.%d.%d. If aalib-config is correct, then it is\n", major, minor, micro);
printf("*** best to upgrade to the required version.\n");
printf("*** If aalib-config was wrong, set the environment variable AALIB_CONFIG\n");
printf("*** to point to the correct copy of aalib-config, and remove the file\n");
printf("*** config.cache before re-running configure\n");
return 1;
}
}
],, no_aalib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
if test "x$no_aalib" = x ; then
AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
if test "$AALIB_CONFIG" = "no" ; then
echo "*** The aalib-config script installed by AALIB could not be found"
echo "*** If AALIB was installed in PREFIX, make sure PREFIX/bin is in"
echo "*** your path, or set the AALIB_CONFIG environment variable to the"
echo "*** full path to aalib-config."
else
if test -f conf.aalibtest ; then
:
else
echo "*** Could not run AALIB test program, checking why..."
CFLAGS="$CFLAGS $AALIB_CFLAGS"
LIBS="$LIBS $AALIB_LIBS"
AC_TRY_LINK([
#include <stdio.h>
#include "AALIB.h"
], [ return 0; ],
[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding AALIB or finding the wrong"
echo "*** version of AALIB. If it is not finding AALIB, you'll need to set your"
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
echo "*** to the installed location Also, make sure you have run ldconfig if that"
echo "*** is required on your system"
echo "***"
echo "*** If you have an old version installed, it is best to remove it, although"
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
[ echo "*** The test program failed to compile or link. See the file config.log for the"
echo "*** exact error that occured. This usually means AALIB was incorrectly installed"
echo "*** or that you have moved AALIB since it was installed. In the latter case, you"
echo "*** may want to edit the aalib-config script: $AALIB_CONFIG" ])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
AALIB_CFLAGS=""
AALIB_LIBS=""
ifelse([$3], , :, [$3])
fi
AC_SUBST(AALIB_CFLAGS)
AC_SUBST(AALIB_LIBS)
rm -f conf.aalibtest
])

73
asciiview Executable file
View File

@ -0,0 +1,73 @@
#!/bin/bash
# asciiview - an ascii art image browser script. Front end for aview/aaflip
clear()
{
kill $! 2>/dev/null
rm -f /tmp/aview$$.pgm 2>/dev/null
}
myconvert()
{
if anytopnm $1 >/tmp/aview$$.pgm 2>/dev/null ; then
exit
elif convert -colorspace gray $1 pgm:- 2>/dev/null ; then
exit
fi
echo "Failed to convert file format to PNM by both convert and anytopnm" >&2
while true; do
echo "0 "
done
}
filenames=""
options=""
if [ "$1" = "" ]; then
echo "$0 - an ascii art image/animation browser.
To run this script you need aview, aaflip and NetPBM or ImageMagick.
You may browse any graphics format supported by NetPBM or ImageMagick
and .fli/.flc files.
Usage:
$0 [options] [filenames]
type aview --help [enter] for list of options.
"
exit 1
fi
while [ "$1" != "" ]; do
case $1 in
"-font" | "-driver" | "-kbddriver" | "-mousedriver" | "-*width" | "-*height" | "-bright" | "-contrast" | "-gamma" | "-random" | "-dimmul" | "-boldmul")
options="$options $1 $2"
shift
shift
;;
-*)
options="$options $1"
shift
;;
*)
filenames="$filenames $1"
shift
;;
esac
done
trap clear 0
mkfifo /tmp/aview$$.pgm
outfile=/tmp/aview$$.pgm
for name in $filenames ; do
if test -r $name ; then
case $name in
*.fli | *.lfc | *.flic )
PATH="$PATH:."
aaflip $options $name
;;
*)
myconvert $name >/tmp/aview$$.pgm &
pid=$!
PATH="$PATH:."
aview $options /tmp/aview$$.pgm
kill $pid 2>/dev/null
esac
else
echo "$name could not be opended"
fi
done

44
asciiview.1 Normal file
View File

@ -0,0 +1,44 @@
.TH NAME SECTION
.\" NAME should be all caps, SECTION should be 1-8, maybe w/ subsection
.\" other parms are allowed: see man(7), man(1)
.SH NAME
aview \- An high quality ascii-art image(pgm) browser
.SH SYNOPSIS
.B aview
.I "[options] filename.p[ngbp]m"
.SH "DESCRIPTION"
This manual page documents briefly the
.BR aview ,
and
.B asciiview
commands.
This manual page was written for the Debian GNU/Linux distribution
because the original program does not have a manual page.
.PP
.B aview/asciiview
is a program that show files with ascii-art.
.B aview
support zooming/unzooming, three dithering modes, Inversion, Contrast, Bright,
Gamma control and can save into many formats (html, text, ansi, more/less
etc...). The
.B aview
can only show files in the PNM file format. But the
.B asciiview
program convert the file formats to PNM (with extern programs like NetPBM and
ImageMagic) and start
.B aview.
It's support the driver from the aalib. Normaly slang, x11 and stdout. It
support the mousedriver (X11 and gpm) too.
.SH OPTIONS
For a complete description, make only
.TP
.B aview
.TP
This show all option.
.SH "SEE ALSO"
.B bb
,
.B "aalib (info-page)"
.SH AUTHOR
This manual page was written by Michael Bramer <grisu@debian.org>,
for the Debian GNU/Linux system (but may be used by others).

44
aview.1 Normal file
View File

@ -0,0 +1,44 @@
.TH NAME SECTION
.\" NAME should be all caps, SECTION should be 1-8, maybe w/ subsection
.\" other parms are allowed: see man(7), man(1)
.SH NAME
aview \- An high quality ascii-art image(pgm) browser
.SH SYNOPSIS
.B aview
.I "[options] filename.p[ngbp]m"
.SH "DESCRIPTION"
This manual page documents briefly the
.BR aview ,
and
.B asciiview
commands.
This manual page was written for the Debian GNU/Linux distribution
because the original program does not have a manual page.
.PP
.B aview/asciiview
is a program that show files with ascii-art.
.B aview
support zooming/unzooming, three dithering modes, Inversion, Contrast, Bright,
Gamma control and can save into many formats (html, text, ansi, more/less
etc...). The
.B aview
can only show files in the PNM file format. But the
.B asciiview
program convert the file formats to PNM (with extern programs like NetPBM and
ImageMagic) and start
.B aview.
It's support the driver from the aalib. Normaly slang, x11 and stdout. It
support the mousedriver (X11 and gpm) too.
.SH OPTIONS
For a complete description, make only
.TP
.B aview
.TP
This show all option.
.SH "SEE ALSO"
.B bb
,
.B "aalib (info-page)"
.SH AUTHOR
This manual page was written by Michael Bramer <grisu@debian.org>,
for the Debian GNU/Linux system (but may be used by others).

31
aview.lsm Normal file
View File

@ -0,0 +1,31 @@
Begin3
Title: Aview - High qualitty ascii art renderer/animation player
Version: 1.3
Entered-date: Apr 25 2001
Description: aview is an high quality ascii-art image(pgm) browser and
animation(fli/flc) player usefull especially with
lynx browser.
Keywords: X11 ascii-art text cool art ironing cooking fire library c GNU
demo fun game fli pgm pnm
Author: hubicka@freesoft.cz (Jan Hubicka)
(Filip Kupsa)
titana@mbox.vol.cz (Mojmir Svoboda)
toman@horac.ta.jcu.cz (Kamil Toman)
Maintained-by: hubicka@freesoft.cz (Jan Hubicka)
Primary-site: sunsite.unc.edu /pub/Linux/apps/graphics/viewers
aview-1.3.tar.gz
Alternate-site: tsx-11.mit.edu /pub/linux/sources/usr.bin
aview-1.3.tar.gz
Platform: dos (VG + MDA), stdio, curses, slang, X11, gpm, linux-console
Sound: OSS, Sun audio, SGI, DEC Aplha, AIX, HP-UX, DOS
(GUS CLASSIC, GUS CLASSIC, GUS MAX, GUS ACE, GUS PNP,
SB, ESS, PC-buzzer)
Copying-policy: GNU GENERAL PUBLIC LICENSE
End

14
config.h.in Normal file
View File

@ -0,0 +1,14 @@
/* config.h.in. Generated automatically from configure.in by autoheader. */
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if you have the isatty function. */
#undef HAVE_ISATTY
/* Name of package */
#undef PACKAGE
/* Version number of package */
#undef VERSION

1951
configure vendored Executable file

File diff suppressed because it is too large Load Diff

20
configure.in Normal file
View File

@ -0,0 +1,20 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(main.c)
AM_INIT_AUTOMAKE(aview, 1.3.0)
AM_CONFIG_HEADER(config.h)
use_cc_g_flag=no
AC_PROG_CC
AC_PROG_INSTALL
AC_HEADER_STDC
dnl Checks for programs.
AC_PROG_MAKE_SET
AC_CHECK_FUNCS(isatty)
dnl Check for AA-lib
AM_PATH_AALIB(1.4.0, , AC_MSG_ERROR([*** AALIB >= 1.4.0 not installed - please install first ***]))
CFLAGS="$CFLAGS $AALIB_CFLAGS"
LIBS="$CLFAGS $AALIB_LIBS"
AC_OUTPUT(Makefile)

46
fli.h Normal file
View File

@ -0,0 +1,46 @@
#define FLITYPE 0xAF11
#define FLCTYPE 0xAF12
#define COLOR_256 4
#define DELTA_FLC 7
#define COLOR_64 11
#define DELTA_FLI 12
#define BLACK 13
#define BYTE_RUN 15
#define LITERAL 16
#define PSTAMP 18
/* Structure of flic file header. Fields with + before the comment are FLC only. */
struct FLI_HEADER {
long size; /* size of entire file */
unsigned short int type; /* 0xAF12 = FLC, 0xAF11 = FLI */
short int frames; /* number of frames in flic */
short int width; /* screen width in pixels */
short int height; /* sceen height in pixels */
short int depth; /* bits per pixel (always 8) */
unsigned short int flags; /* set to 0x0003 */
long speed; /* time delay between frames, FLI: 1/70thsec, FLC: msec */
short int reserved0; /* set to 0 */
long created; /*+ MS-DOS formatted date and time of creation */
long creator; /*+ Animator Pro serial number */
long updated; /*+ date of last update */
long updater; /*+ Serial number of updating program */
short int aspectx; /*+ ratio of screen used to create flic */
short int aspecty; /*+ */
char reserved1[38]; /*+ 38 bytes set to 0 */
long oframe1; /*+ file offset of first frame */
long oframe2; /*+ file offset of second frame */
char reserved2[40]; /* 40 bytes set to 0 */
};
#define FLI_HEADERLEN ( sizeof( struct FLI_HEADER ) )
struct FLI_CHUNK_HEADER {
long size; /* size of chunk */
short unsigned int type; /* chunk type */
short unsigned int chunks; /* number of subchunks */
char reserved[8]; /* set to 0 */
};
#define FLI_CHUNK_HEADERLEN ( sizeof( struct FLI_CHUNK_HEADER ) )

920
flip.c Normal file
View File

@ -0,0 +1,920 @@
/* Copyright 1993 J. Remyn */
/* This program is freely distributable, but there is no warranty */
/* of any kind. */
/* version 0.3 */
/* Modified for aaflip version 1.0 by Jan Hubicka*/
#include <stdlib.h>
#include <stdio.h>
#include <sys/time.h>
#include <unistd.h>
#include <aalib.h>
#include "general.h"
#include "fli.h"
#define NAMELEN 256
struct OPTIONS {
char filename[NAMELEN]; /* filename given on command line */
char fast; /* 1 = play without delays */
char verbose; /* 1 = show info about flic file */
char release; /* 1 = don't keep frames in memory */
char firstp; /* 1 = process frames while loading */
char blank; /* 1 = keep black screen while loading */
char stdinp; /* 1 = take flic file from stdin */
int speed; /* speed gotten from command line (-1 if nothing gotten) */
int playrep; /* nr of times to play animation */
} options;
struct FLI_FRAMECHUNK {
long size; /* Size of chunk data part */
long file_offset; /* Offset of chunk data part into flic file */
int subchunks; /* Number of subchunks in data part */
void *cd; /* Pointer to memory containing data part, */
/* is NULL if data not kept in memory */
};
struct FLI {
char filename[NAMELEN]; /* filename of fli file */
char flc; /* 0 = fli, 1 = flc */
int mode; /* vgalib mode number to be used */
int scr_width; /* width of screen mode used */
int scr_height; /* guess */
int current; /* current frame index */
long time; /* time of last processed frame in usec */
FILE *f; /* file pointer of opened flic file */
struct FLI_HEADER h; /* 128 byte fli file header structure */
struct FLI_FRAMECHUNK *frame;
/* pointer to an allocated 'array' of
<frames> FLI_FRAMECHUNK structs */
} fli;
static aa_palette pal;
static aa_context *context;
static aa_renderparams *params;
static char *graph_mem;
static void dcd_color_64( char *data ) {
uchar start = 0;
int ops;
int count;
int i;
/* puts( "color_64" ); */
ops = *(short int *)data;
data = (void *)(((short int *)data) + 1);
while( ops-- > 0 ) {
start += *(uchar *)data;
data = (void *) ((uchar *)data + 1);
if( (count = (int)*(uchar *)data) == 0 )
count = 256;
data = (void *) ((uchar *)data + 1);
for( i=0; i<count; i++ ) {
/* (s)vgalib requires a table of ints for setting a group
* of colors quickly, but we've got a table of chars :(
* so we have to set each color individually (slow) */
aa_setpalette(pal, start + i,
((int)*(uchar *)data)*4,
((int)*((uchar *)data+1)*4),
((int)*((uchar *)data+2)*4)
);
data = (void *)((uchar *)data + 3);
}
start += count;
}
}
static void dcd_color_256( char *data ) {
uchar start = 0;
int ops;
int count;
int i;
/* puts( "color_256" ); */
ops = *(short int *)data;
data = (void *)((short int *)data + 1);
while( ops-- > 0 ) {
start += *(uchar *)data;
data = (void *)((uchar *)data + 1);
if( (count = (int)*(uchar *)data) == 0 )
count = 256;
data = (void *)((uchar *)data + 1);
for( i=0; i<count; i++ ) {
aa_setpalette(pal, start + i,
*(uchar *)data >> 2,
*((uchar *)data+1) >> 2,
*((uchar *)data+2) >> 2
);
data = (void *)((uchar *)data + 3);
}
start += count;
}
}
void *memsetw( unsigned short *target, unsigned short w, int count ) {
while( count-->0 ) {
*target++ = w;
}
return( target );
}
static void dcd_delta_flc( struct FLI *fli, char *data ) {
short int line;
short int nrlines;
char *index;
short packets;
short type;
int x;
uchar lastbyte;
char setlastbyte;
/* puts( "delta flc" ); */
/* get nr of lines in chunk */
nrlines = *(short int *)data;
data = (void *)((short int *)data + 1);
line = 0;
setlastbyte = 0;
lastbyte = 0; /* this is just to get rid of a compiler warning */
index = graph_mem;
while( nrlines>0 ) { /* don't put nrlines-- here, the continues don't allow it */
type = *(short *)data;
data = (void *)((short *)data + 1);
/* the 2 highest bits of type indicate how to interpret it */
if( type<0 ) {
if( type&0x4000 ) {
/* add to the line number and act as if nothing
* happened.
* documentation says it's all right just to
* add the abs. value of the word, which is the
* same as subtracting the word as it is always
* negative.
*/
line -= type;
index += fli->scr_width * (-type);
continue;
}
/* the low byte contains a lastbyte (the last byte
* on a line in odd-width resolution flic files),
* this word is followed by the packet count
*/
setlastbyte = 1;
lastbyte = (uchar)(type & 0x00FF);
packets = *(short *)data;
data = (void *)((short *)data + 1);
/* packets can be 0 now if just the last byte
* changes for this line
*/
}
if( type>=0 ) {
/* the word contains the nr of packets
* we can just assign this to packets because the
* high bits are zero
*/
packets = type;
}
/* decode packets */
x = 0;
while( packets-->0 ) {
/* get & decode packet */
x += *(uchar *)data;
data = (void *)((uchar *)data + 1);
type = *(char *)data;
data = (void *)((uchar *)data + 1);
if( (char)type>=0 ) {
/* copy ptype words */
type <<= 1;
memcpy( index + x, data, type );
x += type;
data = (void *)((uchar *)data + type);
continue;
}
type = -(char)type;
memsetw( (ushort *)(index + x), *(ushort *)data, type );
x += type<<1;
data = (void *)((ushort *)data + 1);
}
if( !setlastbyte ) {
index = (char *)((uchar *)index + fli->scr_width);
nrlines--;
continue;
}
/* put lastbyte at end of line */
*(uchar *)(index + fli->scr_width - 1) = lastbyte;
setlastbyte = 0;
index = (char *)((uchar *)index + fli->scr_width);
nrlines--;
}
}
static void dcd_delta_fli( struct FLI *fli, char *data ) {
short int line;
short int nrlines;
char *index;
uchar packets;
int index_x;
char type;
/* puts( "delta fli" ); */
line = *(short int *)data;
data = (void *)((short int *)data + 1);
index = graph_mem + line * fli->scr_width;
nrlines = *(short int *)data;
data = (void *)((short int *)data + 1);
while( nrlines-- > 0 ) {
index_x = 0;
packets = *(uchar *)data;
data = (void *)((uchar *)data + 1);
while( packets > 0 ) {
index_x += *(uchar *)data;
data = (void *)((uchar *)data + 1);
type = *(char *)data;
data = (void *)((char *)data + 1);
if( type >= 0 ) {
memcpy( index + index_x, data, type );
index_x += type;
data = (void *)((uchar *)data + type);
packets--;
continue;
}
memset( index + index_x, *(uchar *)data, -type );
index_x -= type;
data = (void *)((uchar *)data + 1);
packets--;
}
index += fli->scr_width;
}
}
static void dcd_byte_run( struct FLI *fli, char *data ) {
int lines;
int width;
char type;
int index;
int index_x;
/* puts( "byte run" ); */
lines = fli->h.height;
width = fli->h.width;
index = 0;
while( lines-->0 ) {
data = (void *)((uchar *)data + 1); /* skip byte containing number of packets */
/* start a loop to decode packets until end of line is reached */
index_x = 0;
while ( index_x < width ) {
type = *((char *)data++);
if( type<0 ) {
/* type now contains nr of bytes to copy to video */
memcpy( graph_mem + index + index_x, (uchar *)data, -type );
index_x -= type;
data = (void *)((uchar *)data - type);
}
else {
memset( graph_mem + index + index_x, *(uchar *)data++, type );
index_x += type;
}
}
index += fli->scr_width;
}
}
static void dcd_black( struct FLI *fli, char *data ) {
/* puts( "black" ); */
int l;
uchar *index;
l = fli->h.height;
index = graph_mem;
while( l-- > 0 ) {
memset( index, 0, fli->h.width );
index += fli->scr_width;
}
}
static void dcd_literal( struct FLI *fli, char *data ) {
int l;
/* puts( "literal" ); */
l = fli->h.height;
{
/* linear video memory */
char *index;
index = graph_mem;
while( l-- > 0 ) {
memcpy( index, data, fli->h.width );
data = (void *)((uchar *)data + fli->h.width);
index += fli->scr_width;
}
}
}
static void dcd_pstamp( char *data ) {
/* puts( "pstamp" ); */
}
static void showhelp( void ) {
puts( "FLI Player for Linux (version 0.2a) by John Remyn" );
puts( "modified version for aalib by Jan Hubicka" );
puts( "Now it is ascii arted FLI Player for text mode" );
puts( "Usage:" );
puts( " flip [switch] <filename>" );
puts( "Valid switches are :" );
puts( " -f Switch off clock synchronization." );
puts( " -v Show information on flic file." );
puts( " -? -h Show help." );
puts( " -a Don't keep frames in memory." );
puts( " -b Process frames when they are loaded." );
puts( " -c Keep a blank screen while frames are being loaded." );
puts( " -n <number> Play the animation sequence <n> times." );
puts( " -s <delay> Set delay between frames to <delay> miliseconds." );
puts( " - Read flic file from standard input." );
puts( "also standard aalib options are supported" );
puts( " -dim, -bold, -reverse, -normal for enabling attributes");
puts( " -nodim, -nobold, -noreverse, -nonormal for disabling");
puts( "Press H for help on keys while playing." );
}
static void parse_cmdln( int argc, char *argv[], struct OPTIONS *options ) {
int i,j;
options->filename[0] = '\0';
options->fast = 0;
options->verbose = 0;
options->release = 0;
options->firstp = 0;
options->blank = 0;
options->playrep = 1;
options->speed = -1;
options->stdinp = 0;
for( i=1; i<argc; i++ ) {
if( *argv[i]=='-' ) {
char c;
int k;
/* argv[i] contains options */
if( *(argv[i]+1)=='\0' ) {
options->stdinp = 1;
}
j = 1;
k = 0;
while( (c = *(argv[i]+j))!='\0' ) {
switch( c ) {
case 'f' : options->fast = 1; break;
case 'v' : options->verbose = 1; break;
case 'a' : options->release = 1; break;
case 'b' : options->firstp = 1; break;
case 'c' : options->blank = 1; break;
case '?' :
case 'h' : showhelp(); exit( 0 ); break;
case 'n' : if( i+k+1<argc ) {
k++;
options->playrep = abs( atoi( argv[i+k] ) );
}
break;
case 's' : if( i+k+1<argc ) {
k++;
options->speed = abs( atoi( argv[i+k] ) );
/* adjust to some reasonable value */
if (options->speed > 1000) options->speed = 1000;
/* convert to usec */
options->speed *= 1000;
}
break;
default : showhelp();
puts( "Unknown option." );
exit( -1 );
}
j++;
}
i = i+k;
}
else {
if( argv[i]!=NULL ) {
/* argv[i] is the filename of the flic file */
strncpy( options->filename, argv[i], NAMELEN );
}
}
}
if( options->filename[0]=='\0' && options->stdinp==0 ) {
showhelp();
puts( "No filename given." );
exit( -1 );
}
}
static int open_fli( struct FLI *fli, struct OPTIONS *options ) {
/* open file and read the header */
if( !options->stdinp ) {
fli->f = fopen( fli->filename, "rb" );
if( !fli->f ) {
return 0;
}
}
else {
fli->f = stdin;
}
freadblock( fli->f, sizeof( fli->h.size ), &(fli->h.size) );
freadblock( fli->f, sizeof( fli->h.type ), &(fli->h.type) );
freadblock( fli->f, sizeof( fli->h.frames ), &(fli->h.frames) );
freadblock( fli->f, sizeof( fli->h.width ), &(fli->h.width) );
freadblock( fli->f, sizeof( fli->h.height ), &(fli->h.height) );
freadblock( fli->f, sizeof( fli->h.depth ), &(fli->h.depth) );
freadblock( fli->f, sizeof( fli->h.flags ), &(fli->h.flags) );
freadblock( fli->f, sizeof( fli->h.speed ), &(fli->h.speed) );
freadblock( fli->f, sizeof( fli->h.reserved0 ), &(fli->h.reserved0) );
freadblock( fli->f, sizeof( fli->h.created ), &(fli->h.created) );
freadblock( fli->f, sizeof( fli->h.creator ), &(fli->h.creator) );
freadblock( fli->f, sizeof( fli->h.updated ), &(fli->h.updated) );
freadblock( fli->f, sizeof( fli->h.updater ), &(fli->h.updater) );
freadblock( fli->f, sizeof( fli->h.aspectx ), &(fli->h.aspectx) );
freadblock( fli->f, sizeof( fli->h.aspecty ), &(fli->h.aspecty) );
freadblock( fli->f, sizeof( fli->h.reserved1 ), &(fli->h.reserved1) );
freadblock( fli->f, sizeof( fli->h.oframe1 ), &(fli->h.oframe1) );
freadblock( fli->f, sizeof( fli->h.oframe2 ), &(fli->h.oframe2) );
freadblock( fli->f, sizeof( fli->h.reserved2 ), &(fli->h.reserved2) );
/* now check if it's a flc or a fli and take necessary precautions */
if( (unsigned)fli->h.type==FLITYPE ) {
/* it's a fli. convert as much as possible to flc */
fli->flc = 0;
/* convert frame rate from 1/70 sec to usec */
fli->h.speed *= 100;
fli->h.speed /= 7;
fli->h.speed *= 1000;
/* ascpect ratio is ignored, but fix it anyway */
fli->h.aspectx = 6;
fli->h.aspecty = 5;
/* can't convert frame offsets */
}
else if( (unsigned)fli->h.type==FLCTYPE ) {
fli->flc = 1;
fli->h.speed *= 1000; /* convert msec to usec */
}
else {
puts( "File type not recognized." );
exit( -1 );
}
return 1;
};
static void describe_fli( struct FLI *fli ) {
printf( "Filename %s\n", fli->filename );
printf( "size %li\n", fli->h.size );
printf( "type %x\n", fli->h.type );
printf( "frames %i\n", fli->h.frames );
printf( "width %i\n", fli->h.width );
printf( "height %i\n", fli->h.height );
printf( "depth %i\n", fli->h.depth );
printf( "flags %x\n", fli->h.flags );
printf( "speed %li\n", fli->h.speed );
printf( "aspectx %i\n", fli->h.aspectx );
printf( "aspecty %i\n", fli->h.aspecty );
printf( "oframe1 %li\n", fli->h.oframe1 );
printf( "oframe2 %li\n", fli->h.oframe2 );
};
static void readchunkheader( FILE *f, struct FLI_CHUNK_HEADER *buf ) {
freadblock( f, sizeof( buf->size ), &buf->size );
freadblock( f, sizeof( buf->type ), &buf->type );
freadblock( f, sizeof( buf->chunks ), &buf->chunks );
freadblock( f, sizeof( buf->reserved ), &buf->reserved );
}
static void scan_to_frame( struct FLI *fli ) {
struct FLI_CHUNK_HEADER buf;
struct FLI_FRAMECHUNK *fc;
do {
readchunkheader( fli->f, &buf );
if( buf.type==0xF1FA ) break;
fseek( fli->f, buf.size - FLI_CHUNK_HEADERLEN, SEEK_CUR );
} while ( buf.type!=0xF1FA );
fc = fli->frame + fli->current;
fc->size = buf.size - FLI_CHUNK_HEADERLEN;
fc->subchunks = buf.chunks;
fc->file_offset = ftell( fli->f );
fc->cd = NULL;
}
static void getframechunkdata( struct FLI *fli ) {
struct FLI_FRAMECHUNK *fc;
void *data;
fc = fli->frame + fli->current;
data = fc->cd;
if( data )
return; /* frame chunk data already loaded */
if(fc->size) {
data = malloc( fc->size );
if( !data ) {
printf( "cannot allocate memory for frame data\n" );
exit( 1 );
}
fseek( fli->f, fc->file_offset, SEEK_SET );
freadblock( fli->f, fc->size, data );
} else data=NULL;
fc->cd = data;
}
static void releaseframechunkdata( struct FLI *fli ) {
struct FLI_FRAMECHUNK *fc;
fc = fli->frame + fli->current;
if( fc->cd ) {
free( fc->cd );
fc->cd = NULL;
}
}
static void processframechunk( struct FLI *fli ) {
struct FLI_FRAMECHUNK *fc;
void *data;
int i;
fc = fli->frame + fli->current;
data = fc->cd;
for( i=0; i<fc->subchunks; i++ ) {
/* switch( chunktype ) */
switch( *((short int *)((char *)data+4)) ) {
case COLOR_256 :
dcd_color_256( (char *)data + 6 );
break;
case DELTA_FLC :
dcd_delta_flc( fli, (char *)data + 6 );
break;
case COLOR_64 :
dcd_color_64( (char *)data + 6 );
break;
case DELTA_FLI :
dcd_delta_fli( fli, (char *)data + 6 );
break;
case BLACK :
dcd_black( fli, (char *)data + 6 );
break;
case BYTE_RUN :
dcd_byte_run( fli, (char *)data + 6 );
break;
case LITERAL :
dcd_literal( fli, (char *)data + 6 );
break;
case PSTAMP :
dcd_pstamp( (char *)data + 6 );
break;
default :
puts( "unknown subchunk" );
}
data = (void *)((char *)data + *(long *)data);
}
}
long gettime(void) {
struct timeval t;
gettimeofday(&t, NULL);
return(t.tv_usec);
}
int await() {
#define T 10000 /* process key every 10ms */
int i;
long t;
t = gettime();
if (t < fli.time) t = t + 1E6;
t = fli.h.speed - (t - fli.time);
if (t > 0) {
if (t > T) {
for (i = 0; i < (t / T); i++) {
usleep(T);
if (f_getkey() == 'q') return(1);
}
usleep(t % T);
}
else usleep(t);
}
return(f_getkey() == 'q');
}
static void fastscale(char *b1, char *b2, int x1, int x2, int y1, int y2, int width1, int width2)
{
int ddx1, ddx, spx = 0, ex;
int ddy1, ddy, spy = 0, ey;
int x;
char *bb1 = b1;
width2 -= x2;
if (!x1 || !x2 || !y1 || !y2)
return;
ddx = x1 + x1;
ddx1 = x2 + x2;
if (ddx1 < ddx)
spx = ddx / ddx1, ddx %= ddx1;
ddy = y1 + y1;
ddy1 = y2 + y2;
if (ddy1 < ddy)
spy = (ddy / ddy1) * width1, ddy %= ddy1;
ey = -ddy1;
for (; y2; y2--) {
ex = -ddx1;
for (x = x2; x; x--) {
*b2 = *b1;
b2++;
b1 += spx;
ex += ddx;
if (ex > 0) {
b1++;
ex -= ddx1;
}
}
b2 += width2;
bb1 += spy;
ey += ddy;
if (ey > 0) {
bb1 += width1;
ey -= ddy1;
}
b1 = bb1;
}
}
static int resized;
static void resize(aa_context * c)
{
aa_resize(c);
resized = 1;
}
static int yesno(int x, int y, char *string)
{
char c;
aa_puts(context, x, y, AA_SPECIAL, string);
aa_flush(context);
while ((c = tolower(aa_getkey(context, 1))) != 'y' && c != 'n');
return (c == 'y');
}
static int getnum(char *string)
{
unsigned char c;
aa_puts(context, 0, 0, AA_SPECIAL, string);
aa_flush(context);
while ((c = tolower(aa_getkey(context, 1))) < '0' || c > '9');
return (c - '0');
}
static void selectfont(aa_context * c)
{
int i = 0, i1;
char string[255];
for (i = 0; aa_fonts[i] != NULL; i++) {
sprintf(string, "%i - %-40s", i, aa_fonts[i]->name);
aa_puts(context, 0, i, AA_SPECIAL, string);
}
i1 = getnum("");
if (i1 < i)
aa_setfont(c, *(aa_fonts + i1));
}
#if AA_LIB_VERSION==1 && AA_LIB_MINNOR==0
#define SUPPORTED c->driver->params.supported
#else
#define SUPPORTED c->driverparams.supported
#endif
static void selectsupported(aa_context * c)
{
int supported = c->params.supported;
char text[40];
int ch;
do {
char *texts[]={
"Normal characters",
"Half bright (dim)",
"Double bright (bold)",
"Bold font",
"Reversed",
"8 bit ascii",
"Control characters"};
int masks[]={AA_NORMAL_MASK,AA_DIM_MASK,AA_BOLD_MASK,AA_BOLDFONT_MASK,AA_REVERSE_MASK,AA_EIGHT,AA_ALL};
int i;
for(i=0;i<7;i++)
{
sprintf(text,"%i %-20s:%-12s",i+1,texts[i],(SUPPORTED&masks[i])?((supported&masks[i])?"On":"Off"):"Unsupported");
aa_puts(c,0,i,AA_SPECIAL,text);
}
aa_puts(c,0,i,AA_SPECIAL,"8 Leave this menu");
aa_flush(c);
while ((ch = tolower(aa_getkey(context, 1))) < '1' || ch > '8');
ch-='1';
if(ch<7) supported^=masks[ch];
} while (ch<7);
aa_setsupported(c, supported);
}
int f_getkey(void)
{
int c=aa_getkey(context,0);
switch(c) {
case 'h':
case 'H':
aa_puts(context,0,0,AA_SPECIAL," aaflip - an ascii art fli/flc player ");
aa_puts(context,0,1,AA_SPECIAL," ");
aa_puts(context,0,2,AA_SPECIAL," ';' '\\' - gamma '<' '>' - bright ");
aa_puts(context,0,3,AA_SPECIAL," '[' ']' - Random dithering',' '.' - contrast ");
aa_puts(context,0,4,AA_SPECIAL," 'I' 'i' - inversion ");
aa_puts(context,0,5,AA_SPECIAL," ");
aa_puts(context,0,6,AA_SPECIAL," 'm' - Dithering method 'q' - quit ");
aa_puts(context,0,7,AA_SPECIAL," 'u' - Select attributes 'g' - font ");
aa_flush(context);
aa_getkey(context,1);
break;
case ';':
params->gamma /= 1.05;
break;
case '\'':
params->gamma *= 1.05;
break;
case '<':
params->bright -= 4;
break;
case '>':
params->bright += 4;
break;
case '[':
params->randomval -= 4;
break;
case ']':
params->randomval += 4;
break;
case ',':
params->contrast -= 2;
break;
case '.':
params->contrast += 2;
break;
case 'm':
params->dither = (params->dither + 1) % AA_DITHERTYPES;
break;
case 'i':
params->inversion = 1;
break;
case 'I':
params->inversion = 0;
break;
case 'u':
selectsupported(context);
break;
case 'g':
selectfont(context);
break;
}
return(c);
}
int main( int argc, char *argv[] ) {
int quit = 0;
int playstartframe = 0;
int first=1;
long t, tdelta;
aa_parseoptions(NULL,NULL,&argc,argv);
parse_cmdln( argc, argv, &options );
strcpy( fli.filename, options.filename );
/* open flic and get header information */
if( !open_fli( &fli, &options ) ) {
puts( "cannot open fli file" );
exit( 1 );
}
/* show header */
if( options.verbose==1 ) {
describe_fli( &fli );
}
/* optionally set delays */
if( options.speed>=0 ) {
fli.h.speed = options.speed;
}
/* optionally reduce delays to 0 (this overrides the set delay option) */
if( options.fast==1 ) {
fli.h.speed = 0;
}
/* silly but might happen */
if( options.playrep<=0 ) {
exit( 0 );
}
/* determine graphics mode to use */
/* set mode */
context=aa_autoinit(&aa_defparams);
if(context==NULL) {
printf("Failed to initialize aalib\n");
exit(1);
}
aa_hidecursor(context);
aa_autoinitkbd(context,0);
aa_resizehandler(context,resize);
params=aa_getrenderparams();
fli.scr_width = fli.h.width;
fli.scr_height = fli.h.height;
graph_mem=malloc(fli.scr_width*fli.scr_height);
fli.frame = (struct FLI_FRAMECHUNK *)malloc( (fli.h.frames+1) * sizeof( struct FLI_FRAMECHUNK ) );
if( fli.frame==NULL ) {
puts( "cannot allocate enough memory to store frame information\n" );
exit( 1 );
}
fli.current = 0;
/* preloading */
/* first the 1st frame which is a full screen frame */
scan_to_frame( &fli );
if( !options.blank ) {
getframechunkdata( &fli );
processframechunk( &fli );
releaseframechunkdata( &fli );
playstartframe = 1;
}
else {
getframechunkdata( &fli );
playstartframe = 0;
if( options.release ) {
releaseframechunkdata( &fli );
}
}
fli.current++;
first=1;
while( fli.current<=fli.h.frames && !quit ) {
scan_to_frame( &fli );
getframechunkdata( &fli );
if( options.firstp ) {
fli.time = gettime();
processframechunk( &fli );
}
if( options.release ) {
releaseframechunkdata( &fli );
}
if(first||options.firstp) {
fastscale(graph_mem,context->imagebuffer,
fli.scr_width,aa_imgwidth(context),
fli.scr_height,aa_imgheight(context),
fli.scr_width,aa_imgwidth(context));
aa_renderpalette(context,pal,params,0,0,aa_imgwidth(context),aa_imgheight(context));
if(first&&!options.firstp)
aa_puts(context,0,0,AA_SPECIAL,"Preloading...");
aa_flush(context);
}
fli.current++;
first=0;
if( f_getkey()=='q' ) quit = 1;
if(options.firstp&&!quit) quit = await();
}
if(!quit) {
if( options.firstp ) {
options.playrep--;
if( options.playrep==0 ) {
quit = 1;
}
}
fli.current = playstartframe;
while( !quit ) {
fli.time = gettime();
getframechunkdata( &fli );
processframechunk( &fli );
if( options.release ) {
releaseframechunkdata( &fli );
}
fli.current++;
fastscale(graph_mem,context->imagebuffer,
fli.scr_width,aa_imgwidth(context),
fli.scr_height,aa_imgheight(context),
fli.scr_width,aa_imgwidth(context));
aa_renderpalette(context,pal,params,0,0,aa_imgwidth(context),aa_imgheight(context));
aa_flush(context);
if( fli.current>fli.h.frames ) {
fli.current = 1;
options.playrep--;
if( options.playrep==0 ) {
quit = 1;
break;
}
}
quit = await();
}
}
/* restore textmode */
aa_close(context);
/* close flic */
if( !options.stdinp ) {
fclose( fli.f );
}
fli.f = NULL;
return 0;
};

7
general.c Normal file
View File

@ -0,0 +1,7 @@
#include "general.h"
/* general module source */
long freadblock( FILE *fp, long size, void *target ) {
return fread( target, size, 1, fp );
}

41
general.h Normal file
View File

@ -0,0 +1,41 @@
/* General module include file */
#ifndef _GENERAL_H
#define _GENERAL_H
#ifndef _STDIO_H
#include <stdio.h>
#endif
#include <termios.h>
#include <unistd.h>
#include <sys/ioctl.h>
#ifndef uint
#define uint unsigned int
#define ulong unsigned long
#define ushort unsigned short int
#define uchar unsigned char
#endif
#ifndef abs
#define abs(x) (((x)>0)? (x) : (0-(x)))
#endif
long freadblock( FILE *f, long size, void *target );
/* reads size bytes from file f to target
returns 1 on success, 0 on error
*/
void echo( void *source, long size );
/* echos size bytes taken from source to the std output this way:
000 001 002 000 255 .......
*/
int getkey( void );
/* returns a character from the stdin stream, returning 0 if no
key was pressed
*/
#endif

112
image.c Normal file
View File

@ -0,0 +1,112 @@
#include <stdio.h>
#include <unistd.h>
#include <malloc.h>
#include "config.h"
int imgwidth, imgheight;
unsigned char *imgdata;
#define PBM 0
#define PGM 1
#define PPM 2
int load_image(char *name)
{
char data[65536];
int i, c, max;
int raw = 0;
int type;
FILE *file;
if (name[0]=='\0') {
#ifdef HAVE_ISATTY
if (isatty(STDIN_FILENO)) {
printf("Missing filename.\n Use --help for list of options.\n");
return 0;
}
#endif
file = stdin;
}
else {
if ((file = fopen(name, "rb")) == NULL) {
printf("File not found\n");
return 0;
}
}
if (getc(file) != 'P') {
printf("Invalid magic-not p?m family format\n");
return 0;
}
c = getc(file);
if (c < '1' || c > '6') {
printf("Invalid magic-unknown p?m family format\n");
return 0;
}
if (c >= '4')
raw = 1, c -= 3;
type = c - '1';
c = getc(file);
while (c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '#') {
if (c == '#')
fgets(data, 65536, file);
c = getc(file);
}
ungetc(c, file);
if (fscanf(file, "%i %i", &imgwidth, &imgheight) != 2) {
printf("Parse error\n");
return 0;
}
switch (type) {
case PGM:
case PPM:
if (fscanf(file, "%i", &max) != 1) {
printf("Parse error\n");
return 0;
}
break;
case PBM:
max=1;
break;
}
c = getc(file);
if ((imgdata = malloc(imgwidth * imgheight)) == NULL) {
printf("Out of memory\n");
return 0;
}
if (!raw) {
if(type==PPM) {
int r,g,b;
for (i = 0; i < imgwidth * imgheight; i++)
fscanf(file, "%i %i %i", &r,&g,&b),
imgdata[i]=(r*76+g*150+b*29)/max;
max=255;
} else
for (i = 0; i < imgwidth * imgheight; i++)
fscanf(file, "%i\n", &c), imgdata[i] = c;
} else {
if(type==PBM) {
for(i=0;i<imgwidth*imgheight;)
{int n;
c=getc(file);
for(n=128;n&&i<imgwidth*imgheight;n>>=1,i++)
imgdata[i]=(n&c)!=0;
}
} else
if(type==PPM) {
for(i=0;i<imgwidth*imgheight;i++)
{
int r,g,b;
r=getc(file);
g=getc(file);
b=getc(file);
imgdata[i]=(r*76+g*150+b*29)/max;
}
max=255;
} else
fread(imgdata, 1, imgwidth * imgheight, file);
}
for (i = 0; i < imgwidth * imgheight; i++)
imgdata[i] = imgdata[i] * 255 / max;
if (name[0]!='\0') fclose(file);
return 1;
}

6
image.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef _IMAGE_H
#define _IMAGE_H
extern int imgwidth, imgheight;
extern unsigned char *imgdata;
extern int load_image(char *name);
#endif

238
install-sh Executable file
View File

@ -0,0 +1,238 @@
#! /bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
#
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
tranformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
else
true
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
instcmd=:
else
instcmd=mkdir
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f $src -o -d $src ]
then
true
else
echo "install: $src does not exist"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
else
true
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
else
true
fi
fi
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
shift
if [ ! -d "${pathcomp}" ] ;
then
$mkdirprog "${pathcomp}"
else
true
fi
pathcomp="${pathcomp}/"
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd $dst &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
else
dstfile=`basename $dst $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
else
true
fi
# Make a temp file name in the proper directory.
dsttmp=$dstdir/#inst.$$#
# Move or copy the file name to the temp name
$doit $instcmd $src $dsttmp &&
trap "rm -f ${dsttmp}" 0 &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
# Now rename the file to the real destination.
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
fi &&
exit 0

57
main.c Normal file
View File

@ -0,0 +1,57 @@
#include <aalib.h>
#include "image.h"
#include "ui.h"
#include "config.h"
#define NAMELEN 256
char filename[NAMELEN];
static void showhelp(char *prgname)
{
printf("Usage: %s [options] filename.p[ngbp]m\n", prgname);
printf("Options:\n%s\n", aa_help);
}
static void showversion(char *prgname)
{
printf("This is %s version %s\n", prgname, VERSION);
}
static void parse_cmdline( int argc, char *argv[])
{
int i;
filename[0] = '\0';
for (i = 1; i < argc; i++) {
if (!strncmp(argv[i], "--", 2)) {
if (!strcmp(argv[i], "--help")) { showhelp(argv[0]); exit(0); }
if (!strcmp(argv[i], "--version")) { showversion(argv[0]); exit(0); }
printf("Unknown option. Use %s --help for help\n", argv[0]);
exit(-1);
}
else {
if (argv[i]!=NULL) {
/* argv[i] is the filename of the image file */
strncpy(filename, argv[i], NAMELEN);
}
}
}
}
int main(int argc, char **argv)
{
aa_parseoptions(NULL,NULL,&argc,argv);
parse_cmdline(argc, argv);
if (!load_image(filename))
exit(-1);
context = aa_autoinit(&aa_defparams);
if (context == NULL)
exit(-1);
aa_autoinitkbd(context,0);
aa_hidecursor(context);
main_loop();
aa_close(context);
return(0);
}

190
missing Executable file
View File

@ -0,0 +1,190 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
# Franc,ois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
case "$1" in
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing - GNU libit 0.0"
;;
-*)
echo 1>&2 "$0: Unknown \`$1' option"
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
;;
aclocal)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`acinclude.m4' or \`configure.in'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`configure.in'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`acconfig.h' or \`configure.in'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case "$f" in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
bison|yacc)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if [ ! -f y.tab.h ]; then
echo >y.tab.h
fi
if [ ! -f y.tab.c ]; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex|flex)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if [ ! -f lex.yy.c ]; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
makeinfo)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
fi
touch $file
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and you do not seem to have it handy on your
system. You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequirements for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0

40
mkinstalldirs Executable file
View File

@ -0,0 +1,40 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain
# $Id: mkinstalldirs,v 1.1 2001/04/23 14:12:37 hubicka Exp $
errstatus=0
for file
do
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
shift
pathcomp=
for d
do
pathcomp="$pathcomp$d"
case "$pathcomp" in
-* ) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
fi
fi
pathcomp="$pathcomp/"
done
done
exit $errstatus
# mkinstalldirs ends here

138
shrink.c Normal file
View File

@ -0,0 +1,138 @@
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include "aalib.h"
#include "image.h"
#include "shrink.h"
typedef double atype;
static atype xstep, ystep;
static atype max;
static int fast;
static int getval(atype x, atype y)
{
atype xe = x + xstep, ye = y + ystep;
atype ycount, xcount = 0;
int xi, yi, xie = floor(xe), yie = floor(ye);
ycount = 0;
if (x < 0 || x + xstep > imgwidth || y < 0 || y + ystep > imgheight)
return 0;
if (fast) {
xi = x;
yi = y;
xi = imgdata[xi + yi * imgwidth];
} else {
for (yi = y; yi <= yie; yi++) {
xcount = 0;
xi = x;
xcount += (((int) imgdata[xi + yi * imgwidth])) * (1.0 - x + floor(x));
xi++;
for (; xi <= xie; xi++)
xcount += (((int) imgdata[xi + yi * imgwidth]));
xi--;
/*if(xie!=floor(xie)) */
xcount -= (((int) imgdata[xi + yi * imgwidth])) * (1.0 - xe + floor(xe));
if (yi == (int) y)
ycount += xcount * (1.0 - y + floor(y));
else
ycount += xcount;
/*printw("%f %f %f %i\n",xcount,ycount,x,xie); */
}
/*if(yie!=floor(yie)) */
ycount -= xcount * (1.0 - ye + floor(ye));
xi = 256 * ycount / max;
}
if (xi < 0)
xi = 0;
if (xi > 255)
xi = 255;
return (xi);
}
void fastscale(char *b1, char *b2, int x1, int x2, int y1, int y2, int width1, int width2)
{
int ddx1, ddx, spx = 0, ex;
int ddy1, ddy, spy = 0, ey;
int x;
char *bb1=b1;
width2 -= x2;
if(!x1||!x2||!y1||!y2) return;
ddx = x1 + x1;
ddx1 = x2 + x2;
if (ddx1 < ddx)
spx = ddx / ddx1, ddx %= ddx1;
ddy = y1 + y1;
ddy1 = y2 + y2;
if (ddy1 < ddy)
spy = (ddy / ddy1)*width1, ddy %= ddy1;
ey = -ddy1;
for (; y2; y2--) {
ex = -ddx1;
for (x = x2; x; x--) {
*b2 = *b1;
b2++;
b1 += spx;
ex += ddx;
if (ex > 0) {
b1++;
ex -= ddx1;
}
}
b2 += width2;
bb1 += spy;
ey += ddy;
if (ey > 0) {
bb1 += width1;
ey -= ddy1;
}
b1=bb1;
}
}
void shrink(aa_context * c, int fast1, int x1, int y1, int x2, int y2)
{
int x, y;
int width = aa_imgwidth(c);
int height = aa_imgheight(c);
if(x2<0||x1>=imgwidth||y2<0||y1>=imgheight) {
memset(c->imagebuffer,0,aa_imgwidth(c)*aa_imgheight(c));
return;
}
if (fast) {
if(x1<0||y1<0||x2>=imgwidth||y2>=imgheight)
{ int xx1=0,xx2=aa_imgwidth(c)-1,yy1=0,yy2=aa_imgheight(c)-1;
memset(c->imagebuffer,0,aa_imgwidth(c)*aa_imgheight(c));
xstep = ((atype) width) / (x2 - x1 - 1) ;
ystep = ((atype) height) / (y2 - y1 - 1) ;
if(x2>=imgwidth) {
xx2=(imgwidth-1-x1)*xstep;
x2=imgwidth-1;
}
if(y2>=imgheight) {
yy2=(imgheight-1-y1)*ystep;
y2=imgheight-1;
}
if(x1<0) {
xx1=-xstep*x1;
x1=0;
}
if(y1<0) {
yy1=-ystep*y1;
y1=0;
}
fastscale(imgdata + x1 + imgwidth * y1, c->imagebuffer+xx1+yy1*width, x2 - x1, xx2-xx1, y2 - y1, yy2-yy1, imgwidth, aa_imgwidth(c));
return;
}
else
fastscale(imgdata + x1 + imgwidth * y1, c->imagebuffer, x2 - x1, aa_imgwidth(c), y2 - y1, aa_imgheight(c), imgwidth, aa_imgwidth(c));
return;
}
fast = fast1;
xstep = (x2 - x1 - 1) / (atype) (width);
ystep = (y2 - y1 - 1) / (atype) (height);
max = xstep * ystep * 256;
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) {
atype xp = x1 + xstep * x, yp = y1 + ystep * y;
aa_putpixel(c, x, y, getval(xp, yp));
}
}
}

4
shrink.h Normal file
View File

@ -0,0 +1,4 @@
#ifndef SHRINK_H
#define SHRINK_H
extern void shrink(aa_context *, int, int, int, int, int);
#endif

1
stamp-h.in Normal file
View File

@ -0,0 +1 @@
timestamp

475
ui.c Normal file
View File

@ -0,0 +1,475 @@
#include <stdio.h>
#include <ctype.h>
#include <malloc.h>
#include <string.h>
#include <aalib.h>
#include "shrink.h"
#include "image.h"
aa_context *context;
aa_renderparams *renderparams;
static int x1, y1, x2, y2;
static int fast = 1;
static int resized;
static char getletter(int i)
{
if(i<9) return('1'+i);
if(i==9) return('0');
if(i>9) return('A'+i-10);
}
static void do_display(void)
{
aa_puts(context, 0, 0, AA_SPECIAL, "Calculating..");
aa_flush(context);
shrink(context, fast, x1, y1, x2, y2);
aa_render(context, renderparams, 0, 0, aa_scrwidth(context), aa_scrheight(context));
aa_flush(context);
}
static void resize(aa_context * c)
{
aa_resize(c);
resized = 1;
do_display();
}
static int yesno(int x, int y, char *string)
{
char c;
aa_puts(context, x, y, AA_SPECIAL, string);
aa_flush(context);
while ((c = tolower(aa_getkey(context, 1))) != 'y' && c != 'n');
return (c == 'y');
}
static int getnum(char *string)
{
unsigned char c;
aa_puts(context, 0, 0, AA_SPECIAL, string);
aa_flush(context);
while (((c = tolower(aa_getkey(context, 1))) < '0' || c > '9') && (c<'A' || c>'Z') && (c<'a' || c>'z'));
if(c=='0') return 9;
if(c<='9'&&c>='1') return (c-'1');
if(c>='a'&&c<='z') return (c-'a'+10);
if(c>='A'&&c<='Z') return (c-'A'+10);
return (c - '0');
}
static void selectfont(aa_context * c)
{
int i = 0, i1;
char string[255];
for (i = 0; aa_fonts[i] != NULL; i++) {
sprintf(string, "%c - %-40s", getletter(i), aa_fonts[i]->name);
aa_puts(context, 0, i, AA_SPECIAL, string);
}
i1 = getnum("");
if (i1 < i)
aa_setfont(c, *(aa_fonts + i1));
}
#if AA_LIB_VERSION==1 && AA_LIB_MINNOR==0
#define SUPPORTED c->driver->params.supported
#else
#define SUPPORTED c->driverparams.supported
#endif
static void selectsupported(aa_context * c)
{
int supported = c->params.supported;
char text[40];
int ch;
do {
static char *texts[] =
{
"Normal characters",
"Half bright (dim)",
"Double bright (bold)",
"Bold font",
"Reversed",
"8 bit ascii",
"Control characters"};
int masks[] =
{AA_NORMAL_MASK, AA_DIM_MASK, AA_BOLD_MASK, AA_BOLDFONT_MASK, AA_REVERSE_MASK, AA_EIGHT, AA_ALL};
int i;
for (i = 0; i < 7; i++) {
sprintf(text, "%i %-20s:%-12s", i + 1, texts[i], (SUPPORTED & masks[i]) ? ((supported & masks[i]) ? "On" : "Off") : "Unsupported");
aa_puts(context, 0, i, AA_SPECIAL, text);
}
aa_puts(context, 0, i, AA_SPECIAL, "8 Leave this menu");
aa_flush(context);
while ((ch = tolower(aa_getkey(context, 1))) < '1' || ch > '8');
ch -= '1';
if (ch < 7)
supported ^= masks[ch];
} while (ch < 7);
aa_setsupported(c, supported);
}
static void save(void)
{
int i = 0, i1;
struct aa_savedata data;
aa_context *c;
char string[255];
char name[256];
for (i = 0; aa_formats[i] != NULL; i++) {
sprintf(string, "%c - %-40s", getletter(i), aa_formats[i]->formatname);
aa_puts(context, 0, i, AA_SPECIAL, string);
}
while ((i1 = getnum("")) >= i);
do_display();
data.format = aa_formats[i1];
if (data.format->flags & AA_USE_PAGES) {
sprintf(string, "Page size is:%ix%i", data.format->pagewidth, data.format->pageheight);
aa_puts(context, 0, 0, AA_SPECIAL, string);
}
aa_puts(context, 0, 1, AA_SPECIAL, "Width of image:");
sprintf(string, "%i", data.format->width);
do {
aa_edit(context, 0, 2, 5, string, 256);
} while (sscanf(string, "%i", &aa_defparams.width) != 1 || aa_defparams.width <= 0 || aa_defparams.width >= 65000);
aa_puts(context, 0, 3, AA_SPECIAL, "Height of image:");
sprintf(string, "%i", data.format->height);
do {
aa_edit(context, 0, 4, 5, string, 256);
} while (sscanf(string, "%i", &aa_defparams.height) != 1 || aa_defparams.height <= 0 || aa_defparams.height >= 65000);
name[0] = 0;
data.name = name;
aa_puts(context, 0, 5, AA_SPECIAL, "Filename:");
aa_edit(context, 0, 6, 20, name, 256);
strcat(name,"%c%e");
do_display();
aa_defparams.minwidth = 0;
aa_defparams.minheight = 0;
aa_defparams.maxwidth = 0;
aa_defparams.maxheight = 0;
c = aa_init(&save_d, &aa_defparams, &data);
if (c == NULL) {
return;
}
if (data.format->font == NULL)
selectfont(c);
else
aa_setfont(c, data.format->font);
do_display();
selectsupported(c);
do_display();
aa_gotoxy(context, 0, 0);
if (yesno(0, 0, "Save just current view? "))
shrink(c, fast, x1, y1, x2, y2);
else
shrink(c, fast, 0, 0, imgwidth, imgheight);
aa_puts(context, 0, 1, AA_SPECIAL, "saving..");
aa_flush(context);
aa_render(c, renderparams, 0, 0, aa_scrwidth(c), aa_scrheight(c));
aa_flush(c);
aa_close(c);
do_display();
}
static void ui_help(void)
{
aa_puts(context, 0, 1, AA_SPECIAL, " asciiarted image viewer by Jan Hubicka ");
aa_puts(context, 0, 2, AA_SPECIAL, " a,w,d,x - move image one row/column A,W,D,X - move image one page");
aa_puts(context, 0, 3, AA_SPECIAL, " z - unzoom Z - zoom ");
aa_puts(context, 0, 4, AA_SPECIAL, " s - Save image ");
aa_puts(context, 0, 5, AA_SPECIAL, " m - change dithering mode q - quit ");
aa_puts(context, 0, 6, AA_SPECIAL, " i - turns inversion on I - intversion off ");
aa_puts(context, 0, 7, AA_SPECIAL, " u - select attributes f - select font ");
aa_puts(context, 0, 8, AA_SPECIAL, " space - redraw ',','.' - change contrast ");
aa_puts(context, 0, 9, AA_SPECIAL, " ';',''' - change gamma '<','>' - change bright ");
aa_puts(context, 0, 10, AA_SPECIAL, " '+','-' - zoom/unzoom '<','>' - change bright ");
}
void main_loop(void)
{
int c, i;
int quit = 0;
char string[255];
float xmul = ((float) aa_mmheight(context)) / aa_mmwidth(context);
float ymul = ((float) aa_mmwidth(context)) / aa_mmheight(context);
resized = 1;
renderparams = aa_getrenderparams();
aa_resizehandler(context, resize);
while (!quit) {
if (resized) {
xmul = ((float) aa_mmheight(context)) / aa_mmwidth(context);
ymul = ((float) aa_mmwidth(context)) / aa_mmheight(context);
x1 = 0;
y1 = 0;
x2 = imgwidth;
y2 = imgheight;
if (imgwidth * xmul > imgheight)
y2 = imgwidth * xmul;
else
x2 = imgheight * ymul;
x1 = (imgwidth - x2) / 2;
x2 += x1;
y1 = (imgheight - y2) / 2;
y2 += y1;
do_display();
resized = 0;
}
aa_flush(context);
c = aa_getevent(context, 1);
switch (c) {
case 'h':
ui_help();
break;
case 'z':
x1 = 0;
y1 = 0;
x2 = aa_imgwidth(context);
y2 = aa_imgwidth(context) * xmul;
do_display();
break;
case 'Z':
x1 = 0;
y1 = 0;
x2 = imgwidth;
y2 = imgheight;
if (imgwidth * xmul > imgheight)
y2 = imgwidth * xmul;
else
x2 = imgheight * ymul;
do_display();
break;
case 'd':
if (x2 < imgwidth - 1) {
x1 += context->mulx;
x2 += context->muly;
do_display();
}
break;
case AA_RIGHT:
case 'D':
{
int step = (x2 - x1) / 5;
if (x2 < imgwidth - step) {
x1 += step;
x2 += step;
} else {
x1 = imgwidth - x2 + x1;
x2 = imgwidth;
}
}
do_display();
break;
case 'a':
if (x1 > 1) {
x1 -= context->mulx;
x2 -= context->muly;
do_display();
}
break;
case AA_LEFT:
case 'A':
{
int step = (x2 - x1) / 5;
if (x1 > step) {
x1 -= step;
x2 -= step;
} else {
x2 = x2 - x1;
x1 = 0;
}
do_display();
}
break;
case 'x':
if (y2 < imgheight - 1) {
y1 += context->mulx;
y2 += context->muly;
do_display();
}
break;
case AA_DOWN:
case 'X':
{
int step = (y2 - y1) / 5;
if (y2 < imgheight - step) {
y1 += step;
y2 += step;
} else {
y1 = imgheight - y2 + y1;
y2 = imgheight;
}
}
do_display();
break;
case 'w':
if (y1 > 2) {
y1 -= context->mulx;
y2 -= context->muly;
}
do_display();
break;
case AA_UP:
case 'W':
{
int step = (y2 - y1) / 5;
if (y1 > step) {
y1 -= step;
y2 -= step;
} else {
y2 = y2 - y1;
y1 = 0;
}
}
do_display();
break;
case 'q':
quit = 1;
break;
case 'm':
renderparams->dither = (renderparams->dither + 1) % AA_DITHERTYPES;
do_display();
aa_puts(context, 0, 0, AA_SPECIAL, aa_dithernames[renderparams->dither]);
break;
case ' ':
do_display();
break;
case 'Q':{
renderparams->dither = AA_FLOYD_S;
do_display();
for (i = 2000; i > 5; i -= 7) {
renderparams->randomval = i;
aa_render(context, renderparams, 0, 0, aa_scrwidth(context), aa_scrheight(context));
aa_flush(context);
}
}
renderparams->dither = AA_FLOYD_S;
aa_render(context, renderparams, 0, 0, aa_scrwidth(context), aa_scrheight(context));
aa_flush(context);
break;
case 'E':{
do_display();
for (i = 0; i < 256; i += 50) {
renderparams->bright = i;
aa_render(context, renderparams, 0, 0, aa_scrwidth(context), aa_scrheight(context));
aa_flush(context);
}
}
renderparams->bright = 255;
aa_render(context, renderparams, 0, 0, aa_scrwidth(context), aa_scrheight(context));
aa_flush(context);
renderparams->bright = 0;
renderparams->dither = AA_FLOYD_S;
aa_render(context, renderparams, 0, 0, aa_scrwidth(context), aa_scrheight(context));
aa_flush(context);
break;
case 'R':{
do_display();
for (i = -256; i < 0; i += 5) {
renderparams->bright = i;
aa_render(context, renderparams, 0, 0, aa_scrwidth(context), aa_scrheight(context));
aa_flush(context);
}
}
renderparams->bright = 0;
aa_render(context, renderparams, 0, 0, aa_scrwidth(context), aa_scrheight(context));
aa_flush(context);
break;
case 'T':{
do_display();
for (i = -256; i < 256; i += 5) {
renderparams->bright = i;
aa_render(context, renderparams, 0, 0, aa_scrwidth(context), aa_scrheight(context));
aa_flush(context);
}
}
renderparams->bright = 0;
aa_render(context, renderparams, 0, 0, aa_scrwidth(context), aa_scrheight(context));
aa_flush(context);
break;
case 'i':
renderparams->inversion = 1;
do_display();
break;
case 'I':
renderparams->inversion = 0;
do_display();
break;
case 's':
save();
break;
case 'F':
fast = 1;
do_display();
break;
case 'f':
fast = 0;
do_display();
break;
case 'u':
selectsupported(context);
do_display();
break;
case 'g':
selectfont(context);
do_display();
break;
case ';':
renderparams->gamma /= 1.05;
do_display();
sprintf(string, "gamma:%f", renderparams->gamma);
aa_puts(context, 0, 0, AA_SPECIAL, string);
break;
case '\'':
renderparams->gamma *= 1.05;
do_display();
sprintf(string, "gamma:%f", renderparams->gamma);
aa_puts(context, 0, 0, AA_SPECIAL, string);
break;
case '<':
renderparams->bright -= 4;
do_display();
sprintf(string, "bright:%f", renderparams->bright / 255.0);
aa_puts(context, 0, 0, AA_SPECIAL, string);
break;
case '>':
renderparams->bright += 4;
do_display();
sprintf(string, "bright:%f", renderparams->bright / 255.0);
aa_puts(context, 0, 0, AA_SPECIAL, string);
break;
case '[':
renderparams->randomval -= 4;
do_display();
sprintf(string, "bright:%f", renderparams->bright / 255.0);
aa_puts(context, 0, 0, AA_SPECIAL, string);
break;
case ']':
renderparams->randomval += 4;
do_display();
sprintf(string, "bright:%f", renderparams->bright / 255.0);
aa_puts(context, 0, 0, AA_SPECIAL, string);
break;
case ',':
renderparams->contrast -= 2;
do_display();
sprintf(string, "contrast:%f", renderparams->contrast / 127.0);
aa_puts(context, 0, 0, AA_SPECIAL, string);
break;
case '.':
renderparams->contrast += 2;
do_display();
sprintf(string, "contrast:%f", renderparams->contrast / 127.0);
aa_puts(context, 0, 0, AA_SPECIAL, string);
break;
case '-':
{
int tmp = (x2 - x1 + 7) / 8;
x1 -= tmp;
x2 += tmp;
tmp = (y2 - y1) / 8;
y1 -= tmp;
y2 = y1 + (x2 - x1) * xmul;
do_display();
} break;
case '+':
{
int tmp = (x2 - x1) / 8;
x1 += tmp;
x2 -= tmp;
tmp = (y2 - y1) / 8;
y1 += tmp;
y2 = y1 + (x2 - x1) * xmul;
do_display();
} break;
}
}
}

7
ui.h Normal file
View File

@ -0,0 +1,7 @@
#ifndef UI_H
#define UI_H
#include "aalib.h"
extern aa_context *context;
extern void main_loop(void);
extern void fsave(void);
#endif