forked from enlightenment/efl
add an xcf generic loader. code totally taken from original xcf loader
in imlib2. this app is gpl. SVN revision: 58918
This commit is contained in:
commit
649433cf1f
|
@ -0,0 +1,2 @@
|
|||
The Rasterman (Carsten Haitzler) <raster@rasterman.com>
|
||||
Christian Kreibich <cK@whoop.org>
|
|
@ -0,0 +1,339 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111 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
|
||||
|
||||
Appendix: 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., 59 Temple Place, Suite 330, Boston, MA 02111 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.
|
|
@ -0,0 +1,32 @@
|
|||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
SUBDIRS = src
|
||||
|
||||
MAINTAINERCLEANFILES = \
|
||||
Makefile.in \
|
||||
aclocal.m4 \
|
||||
compile \
|
||||
config.guess \
|
||||
config.h.in \
|
||||
config.h.in~ \
|
||||
config.sub \
|
||||
configure \
|
||||
depcomp \
|
||||
install-sh \
|
||||
ltmain.sh \
|
||||
missing \
|
||||
$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).tar.gz \
|
||||
$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).tar.bz2 \
|
||||
m4/libtool.m4 \
|
||||
m4/lt~obsolete.m4 \
|
||||
m4/ltoptions.m4 \
|
||||
m4/ltsugar.m4 \
|
||||
m4/ltversion.m4
|
||||
|
||||
EXTRA_DIST = \
|
||||
AUTHORS \
|
||||
COPYING \
|
||||
autogen.sh \
|
||||
m4/ac_attribute.m4 \
|
||||
m4/ac_path_generic.m4 \
|
||||
README
|
|
@ -0,0 +1,2 @@
|
|||
Additional "generic" loaders for Evas that are stand-alone executables
|
||||
evas may run from its generic loader module
|
|
@ -0,0 +1,36 @@
|
|||
#!/bin/sh
|
||||
|
||||
touch README
|
||||
touch ABOUT-NLS
|
||||
|
||||
echo "Running aclocal..." ; aclocal $ACLOCAL_FLAGS -I m4 || exit 1
|
||||
echo "Running autoheader..." ; autoheader || exit 1
|
||||
echo "Running autoconf..." ; autoconf || exit 1
|
||||
echo "Running libtoolize..." ; (libtoolize --copy --automake || glibtoolize --automake) || exit 1
|
||||
echo "Running automake..." ; automake --add-missing --copy --gnu || exit 1
|
||||
|
||||
W=0
|
||||
|
||||
rm -f config.cache-env.tmp
|
||||
echo "OLD_PARM=\"$@\"" >> config.cache-env.tmp
|
||||
echo "OLD_CFLAGS=\"$CFLAGS\"" >> config.cache-env.tmp
|
||||
echo "OLD_PATH=\"$PATH\"" >> config.cache-env.tmp
|
||||
echo "OLD_PKG_CONFIG_PATH=\"$PKG_CONFIG_PATH\"" >> config.cache-env.tmp
|
||||
echo "OLD_LDFLAGS=\"$LDFLAGS\"" >> config.cache-env.tmp
|
||||
|
||||
cmp config.cache-env.tmp config.cache-env >> /dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
W=1;
|
||||
fi
|
||||
|
||||
if [ $W -ne 0 ]; then
|
||||
echo "Cleaning configure cache...";
|
||||
rm -f config.cache config.cache-env
|
||||
mv config.cache-env.tmp config.cache-env
|
||||
else
|
||||
rm -f config.cache-env.tmp
|
||||
fi
|
||||
|
||||
if [ -z "$NOCONFIGURE" ]; then
|
||||
./configure -C "$@"
|
||||
fi
|
|
@ -0,0 +1,116 @@
|
|||
y##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
|
||||
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
|
||||
m4_define([v_maj], [0])
|
||||
m4_define([v_min], [9])
|
||||
m4_define([v_mic], [999])
|
||||
m4_define([v_rev], m4_esyscmd([(svnversion "${SVN_REPO_PATH:-.}" | grep -v export || echo 0) | awk -F : '{printf("%s\n", $1);}' | tr -d ' :MSP\n']))
|
||||
m4_if(v_rev, [0], [m4_define([v_rev], m4_esyscmd([git log 2> /dev/null | (grep -m1 git-svn-id || echo 0) | sed -e 's/.*@\([0-9]*\).*/\1/' | tr -d '\n']))])
|
||||
##-- When released, remove the dnl on the below line
|
||||
dnl m4_undefine([v_rev])
|
||||
##-- When doing snapshots - change soname. remove dnl on below line
|
||||
dnl m4_define([relname], [ver-pre-svn-05])
|
||||
dnl m4_define([v_rel], [-release relname])
|
||||
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
|
||||
m4_ifdef([v_rev], [m4_define([v_ver], [v_maj.v_min.v_mic.v_rev])], [m4_define([v_ver], [v_maj.v_min.v_mic])])
|
||||
m4_define([lt_cur], m4_eval(v_maj + v_min))
|
||||
m4_define([lt_rev], v_mic)
|
||||
m4_define([lt_age], v_min)
|
||||
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
|
||||
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
|
||||
|
||||
AC_INIT([evas_generic_loaders], [v_ver], [enlightenment-devel@lists.sourceforge.net])
|
||||
AC_PREREQ([2.52])
|
||||
AC_CONFIG_SRCDIR([configure.ac])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
|
||||
AM_INIT_AUTOMAKE([1.6 dist-bzip2])
|
||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
||||
|
||||
AC_LIBTOOL_WIN32_DLL
|
||||
define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])dnl
|
||||
define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl
|
||||
AC_PROG_LIBTOOL
|
||||
|
||||
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
|
||||
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
|
||||
m4_ifdef([v_rev], , [m4_define([v_rev], [0])])
|
||||
m4_ifdef([v_rel], , [m4_define([v_rel], [])])
|
||||
AC_DEFINE_UNQUOTED(VMAJ, [v_maj], [Major version])
|
||||
AC_DEFINE_UNQUOTED(VMIN, [v_min], [Minor version])
|
||||
AC_DEFINE_UNQUOTED(VMIC, [v_mic], [Micro version])
|
||||
AC_DEFINE_UNQUOTED(VREV, [v_rev], [Revison])
|
||||
version_info="lt_cur:lt_rev:lt_age"
|
||||
release_info="v_rel"
|
||||
AC_SUBST(version_info)
|
||||
AC_SUBST(release_info)
|
||||
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
|
||||
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
|
||||
VMAJ=v_maj
|
||||
AC_SUBST(VMAJ)
|
||||
|
||||
### Needed information
|
||||
|
||||
AC_CANONICAL_BUILD
|
||||
AC_CANONICAL_HOST
|
||||
AC_C_BIGENDIAN
|
||||
AC_PROG_CC
|
||||
PKG_PROG_PKG_CONFIG
|
||||
|
||||
### Checks for libraries
|
||||
|
||||
# Eina library
|
||||
PKG_CHECK_MODULES(EINA, [eina >= 1.0.0])
|
||||
|
||||
### Checks for header files
|
||||
|
||||
AC_CHECK_HEADER([zlib.h],
|
||||
[dummy="yes"],
|
||||
[AC_MSG_ERROR("Cannot find zlib.h. Make sure your CFLAGS environment variable contains include lines for the location of this file")])
|
||||
|
||||
AC_CHECK_HEADERS(netinet/in.h)
|
||||
|
||||
SHM_OPEN_LIBS=""
|
||||
AC_MSG_CHECKING([whether shm_open() is present])
|
||||
LIBS_save=${LIBS}
|
||||
LIBS="${LIBS} -lrt"
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[
|
||||
#include <sys/stat.h>
|
||||
#include <sys/mman.h>
|
||||
#include <fcntl.h>
|
||||
]],
|
||||
[[
|
||||
int fd;
|
||||
fd = shm_open("/", O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
|
||||
shm_unlink("/");
|
||||
]])],
|
||||
[
|
||||
have_shm_open="yes"
|
||||
AC_DEFINE(HAVE_SHM_OPEN, 1, [Have shm_open() call])
|
||||
SHM_OPEN_LIBS="-lrt"
|
||||
],
|
||||
[have_shm_open="no"])
|
||||
LIBS=${LIBS_save}
|
||||
AC_MSG_RESULT([${have_shm_open}])
|
||||
AC_SUBST(SHM_OPEN_LIBS)
|
||||
|
||||
### Checks for compiler characteristics
|
||||
AM_PROG_CC_C_O
|
||||
AC_C_CONST
|
||||
AC_C_INLINE
|
||||
AC_PROG_CC_STDC
|
||||
AC_C___ATTRIBUTE__
|
||||
|
||||
### Checks for library functions
|
||||
AC_ISC_POSIX
|
||||
AC_FUNC_ALLOCA
|
||||
|
||||
AC_OUTPUT([
|
||||
Makefile
|
||||
src/Makefile
|
||||
src/bin/Makefile
|
||||
src/bin/xcf/Makefile
|
||||
])
|
|
@ -0,0 +1,47 @@
|
|||
dnl Copyright (C) 2004-2008 Kim Woelders
|
||||
dnl Copyright (C) 2008 Vincent Torri <vtorri at univ-evry dot fr>
|
||||
dnl That code is public domain and can be freely used or copied.
|
||||
dnl Originally snatched from somewhere...
|
||||
|
||||
dnl Macro for checking if the compiler supports __attribute__
|
||||
|
||||
dnl Usage: AC_C___ATTRIBUTE__
|
||||
dnl call AC_DEFINE for HAVE___ATTRIBUTE__ and __UNUSED__
|
||||
dnl if the compiler supports __attribute__, HAVE___ATTRIBUTE__ is
|
||||
dnl defined to 1 and __UNUSED__ is defined to __attribute__((unused))
|
||||
dnl otherwise, HAVE___ATTRIBUTE__ is not defined and __UNUSED__ is
|
||||
dnl defined to nothing.
|
||||
|
||||
AC_DEFUN([AC_C___ATTRIBUTE__],
|
||||
[
|
||||
|
||||
AC_MSG_CHECKING([for __attribute__])
|
||||
|
||||
AC_CACHE_VAL([ac_cv___attribute__],
|
||||
[AC_TRY_COMPILE(
|
||||
[
|
||||
#include <stdlib.h>
|
||||
|
||||
int func(int x);
|
||||
int foo(int x __attribute__ ((unused)))
|
||||
{
|
||||
exit(1);
|
||||
}
|
||||
],
|
||||
[],
|
||||
[ac_cv___attribute__="yes"],
|
||||
[ac_cv___attribute__="no"]
|
||||
)])
|
||||
|
||||
AC_MSG_RESULT($ac_cv___attribute__)
|
||||
|
||||
if test "x${ac_cv___attribute__}" = "xyes" ; then
|
||||
AC_DEFINE([HAVE___ATTRIBUTE__], [1], [Define to 1 if your compiler has __attribute__])
|
||||
AC_DEFINE([__UNUSED__], [__attribute__((unused))], [Macro declaring a function argument to be unused])
|
||||
else
|
||||
AC_DEFINE([__UNUSED__], [], [Macro declaring a function argument to be unused])
|
||||
fi
|
||||
|
||||
])
|
||||
|
||||
dnl End of ac_attribute.m4
|
|
@ -0,0 +1,137 @@
|
|||
dnl @synopsis AC_PATH_GENERIC(LIBRARY [, MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
|
||||
dnl
|
||||
dnl Runs a LIBRARY-config script and defines LIBRARY_CFLAGS and LIBRARY_LIBS
|
||||
dnl
|
||||
dnl The script must support `--cflags' and `--libs' args.
|
||||
dnl If MINIMUM-VERSION is specified, the script must also support the
|
||||
dnl `--version' arg.
|
||||
dnl If the `--with-library-[exec-]prefix' arguments to ./configure are given,
|
||||
dnl it must also support `--prefix' and `--exec-prefix'.
|
||||
dnl (In other words, it must be like gtk-config.)
|
||||
dnl
|
||||
dnl For example:
|
||||
dnl
|
||||
dnl AC_PATH_GENERIC(Foo, 1.0.0)
|
||||
dnl
|
||||
dnl would run `foo-config --version' and check that it is at least 1.0.0
|
||||
dnl
|
||||
dnl If so, the following would then be defined:
|
||||
dnl
|
||||
dnl FOO_CFLAGS to `foo-config --cflags`
|
||||
dnl FOO_LIBS to `foo-config --libs`
|
||||
dnl
|
||||
dnl At present there is no support for additional "MODULES" (see AM_PATH_GTK)
|
||||
dnl (shamelessly stolen from gtk.m4 and then hacked around a fair amount)
|
||||
dnl
|
||||
dnl @author Angus Lees <gusl@cse.unsw.edu.au>
|
||||
|
||||
AC_DEFUN([AC_PATH_GENERIC],
|
||||
[dnl
|
||||
dnl we're going to need uppercase, lowercase and user-friendly versions of the
|
||||
dnl string `LIBRARY'
|
||||
pushdef([UP], translit([$1], [a-z], [A-Z]))dnl
|
||||
pushdef([DOWN], translit([$1], [A-Z], [a-z]))dnl
|
||||
|
||||
dnl
|
||||
dnl Get the cflags and libraries from the LIBRARY-config script
|
||||
dnl
|
||||
AC_ARG_WITH(DOWN-prefix,
|
||||
[ --with-]DOWN[-prefix=PFX Prefix where $1 is installed (optional)],
|
||||
DOWN[]_config_prefix="$withval", DOWN[]_config_prefix="")
|
||||
AC_ARG_WITH(DOWN-exec-prefix,
|
||||
[ --with-]DOWN[-exec-prefix=PFX Exec prefix where $1 is installed (optional)],
|
||||
DOWN[]_config_exec_prefix="$withval", DOWN[]_config_exec_prefix="")
|
||||
|
||||
if test x$DOWN[]_config_exec_prefix != x ; then
|
||||
DOWN[]_config_args="$DOWN[]_config_args --exec-prefix=$DOWN[]_config_exec_prefix"
|
||||
if test x${UP[]_CONFIG+set} != xset ; then
|
||||
UP[]_CONFIG=$DOWN[]_config_exec_prefix/bin/DOWN-config
|
||||
fi
|
||||
fi
|
||||
if test x$DOWN[]_config_prefix != x ; then
|
||||
DOWN[]_config_args="$DOWN[]_config_args --prefix=$DOWN[]_config_prefix"
|
||||
if test x${UP[]_CONFIG+set} != xset ; then
|
||||
UP[]_CONFIG=$DOWN[]_config_prefix/bin/DOWN-config
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_PATH_PROG(UP[]_CONFIG, DOWN-config, no)
|
||||
ifelse([$2], ,
|
||||
AC_MSG_CHECKING(for $1),
|
||||
AC_MSG_CHECKING(for $1 - version >= $2)
|
||||
)
|
||||
no_[]DOWN=""
|
||||
if test "$UP[]_CONFIG" = "no" ; then
|
||||
no_[]DOWN=yes
|
||||
else
|
||||
UP[]_CFLAGS="`$UP[]_CONFIG $DOWN[]_config_args --cflags`"
|
||||
UP[]_LIBS="`$UP[]_CONFIG $DOWN[]_config_args --libs`"
|
||||
ifelse([$2], , ,[
|
||||
DOWN[]_config_major_version=`$UP[]_CONFIG $DOWN[]_config_args \
|
||||
--version | sed 's/[[^0-9]]*\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\).*/\1/'`
|
||||
DOWN[]_config_minor_version=`$UP[]_CONFIG $DOWN[]_config_args \
|
||||
--version | sed 's/[[^0-9]]*\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\).*/\2/'`
|
||||
DOWN[]_config_micro_version=`$UP[]_CONFIG $DOWN[]_config_args \
|
||||
--version | sed 's/[[^0-9]]*\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\).*/\3/'`
|
||||
DOWN[]_wanted_major_version="regexp($2, [\<\([0-9]*\)], [\1])"
|
||||
DOWN[]_wanted_minor_version="regexp($2, [\<\([0-9]*\)\.\([0-9]*\)], [\2])"
|
||||
DOWN[]_wanted_micro_version="regexp($2, [\<\([0-9]*\).\([0-9]*\).\([0-9]*\)], [\3])"
|
||||
|
||||
# Compare wanted version to what config script returned.
|
||||
# If I knew what library was being run, i'd probably also compile
|
||||
# a test program at this point (which also extracted and tested
|
||||
# the version in some library-specific way)
|
||||
if test "$DOWN[]_config_major_version" -lt \
|
||||
"$DOWN[]_wanted_major_version" \
|
||||
-o \( "$DOWN[]_config_major_version" -eq \
|
||||
"$DOWN[]_wanted_major_version" \
|
||||
-a "$DOWN[]_config_minor_version" -lt \
|
||||
"$DOWN[]_wanted_minor_version" \) \
|
||||
-o \( "$DOWN[]_config_major_version" -eq \
|
||||
"$DOWN[]_wanted_major_version" \
|
||||
-a "$DOWN[]_config_minor_version" -eq \
|
||||
"$DOWN[]_wanted_minor_version" \
|
||||
-a "$DOWN[]_config_micro_version" -lt \
|
||||
"$DOWN[]_wanted_micro_version" \) ; then
|
||||
# older version found
|
||||
no_[]DOWN=yes
|
||||
echo -n "*** An old version of $1 "
|
||||
echo -n "($DOWN[]_config_major_version"
|
||||
echo -n ".$DOWN[]_config_minor_version"
|
||||
echo ".$DOWN[]_config_micro_version) was found."
|
||||
echo -n "*** You need a version of $1 newer than "
|
||||
echo -n "$DOWN[]_wanted_major_version"
|
||||
echo -n ".$DOWN[]_wanted_minor_version"
|
||||
echo ".$DOWN[]_wanted_micro_version."
|
||||
echo "***"
|
||||
echo "*** If you have already installed a sufficiently new version, this error"
|
||||
echo "*** probably means that the wrong copy of the DOWN-config shell script is"
|
||||
echo "*** being found. The easiest way to fix this is to remove the old version"
|
||||
echo "*** of $1, but you can also set the UP[]_CONFIG environment to point to the"
|
||||
echo "*** correct copy of DOWN-config. (In this case, you will have to"
|
||||
echo "*** modify your LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf"
|
||||
echo "*** so that the correct libraries are found at run-time)"
|
||||
fi
|
||||
])
|
||||
fi
|
||||
if test "x$no_[]DOWN" = x ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$3], , :, [$3])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test "$UP[]_CONFIG" = "no" ; then
|
||||
echo "*** The DOWN-config script installed by $1 could not be found"
|
||||
echo "*** If $1 was installed in PREFIX, make sure PREFIX/bin is in"
|
||||
echo "*** your path, or set the UP[]_CONFIG environment variable to the"
|
||||
echo "*** full path to DOWN-config."
|
||||
fi
|
||||
UP[]_CFLAGS=""
|
||||
UP[]_LIBS=""
|
||||
ifelse([$4], , :, [$4])
|
||||
fi
|
||||
AC_SUBST(UP[]_CFLAGS)
|
||||
AC_SUBST(UP[]_LIBS)
|
||||
|
||||
popdef([UP])
|
||||
popdef([DOWN])
|
||||
])
|
|
@ -0,0 +1,3 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
SUBDIRS = bin
|
|
@ -0,0 +1,3 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
SUBDIRS = xcf
|
|
@ -0,0 +1,21 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-I$(top_srcdir) \
|
||||
-I$(top_srcdir)/src \
|
||||
-I$(top_srcdir)/src/bin \
|
||||
-I$(top_srcdir)/src/bin/xcf \
|
||||
-DPACKAGE_BIN_DIR=\"$(bindir)\" \
|
||||
-DPACKAGE_LIB_DIR=\"$(libdir)\" \
|
||||
-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
|
||||
@EINA_CFLAGS@
|
||||
|
||||
bin_PROGRAMS = evas_image_loader.xcf
|
||||
|
||||
evas_image_loader_xcf_SOURCES = main.c pixelfuncs.c common.h
|
||||
evas_image_loader_xcf_CFLAGS = @EINA_CFLAGS@
|
||||
evas_image_loader_xcf_LDADD = @EINA_LIBS@ -lz -lm @SHM_OPEN_LIBS@
|
||||
evas_image_loader_xcf_LDFLAGS =
|
||||
|
||||
install-data-hook:
|
||||
ln -sf evas_image_loader.xcf $(DESTDIR)$(bindir)/evas_image_loader.xcf.gz
|
|
@ -0,0 +1,49 @@
|
|||
#ifndef __COMMON
|
||||
#define __COMMON 1
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <math.h>
|
||||
#include <netinet/in.h>
|
||||
#include <time.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <zlib.h>
|
||||
|
||||
#define DATABIG unsigned long long
|
||||
#define DATA64 unsigned long long
|
||||
#define DATA32 unsigned int
|
||||
#define DATA16 unsigned short
|
||||
#define DATA8 unsigned char
|
||||
|
||||
#ifndef WORDS_BIGENDIAN
|
||||
|
||||
#define A_VAL(p) ((DATA8 *)(p))[3]
|
||||
#define R_VAL(p) ((DATA8 *)(p))[2]
|
||||
#define G_VAL(p) ((DATA8 *)(p))[1]
|
||||
#define B_VAL(p) ((DATA8 *)(p))[0]
|
||||
|
||||
#else
|
||||
|
||||
#define A_VAL(p) ((DATA8 *)(p))[0]
|
||||
#define R_VAL(p) ((DATA8 *)(p))[1]
|
||||
#define G_VAL(p) ((DATA8 *)(p))[2]
|
||||
#define B_VAL(p) ((DATA8 *)(p))[3]
|
||||
|
||||
#endif
|
||||
|
||||
/* #define XCF_DBG */
|
||||
|
||||
#ifdef XCF_DBG
|
||||
#define D(fmt, args...) fprintf(stderr, fmt, ## args)
|
||||
#else
|
||||
#define D(fmt, args...)
|
||||
#endif
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,758 @@
|
|||
/*
|
||||
|
||||
-----------------------------[ XCF Loader ]-----------------------------
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#define RS R_VAL(src + s_idx)
|
||||
#define GS G_VAL(src + s_idx)
|
||||
#define BS B_VAL(src + s_idx)
|
||||
#define AS A_VAL(src + s_idx)
|
||||
#define RD R_VAL(dest + d_idx)
|
||||
#define GD G_VAL(dest + d_idx)
|
||||
#define BD B_VAL(dest + d_idx)
|
||||
#define AD A_VAL(dest + d_idx)
|
||||
|
||||
#define EPS 0.00001
|
||||
#define PI 3.141592654
|
||||
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
#define INT_MULT(a,b,t) ((t) = (a) * (b) + 0x80, ((((t) >> 8) + (t)) >> 8))
|
||||
#define LINEAR(x,y,w) ((w*y + x)*4)
|
||||
|
||||
void
|
||||
rgb_to_hls (DATA8 *red, DATA8 *green, DATA8 *blue)
|
||||
{
|
||||
int r, g, b;
|
||||
double h, l, s;
|
||||
int min, max;
|
||||
int delta;
|
||||
|
||||
r = *red;
|
||||
g = *green;
|
||||
b = *blue;
|
||||
|
||||
if (r > g)
|
||||
{
|
||||
max = MAX (r, b);
|
||||
min = MIN (g, b);
|
||||
}
|
||||
else
|
||||
{
|
||||
max = MAX (g, b);
|
||||
min = MIN (r, b);
|
||||
}
|
||||
|
||||
l = (max + min) / 2.0;
|
||||
|
||||
if (max == min)
|
||||
{
|
||||
s = 0.0;
|
||||
h = 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
delta = (max - min);
|
||||
|
||||
if (l < 128)
|
||||
s = 255 * (double) delta / (double) (max + min);
|
||||
else
|
||||
s = 255 * (double) delta / (double) (511 - max - min);
|
||||
|
||||
if (r == max)
|
||||
h = (g - b) / (double) delta;
|
||||
else if (g == max)
|
||||
h = 2 + (b - r) / (double) delta;
|
||||
else
|
||||
h = 4 + (r - g) / (double) delta;
|
||||
|
||||
h = h * 42.5;
|
||||
|
||||
if (h < 0)
|
||||
h += 255;
|
||||
else if (h > 255)
|
||||
h -= 255;
|
||||
}
|
||||
|
||||
*red = h;
|
||||
*green = l;
|
||||
*blue = s;
|
||||
}
|
||||
|
||||
|
||||
DATA8
|
||||
gimp_hls_value (double n1, double n2, double hue)
|
||||
{
|
||||
double value;
|
||||
|
||||
if (hue > 255)
|
||||
hue -= 255;
|
||||
else if (hue < 0)
|
||||
hue += 255;
|
||||
if (hue < 42.5)
|
||||
value = n1 + (n2 - n1) * (hue / 42.5);
|
||||
else if (hue < 127.5)
|
||||
value = n2;
|
||||
else if (hue < 170)
|
||||
value = n1 + (n2 - n1) * ((170 - hue) / 42.5);
|
||||
else
|
||||
value = n1;
|
||||
|
||||
return (DATA8) (value * 255);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
hls_to_rgb (DATA8 *hue, DATA8 *lightness, DATA8 *saturation)
|
||||
{
|
||||
double h, l, s;
|
||||
double m1, m2;
|
||||
|
||||
h = *hue;
|
||||
l = *lightness;
|
||||
s = *saturation;
|
||||
|
||||
if (s == 0)
|
||||
{
|
||||
/* achromatic case */
|
||||
*hue = l;
|
||||
*lightness = l;
|
||||
*saturation = l;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (l < 128)
|
||||
m2 = (l * (255 + s)) / 65025.0;
|
||||
else
|
||||
m2 = (l + s - (l * s) / 255.0) / 255.0;
|
||||
|
||||
m1 = (l / 127.5) - m2;
|
||||
|
||||
/* chromatic case */
|
||||
*hue = gimp_hls_value (m1, m2, h + 85);
|
||||
*lightness = gimp_hls_value (m1, m2, h);
|
||||
*saturation = gimp_hls_value (m1, m2, h - 85);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
rgb_to_hsv (DATA8 *red, DATA8 *green, DATA8 *blue)
|
||||
{
|
||||
int r, g, b;
|
||||
double h, s, v;
|
||||
int min, max;
|
||||
int delta;
|
||||
|
||||
h = 0.0;
|
||||
|
||||
r = *red;
|
||||
g = *green;
|
||||
b = *blue;
|
||||
|
||||
if (r > g)
|
||||
{
|
||||
max = MAX (r, b);
|
||||
min = MIN (g, b);
|
||||
}
|
||||
else
|
||||
{
|
||||
max = MAX (g, b);
|
||||
min = MIN (r, b);
|
||||
}
|
||||
|
||||
v = max;
|
||||
|
||||
if (max != 0)
|
||||
s = ((max - min) * 255) / (double) max;
|
||||
else
|
||||
s = 0;
|
||||
|
||||
if (s == 0)
|
||||
h = 0;
|
||||
else
|
||||
{
|
||||
delta = max - min;
|
||||
if (r == max)
|
||||
h = (g - b) / (double) delta;
|
||||
else if (g == max)
|
||||
h = 2 + (b - r) / (double) delta;
|
||||
else if (b == max)
|
||||
h = 4 + (r - g) / (double) delta;
|
||||
h *= 42.5;
|
||||
|
||||
if (h < 0)
|
||||
h += 255;
|
||||
if (h > 255)
|
||||
h -= 255;
|
||||
}
|
||||
|
||||
*red = h;
|
||||
*green = s;
|
||||
*blue = v;
|
||||
}
|
||||
|
||||
void
|
||||
hsv_to_rgb (DATA8 *hue, DATA8 *saturation, DATA8 *value)
|
||||
{
|
||||
double h, s, v;
|
||||
double f, p, q, t;
|
||||
|
||||
if (*saturation == 0)
|
||||
{
|
||||
*hue = *value;
|
||||
*saturation = *value;
|
||||
*value = *value;
|
||||
}
|
||||
else
|
||||
{
|
||||
h = *hue * 6.0 / 255.0;
|
||||
s = *saturation / 255.0;
|
||||
v = *value / 255.0;
|
||||
|
||||
f = h - (int) h;
|
||||
p = v * (1.0 - s);
|
||||
q = v * (1.0 - (s * f));
|
||||
t = v * (1.0 - (s * (1.0 - f)));
|
||||
|
||||
switch ((int) h)
|
||||
{
|
||||
case 0:
|
||||
*hue = v * 255;
|
||||
*saturation = t * 255;
|
||||
*value = p * 255;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
*hue = q * 255;
|
||||
*saturation = v * 255;
|
||||
*value = p * 255;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
*hue = p * 255;
|
||||
*saturation = v * 255;
|
||||
*value = t * 255;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
*hue = p * 255;
|
||||
*saturation = q * 255;
|
||||
*value = v * 255;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
*hue = t * 255;
|
||||
*saturation = p * 255;
|
||||
*value = v * 255;
|
||||
break;
|
||||
|
||||
case 5:
|
||||
*hue = v * 255;
|
||||
*saturation = p * 255;
|
||||
*value = q * 255;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* translate negative destinations */
|
||||
void _clip(int * src_tl_x, int * src_tl_y,
|
||||
int * src_br_x, int * src_br_y,
|
||||
int * dest_x, int * dest_y,
|
||||
int dest_w, int dest_h)
|
||||
{
|
||||
if (*dest_x + *src_br_x >= dest_w)
|
||||
{ *src_br_x -= (*dest_x + *src_br_x) - dest_w; }
|
||||
|
||||
if (*dest_y + *src_br_y >= dest_h)
|
||||
{ *src_br_y -= (*dest_y + *src_br_y) - dest_h; }
|
||||
|
||||
if (*dest_x < 0)
|
||||
{
|
||||
*src_tl_x = -(*dest_x);
|
||||
*dest_x = 0;
|
||||
}
|
||||
if (*dest_y < 0)
|
||||
{
|
||||
*src_tl_y = -(*dest_y);
|
||||
*dest_y = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: make sure layer alpha is used/applied in all cases
|
||||
void
|
||||
combine_pixels_normal (DATA8* src, int src_w, int src_h, DATA8* dest, int dest_w, int dest_h, int dest_x, int dest_y)
|
||||
{
|
||||
int x, y, s_idx, d_idx;
|
||||
int src_tl_x = 0, src_tl_y = 0;
|
||||
int src_br_x = src_w, src_br_y = src_h;
|
||||
|
||||
int b;
|
||||
unsigned char src_alpha;
|
||||
unsigned char new_alpha;
|
||||
float ratio, compl_ratio;
|
||||
long tmp;
|
||||
|
||||
_clip(&src_tl_x, &src_tl_y, &src_br_x, &src_br_y, &dest_x, &dest_y, dest_w, dest_h);
|
||||
|
||||
for (y = src_tl_y; y < src_br_y; y++)
|
||||
for (x = src_tl_x; x < src_br_x; x++)
|
||||
{
|
||||
d_idx = LINEAR((dest_x + x - src_tl_x), (dest_y + y - src_tl_y), dest_w);
|
||||
s_idx = LINEAR(x, y, src_w);
|
||||
|
||||
src_alpha = AS;
|
||||
|
||||
if (src_alpha != 0)
|
||||
{
|
||||
if (src_alpha == 255)
|
||||
new_alpha = src_alpha;
|
||||
else
|
||||
new_alpha = AD + INT_MULT((255 - AD), src_alpha, tmp);
|
||||
|
||||
b = 3;
|
||||
if (new_alpha != 0)
|
||||
{
|
||||
ratio = (float) src_alpha / new_alpha;
|
||||
compl_ratio = 1.0 - ratio;
|
||||
|
||||
do
|
||||
{
|
||||
b--;
|
||||
dest[d_idx + b] =
|
||||
(unsigned char) (src[s_idx + b] * ratio + dest[d_idx + b] * compl_ratio + EPS);
|
||||
}
|
||||
while (b);
|
||||
}
|
||||
|
||||
AD = new_alpha;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
combine_pixels_add (DATA8* src, int src_w, int src_h, DATA8* dest, int dest_w, int dest_h, int dest_x, int dest_y)
|
||||
{
|
||||
int x, y, s_idx, d_idx;
|
||||
int src_tl_x = 0, src_tl_y = 0;
|
||||
int src_br_x = src_w, src_br_y = src_h;
|
||||
int tmp, tmp2;
|
||||
|
||||
_clip(&src_tl_x, &src_tl_y, &src_br_x, &src_br_y, &dest_x, &dest_y, dest_w, dest_h);
|
||||
|
||||
for (y = src_tl_y; y < src_br_y; y++)
|
||||
for (x = src_tl_x; x < src_br_x; x++)
|
||||
{
|
||||
d_idx = LINEAR((dest_x + x - src_tl_x), (dest_y + y - src_tl_y), dest_w);
|
||||
s_idx = LINEAR(x, y, src_w);
|
||||
|
||||
tmp2 = INT_MULT(AS, RS, tmp);
|
||||
tmp = RD + tmp2;
|
||||
RD = (tmp > 255 ? 255 : tmp);
|
||||
|
||||
tmp2 = INT_MULT(AS, GS, tmp);
|
||||
tmp = GD + tmp2;
|
||||
GD = (tmp > 255 ? 255 : tmp);
|
||||
|
||||
tmp2 = INT_MULT(AS, BS, tmp);
|
||||
tmp = BD + tmp2;
|
||||
BD = (tmp > 255 ? 255 : tmp);
|
||||
|
||||
// AD = MIN(AD, AS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
combine_pixels_sub (DATA8* src, int src_w, int src_h, DATA8* dest, int dest_w, int dest_h, int dest_x, int dest_y)
|
||||
{
|
||||
int x, y, s_idx, d_idx;
|
||||
int src_tl_x = 0, src_tl_y = 0;
|
||||
int src_br_x = src_w, src_br_y = src_h;
|
||||
int tmp, tmp2;
|
||||
|
||||
_clip(&src_tl_x, &src_tl_y, &src_br_x, &src_br_y, &dest_x, &dest_y, dest_w, dest_h);
|
||||
|
||||
for (y = src_tl_y; y < src_br_y; y++)
|
||||
for (x = src_tl_x; x < src_br_x; x++)
|
||||
{
|
||||
d_idx = LINEAR((dest_x + x - src_tl_x), (dest_y + y - src_tl_y), dest_w);
|
||||
s_idx = LINEAR(x, y, src_w);
|
||||
|
||||
tmp2 = INT_MULT(AS, RS, tmp);
|
||||
tmp = RD - tmp2;
|
||||
RD = (tmp < 0 ? 0 : tmp);
|
||||
|
||||
tmp2 = INT_MULT(AS, GS, tmp);
|
||||
tmp = GD - tmp2;
|
||||
GD = (tmp < 0 ? 0 : tmp);
|
||||
|
||||
tmp2 = INT_MULT(AS, BS, tmp);
|
||||
tmp = BD - tmp2;
|
||||
BD = (tmp < 0 ? 0 : tmp);
|
||||
|
||||
// AD = MIN(AD, AS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
combine_pixels_diff (DATA8* src, int src_w, int src_h, DATA8* dest, int dest_w, int dest_h, int dest_x, int dest_y)
|
||||
{
|
||||
int x, y, s_idx, d_idx;
|
||||
int src_tl_x = 0, src_tl_y = 0;
|
||||
int src_br_x = src_w, src_br_y = src_h;
|
||||
int tmp, tmp2;
|
||||
|
||||
_clip(&src_tl_x, &src_tl_y, &src_br_x, &src_br_y, &dest_x, &dest_y, dest_w, dest_h);
|
||||
|
||||
for (y = src_tl_y; y < src_br_y; y++)
|
||||
for (x = src_tl_x; x < src_br_x; x++)
|
||||
{
|
||||
d_idx = LINEAR((dest_x + x - src_tl_x), (dest_y + y - src_tl_y), dest_w);
|
||||
s_idx = LINEAR(x, y, src_w);
|
||||
|
||||
tmp2 = INT_MULT(AS, RS, tmp);
|
||||
tmp = RD - tmp2;
|
||||
RD = (tmp < 0 ? -tmp : tmp);
|
||||
|
||||
tmp2 = INT_MULT(AS, GS, tmp);
|
||||
tmp = GD - tmp2;
|
||||
GD = (tmp < 0 ? -tmp : tmp);
|
||||
|
||||
tmp2 = INT_MULT(AS, BS, tmp);
|
||||
tmp = BD - tmp2;
|
||||
BD = (tmp < 0 ? -tmp : tmp);
|
||||
|
||||
// AD = MIN(AD, AS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
combine_pixels_darken (DATA8* src, int src_w, int src_h, DATA8* dest, int dest_w, int dest_h, int dest_x, int dest_y)
|
||||
{
|
||||
int x, y, s_idx, d_idx;
|
||||
int src_tl_x = 0, src_tl_y = 0;
|
||||
int src_br_x = src_w, src_br_y = src_h;
|
||||
|
||||
_clip(&src_tl_x, &src_tl_y, &src_br_x, &src_br_y, &dest_x, &dest_y, dest_w, dest_h);
|
||||
|
||||
for (y = src_tl_y; y < src_br_y; y++)
|
||||
for (x = src_tl_x; x < src_br_x; x++)
|
||||
{
|
||||
d_idx = LINEAR((dest_x + x - src_tl_x), (dest_y + y - src_tl_y), dest_w);
|
||||
s_idx = LINEAR(x, y, src_w);
|
||||
|
||||
RD = MIN(RD, RS);
|
||||
GD = MIN(GD, GS);
|
||||
BD = MIN(BD, BS);
|
||||
|
||||
// AD = MIN(AD, AS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
combine_pixels_lighten (DATA8* src, int src_w, int src_h, DATA8* dest, int dest_w, int dest_h, int dest_x, int dest_y)
|
||||
{
|
||||
int x, y, s_idx, d_idx;
|
||||
int src_tl_x = 0, src_tl_y = 0;
|
||||
int src_br_x = src_w, src_br_y = src_h;
|
||||
|
||||
_clip(&src_tl_x, &src_tl_y, &src_br_x, &src_br_y, &dest_x, &dest_y, dest_w, dest_h);
|
||||
|
||||
for (y = src_tl_y; y < src_br_y; y++)
|
||||
for (x = src_tl_x; x < src_br_x; x++)
|
||||
{
|
||||
d_idx = LINEAR((dest_x + x - src_tl_x), (dest_y + y - src_tl_y), dest_w);
|
||||
s_idx = LINEAR(x, y, src_w);
|
||||
|
||||
RD = MAX(RD, RS);
|
||||
GD = MAX(GD, GS);
|
||||
BD = MAX(BD, BS);
|
||||
|
||||
// AD = MIN(AD, AS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
combine_pixels_mult (DATA8* src, int src_w, int src_h, DATA8* dest, int dest_w, int dest_h, int dest_x, int dest_y)
|
||||
{
|
||||
int x, y, s_idx, d_idx;
|
||||
int src_tl_x = 0, src_tl_y = 0;
|
||||
int src_br_x = src_w, src_br_y = src_h;
|
||||
int tmp, tmp2, tmp3;
|
||||
|
||||
_clip(&src_tl_x, &src_tl_y, &src_br_x, &src_br_y, &dest_x, &dest_y, dest_w, dest_h);
|
||||
|
||||
for (y = src_tl_y; y < src_br_y; y++)
|
||||
for (x = src_tl_x; x < src_br_x; x++)
|
||||
{
|
||||
d_idx = LINEAR((dest_x + x - src_tl_x), (dest_y + y - src_tl_y), dest_w);
|
||||
s_idx = LINEAR(x, y, src_w);
|
||||
|
||||
tmp2 = INT_MULT(RS, AS, tmp);
|
||||
tmp2 = INT_MULT(RD, tmp2, tmp);
|
||||
tmp3 = INT_MULT(RD, (255 - AS), tmp);
|
||||
RD = (tmp2 + tmp3);
|
||||
|
||||
tmp2 = INT_MULT(GS, AS, tmp);
|
||||
tmp2 = INT_MULT(GD, tmp2, tmp);
|
||||
tmp3 = INT_MULT(GD, (255 - AS), tmp);
|
||||
GD = (tmp2 + tmp3);
|
||||
|
||||
tmp2 = INT_MULT(BS, AS, tmp);
|
||||
tmp2 = INT_MULT(BD, tmp2, tmp);
|
||||
tmp3 = INT_MULT(BD, (255 - AS), tmp);
|
||||
BD = (tmp2 + tmp3);
|
||||
|
||||
// AS = MIN(AS, AD);
|
||||
}
|
||||
|
||||
// combine_pixels_normal(src, src_w, src_h, dest, dest_w, dest_h, dest_x, dest_y);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
combine_pixels_div (DATA8* src, int src_w, int src_h, DATA8* dest, int dest_w, int dest_h, int dest_x, int dest_y)
|
||||
{
|
||||
int x, y, s_idx, d_idx;
|
||||
int src_tl_x = 0, src_tl_y = 0;
|
||||
int src_br_x = src_w, src_br_y = src_h;
|
||||
|
||||
_clip(&src_tl_x, &src_tl_y, &src_br_x, &src_br_y, &dest_x, &dest_y, dest_w, dest_h);
|
||||
|
||||
for (y = src_tl_y; y < src_br_y; y++)
|
||||
for (x = src_tl_x; x < src_br_x; x++)
|
||||
{
|
||||
d_idx = LINEAR((dest_x + x - src_tl_x), (dest_y + y - src_tl_y), dest_w);
|
||||
s_idx = LINEAR(x, y, src_w);
|
||||
|
||||
RS = MIN(255, ((float)RD / (RS + 1)) * 256);
|
||||
GS = MIN(255, ((float)GD / (GS + 1)) * 256);
|
||||
BS = MIN(255, ((float)BD / (BS + 1)) * 256);
|
||||
|
||||
// AS = MIN(AD, AS);
|
||||
}
|
||||
|
||||
combine_pixels_normal(src, src_w, src_h, dest, dest_w, dest_h, dest_x, dest_y);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
combine_pixels_screen (DATA8* src, int src_w, int src_h, DATA8* dest, int dest_w, int dest_h, int dest_x, int dest_y)
|
||||
{
|
||||
int x, y, s_idx, d_idx;
|
||||
int src_tl_x = 0, src_tl_y = 0;
|
||||
int src_br_x = src_w, src_br_y = src_h;
|
||||
|
||||
_clip(&src_tl_x, &src_tl_y, &src_br_x, &src_br_y, &dest_x, &dest_y, dest_w, dest_h);
|
||||
|
||||
for (y = src_tl_y; y < src_br_y; y++)
|
||||
for (x = src_tl_x; x < src_br_x; x++)
|
||||
{
|
||||
d_idx = LINEAR((dest_x + x - src_tl_x), (dest_y + y - src_tl_y), dest_w);
|
||||
s_idx = LINEAR(x, y, src_w);
|
||||
|
||||
RD = 255 - (((255 - RD) * (255 - RS)) >> 8);
|
||||
GD = 255 - (((255 - GD) * (255 - GS)) >> 8);
|
||||
BD = 255 - (((255 - BD) * (255 - BS)) >> 8);
|
||||
|
||||
// AD = MIN(AD, AS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
combine_pixels_overlay (DATA8* src, int src_w, int src_h, DATA8* dest, int dest_w, int dest_h, int dest_x, int dest_y)
|
||||
{
|
||||
int x, y, s_idx, d_idx;
|
||||
int src_tl_x = 0, src_tl_y = 0;
|
||||
int src_br_x = src_w, src_br_y = src_h;
|
||||
int tmp_screen, tmp_mult;
|
||||
|
||||
_clip(&src_tl_x, &src_tl_y, &src_br_x, &src_br_y, &dest_x, &dest_y, dest_w, dest_h);
|
||||
|
||||
for (y = src_tl_y; y < src_br_y; y++)
|
||||
for (x = src_tl_x; x < src_br_x; x++)
|
||||
{
|
||||
d_idx = LINEAR((dest_x + x - src_tl_x), (dest_y + y - src_tl_y), dest_w);
|
||||
s_idx = LINEAR(x, y, src_w);
|
||||
|
||||
tmp_screen = 255 - (((255 - RD) * (255 - RS)) >> 8);
|
||||
tmp_mult = (RD * RS) >> 8;
|
||||
RD = (RD * tmp_screen + (255 - RD) * tmp_mult) >> 8;
|
||||
|
||||
tmp_screen = 255 - (((255 - GD) * (255 - GS)) >> 8);
|
||||
tmp_mult = (GD * GS) >> 8;
|
||||
GD = (GD * tmp_screen + (255 - GD) * tmp_mult) >> 8;
|
||||
|
||||
tmp_screen = 255 - (((255 - BD) * (255 - BS)) >> 8);
|
||||
tmp_mult = (BD * BS) >> 8;
|
||||
BD = (BD * tmp_screen + (255 - BD) * tmp_mult) >> 8;
|
||||
|
||||
// AD = MIN(AD, AS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
combine_pixels_hsv (DATA8* src, int src_w, int src_h, DATA8* dest, int dest_w, int dest_h, int dest_x, int dest_y, int mode)
|
||||
{
|
||||
int x, y, s_idx, d_idx;
|
||||
int src_tl_x = 0, src_tl_y = 0;
|
||||
int src_br_x = src_w, src_br_y = src_h;
|
||||
|
||||
_clip(&src_tl_x, &src_tl_y, &src_br_x, &src_br_y, &dest_x, &dest_y, dest_w, dest_h);
|
||||
|
||||
for (y = src_tl_y; y < src_br_y; y++)
|
||||
for (x = src_tl_x; x < src_br_x; x++)
|
||||
{
|
||||
d_idx = LINEAR((dest_x + x - src_tl_x), (dest_y + y - src_tl_y), dest_w);
|
||||
s_idx = LINEAR(x, y, src_w);
|
||||
|
||||
rgb_to_hsv(&RS, &GS, &BS);
|
||||
rgb_to_hsv(&RD, &GD, &BD);
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case 0: /* hue mode */
|
||||
RD = RS;
|
||||
break;
|
||||
case 1: /* saturation mode */
|
||||
GD = GS;
|
||||
break;
|
||||
case 2: /* value mode */
|
||||
BD = BS;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
hsv_to_rgb(&RD, &GD, &BD);
|
||||
// AD = MIN(AD, AS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
combine_pixels_hue (DATA8* src, int src_w, int src_h, DATA8* dest, int dest_w, int dest_h, int dest_x, int dest_y)
|
||||
{
|
||||
combine_pixels_hsv(src, src_w, src_h, dest, dest_w, dest_h, dest_x, dest_y, 0);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
combine_pixels_sat (DATA8* src, int src_w, int src_h, DATA8* dest, int dest_w, int dest_h, int dest_x, int dest_y)
|
||||
{
|
||||
combine_pixels_hsv(src, src_w, src_h, dest, dest_w, dest_h, dest_x, dest_y, 1);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
combine_pixels_val (DATA8* src, int src_w, int src_h, DATA8* dest, int dest_w, int dest_h, int dest_x, int dest_y)
|
||||
{
|
||||
combine_pixels_hsv(src, src_w, src_h, dest, dest_w, dest_h, dest_x, dest_y, 2);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
combine_pixels_col (DATA8* src, int src_w, int src_h, DATA8* dest, int dest_w, int dest_h, int dest_x, int dest_y)
|
||||
{
|
||||
int x, y, s_idx, d_idx;
|
||||
int src_tl_x = 0, src_tl_y = 0;
|
||||
int src_br_x = src_w, src_br_y = src_h;
|
||||
|
||||
_clip(&src_tl_x, &src_tl_y, &src_br_x, &src_br_y, &dest_x, &dest_y, dest_w, dest_h);
|
||||
|
||||
for (y = src_tl_y; y < src_br_y; y++)
|
||||
for (x = src_tl_x; x < src_br_x; x++)
|
||||
{
|
||||
d_idx = LINEAR((dest_x + x - src_tl_x), (dest_y + y - src_tl_y), dest_w);
|
||||
s_idx = LINEAR(x, y, src_w);
|
||||
|
||||
rgb_to_hls(&RS, &GS, &BS);
|
||||
rgb_to_hls(&RD, &GD, &BD);
|
||||
RD = RS;
|
||||
BD = BS;
|
||||
hls_to_rgb(&RD, &GD, &BD);
|
||||
|
||||
// AD = MIN(AD, AS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
combine_pixels_diss (DATA8* src, int src_w, int src_h, DATA8* dest, int dest_w, int dest_h, int dest_x, int dest_y)
|
||||
{
|
||||
int x, y, s_idx, d_idx;
|
||||
int src_tl_x = 0, src_tl_y = 0;
|
||||
int src_br_x = src_w, src_br_y = src_h;
|
||||
|
||||
srand(12345);
|
||||
|
||||
_clip(&src_tl_x, &src_tl_y, &src_br_x, &src_br_y, &dest_x, &dest_y, dest_w, dest_h);
|
||||
|
||||
for (y = src_tl_y; y < src_br_y; y++)
|
||||
for (x = src_tl_x; x < src_br_x; x++)
|
||||
{
|
||||
d_idx = LINEAR((dest_x + x - src_tl_x), (dest_y + y - src_tl_y), dest_w);
|
||||
s_idx = LINEAR(x, y, src_w);
|
||||
|
||||
if ((rand() % 255) < AS)
|
||||
{
|
||||
int b;
|
||||
unsigned char src_alpha;
|
||||
unsigned char new_alpha;
|
||||
float ratio, compl_ratio;
|
||||
long tmp;
|
||||
|
||||
src_alpha = AS;
|
||||
|
||||
if (src_alpha != 0)
|
||||
{
|
||||
if (src_alpha == 255)
|
||||
new_alpha = src_alpha;
|
||||
else
|
||||
new_alpha = AD + INT_MULT((255 - AD), src_alpha, tmp);
|
||||
|
||||
b = 3;
|
||||
if (new_alpha != 0)
|
||||
{
|
||||
ratio = (float) src_alpha / new_alpha;
|
||||
compl_ratio = 1.0 - ratio;
|
||||
|
||||
do
|
||||
{
|
||||
b--;
|
||||
dest[d_idx + b] =
|
||||
(unsigned char) (src[s_idx + b] * ratio + dest[d_idx + b] * compl_ratio + EPS);
|
||||
}
|
||||
while (b);
|
||||
}
|
||||
|
||||
AD = new_alpha;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue