- Modifications to compile ImageMagick

This commit is contained in:
Santi Noreña 2013-02-19 18:37:48 +01:00
parent 615ec83706
commit 83522c16c3
3442 changed files with 57 additions and 412926 deletions

View file

@ -0,0 +1,10 @@
prefix=/home/santi/lms/install
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include/ImageMagick
Name: ImageMagick
Description: ImageMagick - Convert, Edit, and Compose Images (ABI Q16)
Version: 6.8.3
Libs: -L${libdir} -lm -lMagickCore-6.Q16
Cflags: -I${includedir} -fopenmp -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16

View file

@ -0,0 +1,34 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Deprecated as of ImageMagick 6.2.3.
MagickCore Application Programming Interface declarations.
*/
#ifndef _MAGICKCORE_IMAGEMAGICK_DEPRECATED_H
#define _MAGICKCORE_IMAGEMAGICK_DEPRECATED_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#include "magick/MagickCore.h"
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

View file

@ -0,0 +1,10 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@/ImageMagick
Name: ImageMagick
Description: ImageMagick - Convert, Edit, and Compose Images (ABI @MAGICK_ABI_SUFFIX@)
Version: @PACKAGE_VERSION@
Libs: -L${libdir} @MATH_LIBS@ -lMagickCore-@MAGICK_MAJOR_VERSION@.@MAGICK_ABI_SUFFIX@
Cflags: -I${includedir} @MAGICK_PCFLAGS@

View file

@ -0,0 +1,69 @@
.ad l
.nh
.TH Magick-Config 1 "2 May 2002" "ImageMagick"
.SH NAME
Magick-config \- get information about the installed version of ImageMagick
.SH SYNOPSIS
.B Magick-config
.B [--cflags]
.B [--cppflags]
.B [--exec-prefix]
.B [--ldflags]
.B [--libs]
.B [--prefix]
.B [--version]
.SH DESCRIPTION
.B Magick-config
prints the compiler and linker flags required to compile and link programs
that use the
.BR ImageMagick
Application Programmer Interface.
.SH EXAMPLES
To print the version of the installed distribution of
.BR ImageMagick ,
use:
.nf
Magick-config \-\-version
.fi
To compile a program that calls the
.BR ImageMagick
Application Programmer Interface, use:
.nf
cc `Magick-config \-\-cflags \-\-cppflags \-\-ldflags \-\-libs` program.c
.fi
.SH OPTIONS
.TP
.B \-\-cflags
Print the compiler flags that were used to compile
.BR libMagick .
.TP
.B \-\-cppflags
Print the preprocessor flags that are needed to find the
.B ImageMagick
C include files and defines to ensure that the ImageMagick data structures match between
your program and the installed libraries.
.TP
.B \-\-exec-prefix
Print the directory under which target specific binaries and executables are installed.
.TP
.B \-\-ldflags
Print the linker flags that are needed to link with the
.B ImageMagick
library.
.TP
.B \-\-libs
Print the linker flags that are needed to link a program with
.BR libMagick .
.TP
.B \-\-version
Print the version of the
.B ImageMagick
distribution to standard output.
.SH LICENSE
See http://www.imagemagick.org/script/license.php.
.SH AUTHORS
John Cristy, ImageMagick Studio LLC

View file

@ -0,0 +1,61 @@
#!/bin/sh
#
# Configure options script for re-calling MagickCore compilation options
# required to use the MagickCore library.
#
prefix=@prefix@
exec_prefix=@exec_prefix@
usage="\
Usage: Magick-config [--cflags] [--cppflags] [--exec-prefix] [--ldflags] [--libs] [--prefix] [--version]"
if test $# -eq 0; then
echo "${usage}" 1>&2
echo "Example: gcc \`Magick-config --cflags --cppflags\` -o core core.c \`Magick-config --ldflags --libs\`" 1>&2
exit 1
fi
while test $# -gt 0; do
case "$1" in
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) optarg= ;;
esac
case $1 in
--prefix=*)
prefix=$optarg
;;
--prefix)
echo $prefix
;;
--exec-prefix=*)
exec_prefix=$optarg
;;
--exec-prefix)
echo $exec_prefix
;;
--version)
echo '@PACKAGE_VERSION@ Q@QUANTUM_DEPTH@ @MAGICK_HDRI@'
;;
--cflags)
pkg-config --cflags MagickCore
;;
--cxxflags)
pkg-config --cflags MagickCore
;;
--cppflags)
pkg-config --cflags MagickCore
;;
--ldflags)
pkg-config --libs MagickCore
;;
--libs)
pkg-config --libs MagickCore
;;
*)
echo "${usage}" 1>&2
exit 1
;;
esac
shift
done

View file

@ -0,0 +1,10 @@
prefix=/home/santi/lms/install
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include/ImageMagick
Name: MagickCore
Description: MagickCore - C API for ImageMagick (ABI Q16)
Version: 6.8.3
Libs: -L${libdir} -lm -lMagickCore-6.Q16
Cflags: -I${includedir} -fopenmp -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16

View file

@ -0,0 +1,69 @@
.ad l
.nh
.TH MagickCore-Config 1 "2 May 2002" "ImageMagick"
.SH NAME
MagickCore-config \- get information about the installed version of ImageMagick
.SH SYNOPSIS
.B MagickCore-config
.B [--cflags]
.B [--cppflags]
.B [--exec-prefix]
.B [--ldflags]
.B [--libs]
.B [--prefix]
.B [--version]
.SH DESCRIPTION
.B MagickCore-config
prints the compiler and linker flags required to compile and link programs
that use the
.BR ImageMagick
Application Programmer Interface.
.SH EXAMPLES
To print the version of the installed distribution of
.BR ImageMagick ,
use:
.nf
MagickCore-config \-\-version
.fi
To compile a program that calls the
.BR ImageMagick
Application Programmer Interface, use:
.nf
cc `MagickCore-config \-\-cflags \-\-cppflags \-\-ldflags \-\-libs` program.c
.fi
.SH OPTIONS
.TP
.B \-\-cflags
Print the compiler flags that were used to compile
.BR libMagick .
.TP
.B \-\-cppflags
Print the preprocessor flags that are needed to find the
.B ImageMagick
C include files and defines to ensure that the ImageMagick data structures match between
your program and the installed libraries.
.TP
.B \-\-exec-prefix
Print the directory under which target specific binaries and executables are installed.
.TP
.B \-\-ldflags
Print the linker flags that are needed to link with the
.B ImageMagick
library.
.TP
.B \-\-libs
Print the linker flags that are needed to link a program with
.BR libMagick .
.TP
.B \-\-version
Print the version of the
.B ImageMagick
distribution to standard output.
.SH LICENSE
See http://www.imagemagick.org/script/license.php.
.SH AUTHORS
John Cristy, ImageMagick Studio LLC

View file

@ -0,0 +1,61 @@
#!/bin/sh
#
# Configure options script for re-calling MagickCore compilation options
# required to use the MagickCore library.
#
prefix=@prefix@
exec_prefix=@exec_prefix@
usage="\
Usage: MagickCore-config [--cflags] [--cppflags] [--exec-prefix] [--ldflags] [--libs] [--prefix] [--version]"
if test $# -eq 0; then
echo "${usage}" 1>&2
echo "Example: gcc \`MagickCore-config --cflags --cppflags\` -o core core.c \`Magick-config --ldflags --libs\`" 1>&2
exit 1
fi
while test $# -gt 0; do
case "$1" in
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) optarg= ;;
esac
case $1 in
--prefix=*)
prefix=$optarg
;;
--prefix)
echo $prefix
;;
--exec-prefix=*)
exec_prefix=$optarg
;;
--exec-prefix)
echo $exec_prefix
;;
--version)
echo '@PACKAGE_VERSION@ Q@QUANTUM_DEPTH@ @MAGICK_HDRI@'
;;
--cflags)
pkg-config --cflags MagickCore
;;
--cxxflags)
pkg-config --cflags MagickCore
;;
--cppflags)
pkg-config --cflags MagickCore
;;
--ldflags)
pkg-config --libs MagickCore
;;
--libs)
pkg-config --libs MagickCore
;;
*)
echo "${usage}" 1>&2
exit 1
;;
esac
shift
done

View file

@ -0,0 +1,153 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore Application Programming Interface declarations.
*/
#ifndef _MAGICKCORE_CORE_H
#define _MAGICKCORE_CORE_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#if !defined(_MAGICKCORE_CONFIG_H)
# define _MAGICKCORE_CONFIG_H
# if !defined(vms) && !defined(macintosh)
# include "magick/magick-config.h"
# else
# include "magick-config.h"
# endif
#if defined(_magickcore_const) && !defined(const)
# define const _magickcore_const
#endif
#if defined(_magickcore_inline) && !defined(inline)
# define inline _magickcore_inline
#endif
#if defined(_magickcore_restrict) && !defined(restrict)
# define restrict _magickcore_restrict
#endif
# if defined(__cplusplus) || defined(c_plusplus)
# undef inline
# endif
#endif
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <sys/types.h>
#if defined(WIN32) || defined(WIN64)
# define MAGICKCORE_WINDOWS_SUPPORT
#else
# define MAGICKCORE_POSIX_SUPPORT
#endif
#include "magick/method-attribute.h"
#if defined(MAGICKCORE_NAMESPACE_PREFIX)
# include "magick/methods.h"
#endif
#include "magick/magick-type.h"
#include "magick/accelerate.h"
#include "magick/animate.h"
#include "magick/annotate.h"
#include "magick/artifact.h"
#include "magick/attribute.h"
#include "magick/blob.h"
#include "magick/cache.h"
#include "magick/cache-view.h"
#include "magick/channel.h"
#include "magick/cipher.h"
#include "magick/client.h"
#include "magick/coder.h"
#include "magick/color.h"
#include "magick/colorspace.h"
#include "magick/colormap.h"
#include "magick/compare.h"
#include "magick/composite.h"
#include "magick/compress.h"
#include "magick/configure.h"
#include "magick/constitute.h"
#include "magick/decorate.h"
#include "magick/delegate.h"
#include "magick/deprecate.h"
#include "magick/display.h"
#include "magick/distort.h"
#include "magick/distribute-cache.h"
#include "magick/draw.h"
#include "magick/effect.h"
#include "magick/enhance.h"
#include "magick/exception.h"
#include "magick/feature.h"
#include "magick/fourier.h"
#include "magick/fx.h"
#include "magick/gem.h"
#include "magick/geometry.h"
#include "magick/hashmap.h"
#include "magick/histogram.h"
#include "magick/identify.h"
#include "magick/image.h"
#include "magick/image-view.h"
#include "magick/layer.h"
#include "magick/list.h"
#include "magick/locale_.h"
#include "magick/log.h"
#include "magick/magic.h"
#include "magick/magick.h"
#include "magick/matrix.h"
#include "magick/memory_.h"
#include "magick/module.h"
#include "magick/mime.h"
#include "magick/monitor.h"
#include "magick/montage.h"
#include "magick/morphology.h"
#include "magick/option.h"
#include "magick/paint.h"
#include "magick/pixel.h"
#include "magick/pixel-accessor.h"
#include "magick/policy.h"
#include "magick/prepress.h"
#include "magick/profile.h"
#include "magick/property.h"
#include "magick/quantize.h"
#include "magick/quantum.h"
#include "magick/registry.h"
#include "magick/random_.h"
#include "magick/resample.h"
#include "magick/resize.h"
#include "magick/resource_.h"
#include "magick/segment.h"
#include "magick/shear.h"
#include "magick/signature.h"
#include "magick/splay-tree.h"
#include "magick/stream.h"
#include "magick/statistic.h"
#include "magick/string_.h"
#include "magick/timer.h"
#include "magick/token.h"
#include "magick/transform.h"
#include "magick/threshold.h"
#include "magick/type.h"
#include "magick/utility.h"
#include "magick/version.h"
#include "magick/xml-tree.h"
#include "magick/xwindow.h"
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

View file

@ -0,0 +1,10 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@/ImageMagick
Name: MagickCore
Description: MagickCore - C API for ImageMagick (ABI @MAGICK_ABI_SUFFIX@)
Version: @PACKAGE_VERSION@
Libs: -L${libdir} @MATH_LIBS@ -lMagickCore-@MAGICK_MAJOR_VERSION@.@MAGICK_ABI_SUFFIX@
Cflags: -I${includedir} @MAGICK_PCFLAGS@

View file

@ -0,0 +1,471 @@
# Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
# dedicated to making software imaging solutions freely available.
#
# You may not use this file except in compliance with the License. You may
# obtain a copy of the License at
#
# http://www.imagemagick.org/script/license.php
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Makefile for building the MagickCore API.
#
magickincdir = $(INCLUDE_PATH)/magick
magickincarchdir = $(INCLUDEARCH_PATH)/magick
# Headers which are installed
magickinc_HEADERS = \
$(MAGICK_INCLUDE_HDRS)
magickincarch_HEADERS = \
$(MAGICK_INCLUDEARCH_HDRS)
MAGICK_BIN_SCRPTS = \
magick/Magick-config \
magick/MagickCore-config
MAGICK_PKGCONFIG = \
magick/ImageMagick.pc \
magick/MagickCore.pc \
magick/ImageMagick-@MAGICK_MAJOR_VERSION@.@MAGICK_ABI_SUFFIX@.pc \
magick/MagickCore-@MAGICK_MAJOR_VERSION@.@MAGICK_ABI_SUFFIX@.pc
OSX_GCOV_LDFLAG = @OSX_GCOV_LDFLAG@
MAGICK_MANS = \
magick/Magick-config.1 \
magick/MagickCore-config.1
MAGICKCORE_LIBS = magick/libMagickCore-@MAGICK_MAJOR_VERSION@.@MAGICK_ABI_SUFFIX@.la
if WITH_MODULES
magick_libMagickCore_@MAGICK_MAJOR_VERSION@_@MAGICK_ABI_SUFFIX@_la_SOURCES = $(MAGICK_BASE_SRCS) $(MAGICK_PLATFORM_SRCS)
magick_libMagickCore_@MAGICK_MAJOR_VERSION@_@MAGICK_ABI_SUFFIX@_la_LIBADD = $(MAGICK_DEP_LIBS)
else
magick_libMagickCore_@MAGICK_MAJOR_VERSION@_@MAGICK_ABI_SUFFIX@_la_SOURCES = $(MAGICK_BASE_SRCS) $(MAGICK_PLATFORM_SRCS) $(MAGICK_CODER_SRCS) $(MAGICK_FILTER_SRCS)
magick_libMagickCore_@MAGICK_MAJOR_VERSION@_@MAGICK_ABI_SUFFIX@_la_LIBADD = $(MAGICK_DEP_LIBS)
endif # WITH_MODULES
magick_libMagickCore_@MAGICK_MAJOR_VERSION@_@MAGICK_ABI_SUFFIX@_la_CPPFLAGS = -I$(top_builddir)/ltdl -I$(top_srcdir)/ltdl $(LIBRARY_EXTRA_CPPFLAGS)
if HAVE_LD_VERSION_SCRIPT
magick_libMagickCore_@MAGICK_MAJOR_VERSION@_@MAGICK_ABI_SUFFIX@_la_LDFLAGS_VERSION = -Wl,--version-script=$(top_srcdir)/magick/libMagickCore.map
else
magick_libMagickCore_@MAGICK_MAJOR_VERSION@_@MAGICK_ABI_SUFFIX@_la_LDFLAGS_VERSION = -export-symbols-regex ".*"
endif
magick_libMagickCore_@MAGICK_MAJOR_VERSION@_@MAGICK_ABI_SUFFIX@_la_LDFLAGS = -no-undefined \
$(magick_libMagickCore_la_LDFLAGS_VERSION) \
$(OSX_GCOV_LDFLAG) $(MAGICK_LT_RELEASE_OPTS) -version-info \
$(MAGICK_LIBRARY_CURRENT):$(MAGICK_LIBRARY_REVISION):$(MAGICK_LIBRARY_AGE)
magick_libMagickCore_@MAGICK_MAJOR_VERSION@_@MAGICK_ABI_SUFFIX@_la_DEPENDENCIES =
# Library base sources
MAGICK_BASE_SRCS = \
magick/ImageMagick.h \
magick/MagickCore.h \
magick/accelerate.c \
magick/accelerate.h \
magick/animate.c \
magick/animate.h \
magick/animate-private.h \
magick/annotate.c \
magick/annotate.h \
magick/api.h \
magick/artifact.c \
magick/artifact.h \
magick/attribute.c \
magick/attribute.h \
magick/blob.c \
magick/blob.h \
magick/blob-private.h \
magick/cache.c \
magick/cache.h \
magick/cache-private.h \
magick/cache-view.c \
magick/cache-view.h \
magick/channel.c \
magick/channel.h \
magick/cipher.c \
magick/cipher.h \
magick/client.c \
magick/client.h \
magick/coder.c \
magick/coder.h \
magick/color.c \
magick/color.h \
magick/color-private.h \
magick/colormap.c \
magick/colormap.h \
magick/colormap-private.h \
magick/colorspace.c \
magick/colorspace.h \
magick/colorspace-private.h \
magick/compare.c \
magick/compare.h \
magick/composite.c \
magick/composite.h \
magick/composite-private.h \
magick/compress.c \
magick/compress.h \
magick/configure.c \
magick/configure.h \
magick/constitute.c \
magick/constitute.h \
magick/decorate.c \
magick/decorate.h \
magick/distribute-cache.c \
magick/distribute-cache.h \
magick/distribute-cache-private.h \
magick/delegate.c \
magick/delegate.h \
magick/delegate-private.h \
magick/deprecate.c \
magick/deprecate.h \
magick/display.c \
magick/display.h \
magick/display-private.h \
magick/distort.c \
magick/distort.h \
magick/draw.c \
magick/draw.h \
magick/draw-private.h \
magick/effect.c \
magick/effect.h \
magick/enhance.c \
magick/enhance.h \
magick/exception.c \
magick/exception.h \
magick/exception-private.h \
magick/feature.c \
magick/feature.h \
magick/fourier.c \
magick/fourier.h \
magick/fx.c \
magick/fx.h \
magick/fx-private.h \
magick/gem.c \
magick/gem.h \
magick/geometry.c \
magick/geometry.h \
magick/hashmap.c \
magick/hashmap.h \
magick/histogram.c \
magick/histogram.h \
magick/identify.c \
magick/identify.h \
magick/image.c \
magick/image.h \
magick/image-private.h \
magick/image-view.c \
magick/image-view.h \
magick/layer.c \
magick/layer.h \
magick/list.c \
magick/list.h \
magick/locale.c \
magick/locale_.h \
magick/log.c \
magick/log.h \
magick/mac.h \
magick/magic.c \
magick/magic.h \
magick/magick.c \
magick/magick-baseconfig.h \
magick/magick-config.h \
magick/magick-type.h \
magick/magick.h \
magick/matrix.c \
magick/matrix.h \
magick/memory.c \
magick/memory_.h \
magick/memory-private.h \
magick/methods.h \
magick/method-attribute.h \
magick/mime.c \
magick/mime.h \
magick/module.c \
magick/module.h \
magick/monitor.c \
magick/monitor.h \
magick/monitor-private.h \
magick/montage.c \
magick/montage.h \
magick/morphology.c \
magick/morphology.h \
magick/morphology-private.h \
magick/nt-base.h \
magick/nt-feature.h \
magick/option.c \
magick/option.h \
magick/paint.c \
magick/paint.h \
magick/pixel.c \
magick/pixel.h \
magick/pixel-accessor.h \
magick/pixel-private.h \
magick/policy.c \
magick/policy.h \
magick/PreRvIcccm.c \
magick/PreRvIcccm.h \
magick/prepress.c \
magick/prepress.h \
magick/property.c \
magick/property.h \
magick/profile.c \
magick/profile.h \
magick/quantize.c \
magick/quantize.h \
magick/quantum.c \
magick/quantum.h \
magick/quantum-export.c \
magick/quantum-import.c \
magick/quantum-private.h \
magick/random.c \
magick/random_.h \
magick/random-private.h \
magick/registry.c \
magick/registry.h \
magick/resample.c \
magick/resample.h \
magick/resample-private.h \
magick/resize.c \
magick/resize.h \
magick/resize-private.h \
magick/resource.c \
magick/resource_.h \
magick/segment.c \
magick/segment.h \
magick/semaphore.c \
magick/semaphore.h \
magick/semaphore-private.h \
magick/shear.c \
magick/shear.h \
magick/signature.c \
magick/signature.h \
magick/signature-private.h \
magick/splay-tree.c \
magick/splay-tree.h \
magick/static.c \
magick/static.h \
magick/statistic.c \
magick/statistic.h \
magick/stream.c \
magick/stream.h \
magick/stream-private.h \
magick/string.c \
magick/string_.h \
magick/string-private.h \
magick/studio.h \
magick/thread.c \
magick/thread_.h \
magick/thread-private.h \
magick/timer.c \
magick/timer.h \
magick/token.c \
magick/token.h \
magick/token-private.h \
magick/transform.c \
magick/transform.h \
magick/threshold.c \
magick/threshold.h \
magick/type.c \
magick/type.h \
magick/utility.c \
magick/utility.h \
magick/utility-private.h \
magick/version.c \
magick/version.h \
magick/version-private.h \
magick/vms.h \
magick/widget.c \
magick/widget.h \
magick/xml-tree.c \
magick/xml-tree.h \
magick/xwindow.c \
magick/xwindow.h
if WIN32_NATIVE_BUILD
MAGICK_PLATFORM_SRCS = \
magick/nt-base.c \
magick/nt-base.h \
magick/nt-feature.c \
magick/nt-feature.h
else
if CYGWIN_BUILD
MAGICK_PLATFORM_SRCS = \
magick/nt-feature.c \
magick/nt-feature.h
else
MAGICK_PLATFORM_SRCS =
endif # if CYGWIN_BUILD
endif # if WIN32_NATIVE_BUILD
MAGICK_INCLUDE_HDRS = \
magick/ImageMagick.h \
magick/MagickCore.h \
magick/PreRvIcccm.h \
magick/accelerate.h \
magick/animate.h \
magick/annotate.h \
magick/api.h \
magick/artifact.h \
magick/attribute.h \
magick/blob.h \
magick/cache.h \
magick/cache-view.h \
magick/channel.h \
magick/cipher.h \
magick/client.h \
magick/coder.h \
magick/color.h \
magick/colormap.h \
magick/colorspace.h \
magick/compare.h \
magick/composite.h \
magick/compress.h \
magick/configure.h \
magick/constitute.h \
magick/decorate.h \
magick/delegate.h \
magick/deprecate.h \
magick/display.h \
magick/distribute-cache.h \
magick/distort.h \
magick/draw.h \
magick/effect.h \
magick/enhance.h \
magick/exception.h \
magick/feature.h \
magick/fourier.h \
magick/fx.h \
magick/gem.h \
magick/geometry.h \
magick/hashmap.h \
magick/histogram.h \
magick/identify.h \
magick/image.h \
magick/image-view.h \
magick/layer.h \
magick/list.h \
magick/locale_.h \
magick/log.h \
magick/magic.h \
magick/magick.h \
magick/magick-config.h \
magick/magick-type.h \
magick/matrix.h \
magick/memory_.h \
magick/methods.h \
magick/method-attribute.h \
magick/mime.h \
magick/module.h \
magick/monitor.h \
magick/montage.h \
magick/morphology.h \
magick/option.h \
magick/paint.h \
magick/pixel.h \
magick/pixel-accessor.h \
magick/policy.h \
magick/prepress.h \
magick/profile.h \
magick/property.h \
magick/quantize.h \
magick/quantum.h \
magick/random_.h \
magick/registry.h \
magick/resample.h \
magick/resize.h \
magick/resource_.h \
magick/segment.h \
magick/semaphore.h \
magick/shear.h \
magick/signature.h \
magick/splay-tree.h \
magick/statistic.h \
magick/stream.h \
magick/string_.h \
magick/timer.h \
magick/token.h \
magick/transform.h \
magick/threshold.h \
magick/type.h \
magick/utility.h \
magick/version.h \
magick/widget.h \
magick/xml-tree.h \
magick/xwindow.h
MAGICK_NOINST_HDRS = \
magick/animate-private.h \
magick/blob-private.h \
magick/cache-private.h \
magick/color-private.h \
magick/colormap-private.h \
magick/colorspace-private.h \
magick/composite-private.h \
magick/delegate-private.h \
magick/display-private.h \
magick/distribute-cache-private.h \
magick/draw-private.h \
magick/exception-private.h \
magick/fx-private.h \
magick/image-private.h \
magick/mac.h \
magick/memory-private.h \
magick/mime-private.h \
magick/monitor-private.h \
magick/morphology-private.h \
magick/nt-base.h \
magick/nt-feature.h \
magick/pixel-private.h \
magick/quantum-private.h \
magick/random-private.h \
magick/resample-private.h \
magick/resize-private.h \
magick/semaphore-private.h \
magick/signature-private.h \
magick/static.h \
magick/stream-private.h \
magick/string-private.h \
magick/studio.h \
magick/thread_.h \
magick/thread-private.h \
magick/token-private.h \
magick/utility-private.h \
magick/version-private.h \
magick/xwindow-private.h \
magick/vms.h
MAGICK_INCLUDEARCH_HDRS = \
magick/magick-baseconfig.h
MAGICK_EXTRA_DIST = \
magick/Magick-config.in \
magick/MagickCore-config.in \
$(MAGICK_MANS) \
magick/ImageMagick.pc.in \
magick/libMagickCore.map \
magick/MagickCore.pc.in \
magick/config.h_vms \
magick/mac.c \
magick/nt-base.c \
magick/nt-feature.c \
magick/vms.c \
magick/xwdfile.h_vms
# Install magick-baseconfig.h
MAGICK_INSTALL_DATA_LOCAL_TARGETS = magick-install-data-local
magick-install-data-local:
$(mkinstalldirs) $(DESTDIR)$(magickincarchdir)
$(INSTALL_HEADER) magick/magick-baseconfig.h $(DESTDIR)$(magickincarchdir)/magick-baseconfig.h
# Uninstall magick-config.h
MAGICK_UNINSTALL_LOCAL_TARGETS = magick-uninstall-local
magick-uninstall-local:
rm -f $(DESTDIR)$(magickincarchdir)/magick-baseconfig.h

View file

@ -0,0 +1,347 @@
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% %
% IIIII CCCC CCCC CCCC M M %
% I C C C MM MM %
% I C C C M M M %
% I C C C M M %
% IIIII CCCC CCCC CCCC M M %
% %
% MagickCore X11 Compatibility Methods %
% %
% Software Design %
% John Cristy %
% December 1994 %
% %
% %
% Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization %
% dedicated to making software imaging solutions freely available. %
% %
% You may not use this file except in compliance with the License. You may %
% obtain a copy of the License at %
% %
% http://www.imagemagick.org/script/license.php %
% %
% Unless required by applicable law or agreed to in writing, software %
% distributed under the License is distributed on an "AS IS" BASIS, %
% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
% See the License for the specific language governing permissions and %
% limitations under the License. %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
*/
#include "magick/studio.h"
#if defined(MAGICKCORE_X11_DELEGATE)
#include "magick/xwindow-private.h"
#if defined(PRE_R6_ICCCM)
/*
Compatibility methods for pre X11R6 ICCCM.
*/
Status XInitImage(XImage *ximage)
{
Display
display;
ScreenFormat
screen_format;
XImage
*created_ximage,
target_ximage;
/*
Initialize the X image.
*/
screen_format.depth=ximage->depth;
screen_format.bits_per_pixel=(int) ximage->bits_per_pixel;
display.byte_order=ximage->byte_order;
display.bitmap_unit=ximage->bitmap_unit;
display.bitmap_bit_order=ximage->bitmap_bit_order;
display.pixmap_format=(&screen_format);
display.nformats=1;
created_ximage=XCreateImage(&display,(Visual *) NULL,ximage->depth,
ximage->format,ximage->xoffset,(char *) NULL,ximage->width,ximage->height,
ximage->bitmap_pad,ximage->bytes_per_line);
if (created_ximage == (XImage *) NULL)
return(0);
target_ximage=(*ximage);
*ximage=(*created_ximage);
created_ximage->data=(char *) NULL;
XDestroyImage(created_ximage);
ximage->red_mask=target_ximage.red_mask;
ximage->green_mask=target_ximage.green_mask;
ximage->blue_mask=target_ximage.blue_mask;
return(1);
}
#endif
#if defined(PRE_R5_ICCCM)
/*
Compatibility methods for pre X11R5 ICCCM.
*/
void XrmCombineDatabase(XrmDatabase source,XrmDatabase *target,
Bool override)
{
XrmMergeDatabases(source,target);
}
Status XrmCombineFileDatabase(const char *filename,XrmDatabase *target,
Bool override)
{
XrmDatabase
*combined_database,
source;
source=XrmGetFileDatabase(filename);
if (override == MagickFalse)
XrmMergeDatabases(source,target);
return(1);
}
XrmDatabase XrmGetDatabase(Display *display)
{
return(display->db);
}
char *XSetLocaleModifiers(char *modifiers)
{
return((char *) NULL);
}
Bool XSupportsLocale()
{
return(0);
}
#endif
#if defined(PRE_R4_ICCCM)
/*
Compatibility methods for pre X11R4 ICCCM.
*/
XClassHint *XAllocClassHint)
{
return((XClassHint *) AcquireMagickMemory(sizeof(XClassHint)));
}
XIconSize *XAllocIconSize)
{
return((XIconSize *) AcquireMagickMemory(sizeof(XIconSize)));
}
XSizeHints *XAllocSizeHints)
{
return((XSizeHints *) AcquireMagickMemory(sizeof(XSizeHints)));
}
Status XReconfigureWMWindow(Display *display,Window window,int screen_number,
unsigned int value_mask,XWindowChanges *values)
{
return(XConfigureWindow(display,window,value_mask,values));
}
XStandardColormap *XAllocStandardColormap)
{
return((XStandardColormap *) AcquireMagickMemory(sizeof(XStandardColormap)));
}
XWMHints *XAllocWMHints)
{
return((XWMHints *) AcquireMagickMemory(sizeof(XWMHints)));
}
Status XGetGCValues(Display *display,GC gc,size_t mask,
XGCValues *values)
{
return(MagickTrue);
}
Status XGetRGBColormaps(Display *display,Window window,
XStandardColormap **colormap,int *count,Atom property)
{
*count=1;
return(XGetStandardColormap(display,window,*colormap,property));
}
Status XGetWMColormapWindows(Display *display,Window window,
Window **colormap_windows,int *number_windows)
{
Atom
actual_type,
*data,
property;
int
actual_format,
status;
size_t
leftover,
number_items;
property=XInternAtom(display,"WM_COLORMAP_WINDOWS",MagickFalse);
if (property == None)
return(MagickFalse);
/*
Get the window property.
*/
*data=(Atom) NULL;
status=XGetWindowProperty(display,window,property,0L,1000000L,MagickFalse,
XA_WINDOW,&actual_type,&actual_format,&number_items,&leftover,
(unsigned char **) &data);
if (status != Success)
return(MagickFalse);
if ((actual_type != XA_WINDOW) || (actual_format != 32))
{
if (data != (Atom *) NULL)
XFree((char *) data);
return(MagickFalse);
}
*colormap_windows=(Window *) data;
*number_windows=(int) number_items;
return(MagickTrue);
}
Status XGetWMName(Display *display,Window window,XTextProperty *text_property)
{
char
*window_name;
if (XFetchName(display,window,&window_name) == 0)
return(MagickFalse);
text_property->value=(unsigned char *) window_name;
text_property->encoding=XA_STRING;
text_property->format=8;
text_property->nitems=strlen(window_name);
return(MagickTrue);
}
char *XResourceManagerString(Display *display)
{
return(display->xdefaults);
}
void XrmDestroyDatabase(XrmDatabase database)
{
}
void XSetWMIconName(Display *display,Window window,XTextProperty *property)
{
XSetIconName(display,window,property->value);
}
void XSetWMName(Display *display,Window window,XTextProperty *property)
{
XStoreName(display,window,property->value);
}
void XSetWMProperties(Display *display,Window window,
XTextProperty *window_name,XTextProperty *icon_name,char **argv,
int argc,XSizeHints *size_hints,XWMHints *manager_hints,
XClassHint *class_hint)
{
XSetStandardProperties(display,window,window_name->value,icon_name->value,
None,argv,argc,size_hints);
XSetWMHints(display,window,manager_hints);
XSetClassHint(display,window,class_hint);
}
Status XSetWMProtocols(Display *display,Window window,Atom *protocols,
int count)
{
Atom
wm_protocols;
wm_protocols=XInternAtom(display,"WM_PROTOCOLS",MagickFalse);
XChangeProperty(display,window,wm_protocols,XA_ATOM,32,PropModeReplace,
(unsigned char *) protocols,count);
return(MagickTrue);
}
int XStringListToTextProperty(char **argv,int argc,XTextProperty *property)
{
register int
i;
register unsigned int
number_bytes;
XTextProperty
protocol;
number_bytes=0;
for (i=0; i < (ssize_t) argc; i++)
number_bytes+=(unsigned int) ((argv[i] ? strlen(argv[i]) : 0)+1);
protocol.encoding=XA_STRING;
protocol.format=8;
protocol.nitems=0;
if (number_bytes)
protocol.nitems=number_bytes-1;
protocol.value=NULL;
if (number_bytes <= 0)
{
protocol.value=(unsigned char *) AcquireQuantumMemory(1UL,
sizeof(*protocol.value));
if (protocol.value == MagickFalse)
return(MagickFalse);
*protocol.value='\0';
}
else
{
register char
*buffer;
buffer=(char *) AcquireQuantumMemory(number_bytes,sizeof(*buffer));
if (buffer == (char *) NULL)
return(MagickFalse);
protocol.value=(unsigned char *) buffer;
for (i=0; i < (ssize_t) argc; i++)
{
char
*argument;
argument=argv[i];
if (argument == MagickFalse)
*buffer++='\0';
else
{
(void) CopyMagickString(buffer,argument,MaxTextExtent);
buffer+=(strlen(argument)+1);
}
}
}
*property=protocol;
return(MagickTrue);
}
VisualID XVisualIDFromVisual(Visual *visual)
{
return(visual->visualid);
}
Status XWithdrawWindow(Display *display,Window window,int screen)
{
return(XUnmapWindow(display,window));
}
int XWMGeometry(Display *display,int screen,char *user_geometry,
char *default_geometry,unsigned int border_width,XSizeHints *size_hints,
int *x,int *y,int *width,int *height,int *gravity)
{
int
status;
status=XGeometry(display,screen,user_geometry,default_geometry,border_width,
0,0,0,0,x,y,width,height);
*gravity=NorthWestGravity;
return(status);
}
#endif
#endif

View file

@ -0,0 +1,115 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore X11 compatibility methods.
*/
#ifndef _MAGICKCORE_PRER5ICCCM_H
#define _MAGICKCORE_PRER5ICCCM_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#if defined(PRE_R6_ICCCM)
/*
Compatability defines for pre X11R6 ICCCM.
*/
#define XK_KP_Home 0xFF95
#define XK_KP_Left 0xFF96
#define XK_KP_Up 0xFF97
#define XK_KP_Right 0xFF98
#define XK_KP_Down 0xFF99
#define XK_KP_Prior 0xFF9A
#define XK_KP_Page_Up 0xFF9A
#define XK_KP_Next 0xFF9B
#define XK_KP_Page_Down 0xFF9B
#define XK_KP_End 0xFF9C
#define XK_KP_Delete 0xFF9F
extern MagickExport Status
XInitImage(XImage *ximage);
#endif
#if defined(PRE_R5_ICCCM)
extern MagickExport XrmDatabase
XrmGetDatabase();
#endif
#if defined(PRE_R4_ICCCM)
#if defined(vms)
#define XMaxRequestSize(display) 16384
#endif
#define WithdrawnState 0
typedef struct _XTextProperty
{
unsigned char
*value;
Atom
encoding;
int
format;
size_t
nitems;
} XTextProperty;
char
*XResourceManagerString();
extern MagickExport int
XWMGeometry();
extern MagickExport Status
XGetRGBColormaps(),
XGetWMName(),
XReconfigureWMWindow(),
XSetWMProtocols(),
XWithdrawWindow();
extern MagickExport XClassHint
*XAllocClassHint();
extern MagickExport XIconSize
*XAllocIconSize();
extern MagickExport XSizeHints
*XAllocSizeHints();
extern MagickExport XStandardColormap
*XAllocStandardColormap();
extern MagickExport XWMHints
*XAllocWMHints();
extern MagickExport VisualID
XVisualIDFromVisual();
extern MagickExport void
XrmDestroyDatabase(),
XSetWMIconName(),
XSetWMName(),
XSetWMProperties();
#else
#endif
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

View file

@ -0,0 +1,756 @@
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% AAA CCCC CCCC EEEEE L EEEEE RRRR AAA TTTTT EEEEE %
% A A C C E L E R R A A T E %
% AAAAA C C EEE L EEE RRRR AAAAA T EEE %
% A A C C E L E R R A A T E %
% A A CCCC CCCC EEEEE LLLLL EEEEE R R A A T EEEEE %
% %
% %
% MagickCore Acceleration Methods %
% %
% Software Design %
% John Cristy %
% January 2010 %
% %
% %
% Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization %
% dedicated to making software imaging solutions freely available. %
% %
% You may not use this file except in compliance with the License. You may %
% obtain a copy of the License at %
% %
% http://www.imagemagick.org/script/license.php %
% %
% Unless required by applicable law or agreed to in writing, software %
% distributed under the License is distributed on an "AS IS" BASIS, %
% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
% See the License for the specific language governing permissions and %
% limitations under the License. %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Morphology is the the application of various kernals, of any size and even
% shape, to a image in various ways (typically binary, but not always).
%
% Convolution (weighted sum or average) is just one specific type of
% accelerate. Just one that is very common for image bluring and sharpening
% effects. Not only 2D Gaussian blurring, but also 2-pass 1D Blurring.
%
% This module provides not only a general accelerate function, and the ability
% to apply more advanced or iterative morphologies, but also functions for the
% generation of many different types of kernel arrays from user supplied
% arguments. Prehaps even the generation of a kernel from a small image.
*/
/*
Include declarations.
*/
#include "magick/studio.h"
#include "magick/accelerate.h"
#include "magick/artifact.h"
#include "magick/cache.h"
#include "magick/cache-private.h"
#include "magick/cache-view.h"
#include "magick/color-private.h"
#include "magick/enhance.h"
#include "magick/exception.h"
#include "magick/exception-private.h"
#include "magick/gem.h"
#include "magick/hashmap.h"
#include "magick/image.h"
#include "magick/image-private.h"
#include "magick/list.h"
#include "magick/memory_.h"
#include "magick/monitor-private.h"
#include "magick/accelerate.h"
#include "magick/option.h"
#include "magick/prepress.h"
#include "magick/quantize.h"
#include "magick/registry.h"
#include "magick/semaphore.h"
#include "magick/splay-tree.h"
#include "magick/statistic.h"
#include "magick/string_.h"
#include "magick/string-private.h"
#include "magick/token.h"
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% A c c e l e r a t e C o n v o l v e I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% AccelerateConvolveImage() applies a custom convolution kernel to the image.
% It is accelerated by taking advantage of speed-ups offered by executing in
% concert across heterogeneous platforms consisting of CPUs, GPUs, and other
% processors.
%
% The format of the AccelerateConvolveImage method is:
%
% Image *AccelerateConvolveImage(const Image *image,
% const KernelInfo *kernel,Image *convolve_image,
% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o image: the image.
%
% o kernel: the convolution kernel.
%
% o convole_image: the convoleed image.
%
% o exception: return any errors or warnings in this structure.
%
*/
#if defined(MAGICKCORE_OPENCL_SUPPORT)
#if defined(MAGICKCORE_HDRI_SUPPORT)
#define CLOptions "-DMAGICKCORE_HDRI_SUPPORT=1 -DCLQuantum=float " \
"-DCLPixelType=float4 -DQuantumRange=%g -DMagickEpsilon=%g"
#define CLPixelPacket cl_float4
#else
#if (MAGICKCORE_QUANTUM_DEPTH == 8)
#define CLOptions "-DCLQuantum=uchar -DCLPixelType=uchar4 " \
"-DQuantumRange=%g -DMagickEpsilon=%g"
#define CLPixelPacket cl_uchar4
#elif (MAGICKCORE_QUANTUM_DEPTH == 16)
#define CLOptions "-DCLQuantum=ushort -DCLPixelType=ushort4 " \
"-DQuantumRange=%g -DMagickEpsilon=%g"
#define CLPixelPacket cl_ushort4
#elif (MAGICKCORE_QUANTUM_DEPTH == 32)
#define CLOptions "-DCLQuantum=uint -DCLPixelType=uint4 " \
"-DQuantumRange=%g -DMagickEpsilon=%g"
#define CLPixelPacket cl_uint4
#elif (MAGICKCORE_QUANTUM_DEPTH == 64)
#define CLOptions "-DCLQuantum=ussize_t -DCLPixelType=ussize_t4 " \
"-DQuantumRange=%g -DMagickEpsilon=%g"
#define CLPixelPacket cl_ulong4
#endif
#endif
typedef struct _ConvolveInfo
{
cl_context
context;
cl_device_id
*devices;
cl_command_queue
command_queue;
cl_kernel
kernel;
cl_program
program;
cl_mem
pixels,
convolve_pixels;
cl_ulong
width,
height;
cl_uint
matte;
cl_mem
filter;
} ConvolveInfo;
static char
*ConvolveKernel =
"static inline long ClampToCanvas(const long offset,const unsigned long range)\n"
"{\n"
" if (offset < 0L)\n"
" return(0L);\n"
" if (offset >= range)\n"
" return((long) (range-1L));\n"
" return(offset);\n"
"}\n"
"\n"
"static inline CLQuantum ClampToQuantum(const float value)\n"
"{\n"
"#if defined(MAGICKCORE_HDRI_SUPPORT)\n"
" return((CLQuantum) value);\n"
"#else\n"
" if (value < 0.0)\n"
" return((CLQuantum) 0);\n"
" if (value >= (float) QuantumRange)\n"
" return((CLQuantum) QuantumRange);\n"
" return((CLQuantum) (value+0.5));\n"
"#endif\n"
"}\n"
"\n"
"static inline float PerceptibleReciprocal(const float x)\n"
"{\n"
" float sign = x < (float) 0.0 ? (float) -1.0 : (float) 1.0;\n"
" return((sign*x) >= MagickEpsilon ? (float) 1.0/x : sign*((float) 1.0/\n"
" MagickEpsilon));\n"
"}\n"
"\n"
"__kernel void Convolve(const __global CLPixelType *input,\n"
" __constant float *filter,const unsigned long width,const unsigned long height,\n"
" const unsigned int matte,__global CLPixelType *output)\n"
"{\n"
" const unsigned long columns = get_global_size(0);\n"
" const unsigned long rows = get_global_size(1);\n"
"\n"
" const long x = get_global_id(0);\n"
" const long y = get_global_id(1);\n"
"\n"
" const float scale = (1.0/QuantumRange);\n"
" const long mid_width = (width-1)/2;\n"
" const long mid_height = (height-1)/2;\n"
" float4 sum = { 0.0, 0.0, 0.0, 0.0 };\n"
" float gamma = 0.0;\n"
" register unsigned long i = 0;\n"
"\n"
" int method = 0;\n"
" if (matte != false)\n"
" method=1;\n"
" if ((x >= width) && (x < (columns-width-1)) &&\n"
" (y >= height) && (y < (rows-height-1)))\n"
" {\n"
" method=2;\n"
" if (matte != false)\n"
" method=3;\n"
" }\n"
" switch (method)\n"
" {\n"
" case 0:\n"
" {\n"
" for (long v=(-mid_height); v <= mid_height; v++)\n"
" {\n"
" for (long u=(-mid_width); u <= mid_width; u++)\n"
" {\n"
" const long index=ClampToCanvas(y+v,rows)*columns+\n"
" ClampToCanvas(x+u,columns);\n"
" sum.x+=filter[i]*input[index].x;\n"
" sum.y+=filter[i]*input[index].y;\n"
" sum.z+=filter[i]*input[index].z;\n"
" gamma+=filter[i];\n"
" i++;\n"
" }\n"
" }\n"
" break;\n"
" }\n"
" case 1:\n"
" {\n"
" for (long v=(-mid_height); v <= mid_height; v++)\n"
" {\n"
" for (long u=(-mid_width); u <= mid_width; u++)\n"
" {\n"
" const unsigned long index=ClampToCanvas(y+v,rows)*columns+\n"
" ClampToCanvas(x+u,columns);\n"
" const float alpha=scale*input[index].w;\n"
" sum.x+=alpha*filter[i]*input[index].x;\n"
" sum.y+=alpha*filter[i]*input[index].y;\n"
" sum.z+=alpha*filter[i]*input[index].z;\n"
" sum.w+=filter[i]*input[index].w;\n"
" gamma+=alpha*filter[i];\n"
" i++;\n"
" }\n"
" }\n"
" break;\n"
" }\n"
" case 2:\n"
" {\n"
" for (long v=(-mid_height); v <= mid_height; v++)\n"
" {\n"
" for (long u=(-mid_width); u <= mid_width; u++)\n"
" {\n"
" const unsigned long index=(y+v)*columns+(x+u);\n"
" sum.x+=filter[i]*input[index].x;\n"
" sum.y+=filter[i]*input[index].y;\n"
" sum.z+=filter[i]*input[index].z;\n"
" gamma+=filter[i];\n"
" i++;\n"
" }\n"
" }\n"
" break;\n"
" }\n"
" case 3:\n"
" {\n"
" for (long v=(-mid_height); v <= mid_height; v++)\n"
" {\n"
" for (long u=(-mid_width); u <= mid_width; u++)\n"
" {\n"
" const unsigned long index=(y+v)*columns+(x+u);\n"
" const float alpha=scale*input[index].w;\n"
" sum.x+=alpha*filter[i]*input[index].x;\n"
" sum.y+=alpha*filter[i]*input[index].y;\n"
" sum.z+=alpha*filter[i]*input[index].z;\n"
" sum.w+=filter[i]*input[index].w;\n"
" gamma+=alpha*filter[i];\n"
" i++;\n"
" }\n"
" }\n"
" break;\n"
" }\n"
" }\n"
" gamma=PerceptibleReciprocal(gamma);\n"
" const unsigned long index = y*columns+x;\n"
" output[index].x=ClampToQuantum(gamma*sum.x);\n"
" output[index].y=ClampToQuantum(gamma*sum.y);\n"
" output[index].z=ClampToQuantum(gamma*sum.z);\n"
" if (matte == false)\n"
" output[index].w=input[index].w;\n"
" else\n"
" output[index].w=ClampToQuantum(sum.w);\n"
"}\n";
static void ConvolveNotify(const char *message,const void *data,size_t length,
void *user_context)
{
ExceptionInfo
*exception;
(void) data;
(void) length;
exception=(ExceptionInfo *) user_context;
(void) ThrowMagickException(exception,GetMagickModule(),DelegateWarning,
"DelegateFailed","`%s'",message);
}
static MagickBooleanType BindConvolveParameters(ConvolveInfo *convolve_info,
const Image *image,const void *pixels,float *filter,const size_t width,
const size_t height,void *convolve_pixels)
{
cl_int
status;
register cl_uint
i;
size_t
length;
/*
Allocate OpenCL buffers.
*/
length=image->columns*image->rows;
convolve_info->pixels=clCreateBuffer(convolve_info->context,(cl_mem_flags)
(CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR),length*sizeof(CLPixelPacket),
(void *) pixels,&status);
if ((convolve_info->pixels == (cl_mem) NULL) || (status != CL_SUCCESS))
return(MagickFalse);
length=width*height;
convolve_info->filter=clCreateBuffer(convolve_info->context,(cl_mem_flags)
(CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR),length*sizeof(cl_float),filter,
&status);
if ((convolve_info->filter == (cl_mem) NULL) || (status != CL_SUCCESS))
return(MagickFalse);
length=image->columns*image->rows;
convolve_info->convolve_pixels=clCreateBuffer(convolve_info->context,
(cl_mem_flags) (CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR),length*
sizeof(CLPixelPacket),convolve_pixels,&status);
if ((convolve_info->convolve_pixels == (cl_mem) NULL) ||
(status != CL_SUCCESS))
return(MagickFalse);
/*
Bind OpenCL buffers.
*/
i=0;
status=clSetKernelArg(convolve_info->kernel,i++,sizeof(cl_mem),(void *)
&convolve_info->pixels);
if (status != CL_SUCCESS)
return(MagickFalse);
status=clSetKernelArg(convolve_info->kernel,i++,sizeof(cl_mem),(void *)
&convolve_info->filter);
if (status != CL_SUCCESS)
return(MagickFalse);
convolve_info->width=(cl_ulong) width;
status=clSetKernelArg(convolve_info->kernel,i++,sizeof(cl_ulong),(void *)
&convolve_info->width);
if (status != CL_SUCCESS)
return(MagickFalse);
convolve_info->height=(cl_ulong) height;
status=clSetKernelArg(convolve_info->kernel,i++,sizeof(cl_ulong),(void *)
&convolve_info->height);
if (status != CL_SUCCESS)
return(MagickFalse);
convolve_info->matte=(cl_uint) image->matte;
status=clSetKernelArg(convolve_info->kernel,i++,sizeof(cl_uint),(void *)
&convolve_info->matte);
if (status != CL_SUCCESS)
return(MagickFalse);
status=clSetKernelArg(convolve_info->kernel,i++,sizeof(cl_mem),(void *)
&convolve_info->convolve_pixels);
if (status != CL_SUCCESS)
return(MagickFalse);
status=clFinish(convolve_info->command_queue);
if (status != CL_SUCCESS)
return(MagickFalse);
return(MagickTrue);
}
static void DestroyConvolveBuffers(ConvolveInfo *convolve_info)
{
cl_int
status;
status=0;
if (convolve_info->convolve_pixels != (cl_mem) NULL)
status=clReleaseMemObject(convolve_info->convolve_pixels);
if (convolve_info->pixels != (cl_mem) NULL)
status=clReleaseMemObject(convolve_info->pixels);
if (convolve_info->filter != (cl_mem) NULL)
status=clReleaseMemObject(convolve_info->filter);
(void) status;
}
static ConvolveInfo *DestroyConvolveInfo(ConvolveInfo *convolve_info)
{
cl_int
status;
status=0;
if (convolve_info->kernel != (cl_kernel) NULL)
status=clReleaseKernel(convolve_info->kernel);
if (convolve_info->program != (cl_program) NULL)
status=clReleaseProgram(convolve_info->program);
if (convolve_info->command_queue != (cl_command_queue) NULL)
status=clReleaseCommandQueue(convolve_info->command_queue);
if (convolve_info->context != (cl_context) NULL)
status=clReleaseContext(convolve_info->context);
(void) status;
convolve_info=(ConvolveInfo *) RelinquishMagickMemory(convolve_info);
return(convolve_info);
}
static MagickBooleanType EnqueueConvolveKernel(ConvolveInfo *convolve_info,
const Image *image,const void *pixels,float *filter,const size_t width,
const size_t height,void *convolve_pixels)
{
cl_int
status;
size_t
global_work_size[2],
length;
length=image->columns*image->rows;
status=clEnqueueWriteBuffer(convolve_info->command_queue,
convolve_info->pixels,CL_TRUE,0,length*sizeof(CLPixelPacket),pixels,0,NULL,
NULL);
length=width*height;
status=clEnqueueWriteBuffer(convolve_info->command_queue,
convolve_info->filter,CL_TRUE,0,length*sizeof(cl_float),filter,0,NULL,
NULL);
if (status != CL_SUCCESS)
return(MagickFalse);
global_work_size[0]=image->columns;
global_work_size[1]=image->rows;
status=clEnqueueNDRangeKernel(convolve_info->command_queue,
convolve_info->kernel,2,NULL,global_work_size,NULL,0,NULL,NULL);
if (status != CL_SUCCESS)
return(MagickFalse);
length=image->columns*image->rows;
status=clEnqueueReadBuffer(convolve_info->command_queue,
convolve_info->convolve_pixels,CL_TRUE,0,length*sizeof(CLPixelPacket),
convolve_pixels,0,NULL,NULL);
if (status != CL_SUCCESS)
return(MagickFalse);
status=clFinish(convolve_info->command_queue);
if (status != CL_SUCCESS)
return(MagickFalse);
return(MagickTrue);
}
static ConvolveInfo *GetConvolveInfo(const Image *image,const char *name,
const char *source,ExceptionInfo *exception)
{
char
options[MaxTextExtent];
cl_context_properties
context_properties[3];
cl_int
status;
cl_platform_id
platforms[1];
cl_uint
number_platforms;
ConvolveInfo
*convolve_info;
size_t
length,
lengths[] = { strlen(source) };
/*
Create OpenCL info.
*/
convolve_info=(ConvolveInfo *) AcquireMagickMemory(sizeof(*convolve_info));
if (convolve_info == (ConvolveInfo *) NULL)
{
(void) ThrowMagickException(exception,GetMagickModule(),
ResourceLimitError,"MemoryAllocationFailed","`%s'",image->filename);
return((ConvolveInfo *) NULL);
}
(void) ResetMagickMemory(convolve_info,0,sizeof(*convolve_info));
/*
Create OpenCL context.
*/
status=clGetPlatformIDs(0,(cl_platform_id *) NULL,&number_platforms);
if ((status == CL_SUCCESS) && (number_platforms > 0))
status=clGetPlatformIDs(1,platforms,NULL);
if (status != CL_SUCCESS)
{
(void) ThrowMagickException(exception,GetMagickModule(),DelegateWarning,
"failed to create OpenCL context","`%s' (%d)",image->filename,status);
convolve_info=DestroyConvolveInfo(convolve_info);
return((ConvolveInfo *) NULL);
}
context_properties[0]=CL_CONTEXT_PLATFORM;
context_properties[1]=(cl_context_properties) platforms[0];
context_properties[2]=0;
convolve_info->context=clCreateContextFromType(context_properties,
(cl_device_type) CL_DEVICE_TYPE_GPU,ConvolveNotify,exception,&status);
if ((convolve_info->context == (cl_context) NULL) || (status != CL_SUCCESS))
convolve_info->context=clCreateContextFromType(context_properties,
(cl_device_type) CL_DEVICE_TYPE_CPU,ConvolveNotify,exception,&status);
if ((convolve_info->context == (cl_context) NULL) || (status != CL_SUCCESS))
convolve_info->context=clCreateContextFromType(context_properties,
(cl_device_type) CL_DEVICE_TYPE_DEFAULT,ConvolveNotify,exception,&status);
if ((convolve_info->context == (cl_context) NULL) || (status != CL_SUCCESS))
{
(void) ThrowMagickException(exception,GetMagickModule(),DelegateWarning,
"failed to create OpenCL context","`%s' (%d)",image->filename,status);
convolve_info=DestroyConvolveInfo(convolve_info);
return((ConvolveInfo *) NULL);
}
/*
Detect OpenCL devices.
*/
status=clGetContextInfo(convolve_info->context,CL_CONTEXT_DEVICES,0,NULL,
&length);
if ((status != CL_SUCCESS) || (length == 0))
{
convolve_info=DestroyConvolveInfo(convolve_info);
return((ConvolveInfo *) NULL);
}
convolve_info->devices=(cl_device_id *) AcquireMagickMemory(length);
if (convolve_info->devices == (cl_device_id *) NULL)
{
(void) ThrowMagickException(exception,GetMagickModule(),
ResourceLimitError,"MemoryAllocationFailed","`%s'",image->filename);
convolve_info=DestroyConvolveInfo(convolve_info);
return((ConvolveInfo *) NULL);
}
status=clGetContextInfo(convolve_info->context,CL_CONTEXT_DEVICES,length,
convolve_info->devices,NULL);
if (status != CL_SUCCESS)
{
convolve_info=DestroyConvolveInfo(convolve_info);
return((ConvolveInfo *) NULL);
}
if (image->debug != MagickFalse)
{
char
attribute[MaxTextExtent];
size_t
length;
clGetDeviceInfo(convolve_info->devices[0],CL_DEVICE_NAME,
sizeof(attribute),attribute,&length);
(void) LogMagickEvent(AccelerateEvent,GetMagickModule(),"Name: %s",
attribute);
clGetDeviceInfo(convolve_info->devices[0],CL_DEVICE_VENDOR,
sizeof(attribute),attribute,&length);
(void) LogMagickEvent(AccelerateEvent,GetMagickModule(),"Vendor: %s",
attribute);
clGetDeviceInfo(convolve_info->devices[0],CL_DEVICE_VERSION,
sizeof(attribute),attribute,&length);
(void) LogMagickEvent(AccelerateEvent,GetMagickModule(),
"Driver Version: %s",attribute);
clGetDeviceInfo(convolve_info->devices[0],CL_DEVICE_PROFILE,
sizeof(attribute),attribute,&length);
(void) LogMagickEvent(AccelerateEvent,GetMagickModule(),"Profile: %s",
attribute);
clGetDeviceInfo(convolve_info->devices[0],CL_DRIVER_VERSION,
sizeof(attribute),attribute,&length);
(void) LogMagickEvent(AccelerateEvent,GetMagickModule(),"Driver: %s",
attribute);
clGetDeviceInfo(convolve_info->devices[0],CL_DEVICE_EXTENSIONS,
sizeof(attribute),attribute,&length);
(void) LogMagickEvent(AccelerateEvent,GetMagickModule(),"Extensions: %s",
attribute);
}
/*
Create OpenCL command queue.
*/
convolve_info->command_queue=clCreateCommandQueue(convolve_info->context,
convolve_info->devices[0],0,&status);
if ((convolve_info->command_queue == (cl_command_queue) NULL) ||
(status != CL_SUCCESS))
{
convolve_info=DestroyConvolveInfo(convolve_info);
return((ConvolveInfo *) NULL);
}
/*
Build OpenCL program.
*/
convolve_info->program=clCreateProgramWithSource(convolve_info->context,1,
&source,lengths,&status);
if ((convolve_info->program == (cl_program) NULL) || (status != CL_SUCCESS))
{
convolve_info=DestroyConvolveInfo(convolve_info);
return((ConvolveInfo *) NULL);
}
(void) FormatLocaleString(options,MaxTextExtent,CLOptions,(float)
QuantumRange,MagickEpsilon);
status=clBuildProgram(convolve_info->program,1,convolve_info->devices,options,
NULL,NULL);
if ((convolve_info->program == (cl_program) NULL) || (status != CL_SUCCESS))
{
char
*log;
status=clGetProgramBuildInfo(convolve_info->program,
convolve_info->devices[0],CL_PROGRAM_BUILD_LOG,0,NULL,&length);
log=(char *) AcquireMagickMemory(length);
if (log == (char *) NULL)
{
convolve_info=DestroyConvolveInfo(convolve_info);
return((ConvolveInfo *) NULL);
}
status=clGetProgramBuildInfo(convolve_info->program,
convolve_info->devices[0],CL_PROGRAM_BUILD_LOG,length,log,&length);
(void) ThrowMagickException(exception,GetMagickModule(),DelegateWarning,
"failed to build OpenCL program","`%s' (%s)",image->filename,log);
log=DestroyString(log);
convolve_info=DestroyConvolveInfo(convolve_info);
return((ConvolveInfo *) NULL);
}
/*
Get a kernel object.
*/
convolve_info->kernel=clCreateKernel(convolve_info->program,name,&status);
if ((convolve_info->kernel == (cl_kernel) NULL) || (status != CL_SUCCESS))
{
convolve_info=DestroyConvolveInfo(convolve_info);
return((ConvolveInfo *) NULL);
}
return(convolve_info);
}
#endif
MagickExport MagickBooleanType AccelerateConvolveImage(const Image *image,
const KernelInfo *kernel,Image *convolve_image,ExceptionInfo *exception)
{
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(kernel != (KernelInfo *) NULL);
assert(kernel->signature == MagickSignature);
assert(convolve_image != (Image *) NULL);
assert(convolve_image->signature == MagickSignature);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
if ((image->storage_class != DirectClass) ||
(image->colorspace == CMYKColorspace))
return(MagickFalse);
if ((GetImageVirtualPixelMethod(image) != UndefinedVirtualPixelMethod) &&
(GetImageVirtualPixelMethod(image) != EdgeVirtualPixelMethod))
return(MagickFalse);
#if !defined(MAGICKCORE_OPENCL_SUPPORT)
return(MagickFalse);
#else
{
const void
*pixels;
float
*filter;
ConvolveInfo
*convolve_info;
MagickBooleanType
status;
MagickSizeType
length;
register ssize_t
i;
void
*convolve_pixels;
convolve_info=GetConvolveInfo(image,"Convolve",ConvolveKernel,exception);
if (convolve_info == (ConvolveInfo *) NULL)
return(MagickFalse);
pixels=AcquirePixelCachePixels(image,&length,exception);
if (pixels == (const void *) NULL)
{
convolve_info=DestroyConvolveInfo(convolve_info);
(void) ThrowMagickException(exception,GetMagickModule(),CacheError,
"UnableToReadPixelCache","`%s'",image->filename);
return(MagickFalse);
}
convolve_pixels=GetPixelCachePixels(convolve_image,&length,exception);
if (convolve_pixels == (void *) NULL)
{
convolve_info=DestroyConvolveInfo(convolve_info);
(void) ThrowMagickException(exception,GetMagickModule(),CacheError,
"UnableToReadPixelCache","`%s'",image->filename);
return(MagickFalse);
}
filter=(float *) AcquireQuantumMemory(kernel->width,kernel->height*
sizeof(*filter));
if (filter == (float *) NULL)
{
DestroyConvolveBuffers(convolve_info);
convolve_info=DestroyConvolveInfo(convolve_info);
(void) ThrowMagickException(exception,GetMagickModule(),
ResourceLimitError,"MemoryAllocationFailed","`%s'",image->filename);
return(MagickFalse);
}
for (i=0; i < (ssize_t) (kernel->width*kernel->height); i++)
filter[i]=(float) kernel->values[i];
status=BindConvolveParameters(convolve_info,image,pixels,filter,
kernel->width,kernel->height,convolve_pixels);
if (status == MagickFalse)
{
filter=(float *) RelinquishMagickMemory(filter);
DestroyConvolveBuffers(convolve_info);
convolve_info=DestroyConvolveInfo(convolve_info);
return(MagickFalse);
}
status=EnqueueConvolveKernel(convolve_info,image,pixels,filter,
kernel->width,kernel->height,convolve_pixels);
filter=(float *) RelinquishMagickMemory(filter);
if (status == MagickFalse)
{
DestroyConvolveBuffers(convolve_info);
convolve_info=DestroyConvolveInfo(convolve_info);
return(MagickFalse);
}
DestroyConvolveBuffers(convolve_info);
convolve_info=DestroyConvolveInfo(convolve_info);
return(MagickTrue);
}
#endif
}

View file

@ -0,0 +1,35 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore acceleration methods.
*/
#ifndef _MAGICKCORE_ACCELERATE_H
#define _MAGICKCORE_ACCELERATE_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#include "magick/morphology.h"
extern MagickExport MagickBooleanType
AccelerateConvolveImage(const Image *,const KernelInfo *,Image *,
ExceptionInfo *);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

View file

@ -0,0 +1,39 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore private methods to interactively animate an image sequence.
*/
#ifndef _MAGICKCORE_ANIMATE_PRIVATE_H
#define _MAGICKCORE_ANIMATE_PRIVATE_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#if defined(MAGICKCORE_X11_DELEGATE)
#include "magick/xwindow-private.h"
extern MagickExport Image
*XAnimateImages(Display *,XResourceInfo *,char **,const int,Image *);
extern MagickExport void
XAnimateBackgroundImage(Display *,XResourceInfo *,Image *);
#endif
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

3037
ImageMagick/magick/animate.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,32 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore methods to interactively animate an image sequence.
*/
#ifndef _MAGICKCORE_ANIMATE_H
#define _MAGICKCORE_ANIMATE_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
extern MagickExport MagickBooleanType
AnimateImages(const ImageInfo *,Image *);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,44 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore image annotation methods.
*/
#ifndef _MAGICKCORE_ANNOTATE_H
#define _MAGICKCORE_ANNOTATE_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#include "magick/draw.h"
extern MagickExport MagickBooleanType
AnnotateComponentGenesis(void),
AnnotateImage(Image *,const DrawInfo *),
GetMultilineTypeMetrics(Image *,const DrawInfo *,TypeMetric *),
GetTypeMetrics(Image *,const DrawInfo *,TypeMetric *);
extern MagickExport ssize_t
FormatMagickCaption(Image *,DrawInfo *,const MagickBooleanType,TypeMetric *,
char **);
extern MagickExport void
AnnotateComponentTerminus(void);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

34
ImageMagick/magick/api.h Normal file
View file

@ -0,0 +1,34 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Deprecated as of ImageMagick 6.2.3.
MagickCore Application Programming Interface declarations.
*/
#ifndef _MAGICKCORE_API_DEPRECATED_H
#define _MAGICKCORE_API_DEPRECATED_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#include "magick/MagickCore.h"
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

View file

@ -0,0 +1,454 @@
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% AAA RRRR TTTTT IIIII FFFFF AAA CCCC TTTTT %
% A A R R T I F A A C T %
% AAAAA RRRRR T I FFF AAAAA C T %
% A A R R T I F A A C T %
% A A R R T IIIII F A A CCCCC T %
% %
% %
% MagickCore Artifact Methods %
% %
% Software Design %
% John Cristy %
% March 2000 %
% %
% %
% Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization %
% dedicated to making software imaging solutions freely available. %
% %
% You may not use this file except in compliance with the License. You may %
% obtain a copy of the License at %
% %
% http://www.imagemagick.org/script/license.php %
% %
% Unless required by applicable law or agreed to in writing, software %
% distributed under the License is distributed on an "AS IS" BASIS, %
% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
% See the License for the specific language governing permissions and %
% limitations under the License. %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
%
*/
/*
Include declarations.
*/
#include "magick/studio.h"
#include "magick/artifact.h"
#include "magick/cache.h"
#include "magick/color.h"
#include "magick/compare.h"
#include "magick/constitute.h"
#include "magick/draw.h"
#include "magick/effect.h"
#include "magick/exception.h"
#include "magick/exception-private.h"
#include "magick/fx.h"
#include "magick/fx-private.h"
#include "magick/gem.h"
#include "magick/geometry.h"
#include "magick/image.h"
#include "magick/layer.h"
#include "magick/list.h"
#include "magick/memory_.h"
#include "magick/monitor.h"
#include "magick/montage.h"
#include "magick/option.h"
#include "magick/profile.h"
#include "magick/quantum.h"
#include "magick/resource_.h"
#include "magick/splay-tree.h"
#include "magick/signature-private.h"
#include "magick/statistic.h"
#include "magick/string_.h"
#include "magick/token.h"
#include "magick/utility.h"
#include "magick/xml-tree.h"
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% C l o n e I m a g e A r t i f a c t s %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% CloneImageArtifacts() clones one or more image artifacts.
%
% The format of the CloneImageArtifacts method is:
%
% MagickBooleanType CloneImageArtifacts(Image *image,
% const Image *clone_image)
%
% A description of each parameter follows:
%
% o image: the image.
%
% o clone_image: the clone image.
%
*/
MagickExport MagickBooleanType CloneImageArtifacts(Image *image,
const Image *clone_image)
{
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(clone_image != (const Image *) NULL);
assert(clone_image->signature == MagickSignature);
if (clone_image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
clone_image->filename);
if (clone_image->artifacts != (void *) NULL)
image->artifacts=CloneSplayTree((SplayTreeInfo *) clone_image->artifacts,
(void *(*)(void *)) ConstantString,(void *(*)(void *)) ConstantString);
return(MagickTrue);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% D e f i n e I m a g e A r t i f a c t %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DefineImageArtifact() associates a key/value pair with an image artifact.
%
% The format of the DefineImageArtifact method is:
%
% MagickBooleanType DefineImageArtifact(Image *image,
% const char *artifact)
%
% A description of each parameter follows:
%
% o image: the image.
%
% o artifact: the image artifact.
%
*/
MagickExport MagickBooleanType DefineImageArtifact(Image *image,
const char *artifact)
{
char
key[MaxTextExtent],
value[MaxTextExtent];
register char
*p;
assert(image != (Image *) NULL);
assert(artifact != (const char *) NULL);
(void) CopyMagickString(key,artifact,MaxTextExtent-1);
for (p=key; *p != '\0'; p++)
if (*p == '=')
break;
*value='\0';
if (*p == '=')
(void) CopyMagickString(value,p+1,MaxTextExtent);
*p='\0';
return(SetImageArtifact(image,key,value));
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% D e l e t e I m a g e A r t i f a c t %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DeleteImageArtifact() deletes an image artifact.
%
% The format of the DeleteImageArtifact method is:
%
% MagickBooleanType DeleteImageArtifact(Image *image,const char *artifact)
%
% A description of each parameter follows:
%
% o image: the image.
%
% o artifact: the image artifact.
%
*/
MagickExport MagickBooleanType DeleteImageArtifact(Image *image,
const char *artifact)
{
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image->filename);
if (image->artifacts == (void *) NULL)
return(MagickFalse);
return(DeleteNodeFromSplayTree((SplayTreeInfo *) image->artifacts,artifact));
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% D e s t r o y I m a g e A r t i f a c t s %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DestroyImageArtifacts() releases memory associated with image artifact
% values.
%
% The format of the DestroyDefines method is:
%
% void DestroyImageArtifacts(Image *image)
%
% A description of each parameter follows:
%
% o image: the image.
%
*/
MagickExport void DestroyImageArtifacts(Image *image)
{
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image->filename);
if (image->artifacts != (void *) NULL)
image->artifacts=(void *) DestroySplayTree((SplayTreeInfo *)
image->artifacts);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% G e t I m a g e A r t i f a c t %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% GetImageArtifact() gets a value associated with an image artifact.
%
% Note, the artifact is a constant. Do not attempt to free it.
%
% The format of the GetImageArtifact method is:
%
% const char *GetImageArtifact(const Image *image,const char *key)
%
% A description of each parameter follows:
%
% o image: the image.
%
% o key: the key.
%
*/
MagickExport const char *GetImageArtifact(const Image *image,
const char *artifact)
{
register const char
*p;
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
p=(const char *) NULL;
if (artifact == (const char *) NULL)
{
ResetSplayTreeIterator((SplayTreeInfo *) image->artifacts);
p=(const char *) GetNextValueInSplayTree((SplayTreeInfo *)
image->artifacts);
return(p);
}
if (image->artifacts != (void *) NULL)
{
p=(const char *) GetValueFromSplayTree((SplayTreeInfo *)
image->artifacts,artifact);
if (p != (const char *) NULL)
return(p);
}
return(p);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% G e t N e x t I m a g e A r t i f a c t %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% GetNextImageArtifact() gets the next image artifact value.
%
% The format of the GetNextImageArtifact method is:
%
% char *GetNextImageArtifact(const Image *image)
%
% A description of each parameter follows:
%
% o image: the image.
%
*/
MagickExport char *GetNextImageArtifact(const Image *image)
{
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image->filename);
if (image->artifacts == (void *) NULL)
return((char *) NULL);
return((char *) GetNextKeyInSplayTree((SplayTreeInfo *) image->artifacts));
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% R e m o v e I m a g e A r t i f a c t %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% RemoveImageArtifact() removes an artifact from the image and returns its
% value.
%
% The format of the RemoveImageArtifact method is:
%
% char *RemoveImageArtifact(Image *image,const char *artifact)
%
% A description of each parameter follows:
%
% o image: the image.
%
% o artifact: the image artifact.
%
*/
MagickExport char *RemoveImageArtifact(Image *image,const char *artifact)
{
char
*value;
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image->filename);
if (image->artifacts == (void *) NULL)
return((char *) NULL);
value=(char *) RemoveNodeFromSplayTree((SplayTreeInfo *) image->artifacts,
artifact);
return(value);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% R e s e t I m a g e A r t i f a c t I t e r a t o r %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ResetImageArtifactIterator() resets the image artifact iterator. Use it
% in conjunction with GetNextImageArtifact() to iterate over all the values
% associated with an image artifact.
%
% The format of the ResetImageArtifactIterator method is:
%
% ResetImageArtifactIterator(Image *image)
%
% A description of each parameter follows:
%
% o image: the image.
%
*/
MagickExport void ResetImageArtifactIterator(const Image *image)
{
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image->filename);
if (image->artifacts == (void *) NULL)
return;
ResetSplayTreeIterator((SplayTreeInfo *) image->artifacts);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% S e t I m a g e A r t i f a c t %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% SetImageArtifact() associates a value with an image artifact.
%
% The format of the SetImageArtifact method is:
%
% MagickBooleanType SetImageArtifact(Image *image,const char *artifact,
% const char *value)
%
% A description of each parameter follows:
%
% o image: the image.
%
% o artifact: the image artifact.
%
% o values: the image artifact values.
%
*/
MagickExport MagickBooleanType SetImageArtifact(Image *image,
const char *artifact,const char *value)
{
MagickBooleanType
status;
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image->filename);
/* Create tree if needed */
if (image->artifacts == (void *) NULL)
image->artifacts=NewSplayTree(CompareSplayTreeString,
RelinquishMagickMemory,RelinquishMagickMemory);
/* Delete artifact if NULL -- empty string values are valid! */
if (value == (const char *) NULL)
return(DeleteImageArtifact(image,artifact));
/* Add artifact to tree */
status=AddValueToSplayTree((SplayTreeInfo *) image->artifacts,
ConstantString(artifact),ConstantString(value));
return(status);
}

View file

@ -0,0 +1,46 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore artifact methods.
*/
#ifndef _MAGICKCORE_ARTIFACT_H
#define _MAGICKCORE_ARTIFACT_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
extern MagickExport char
*GetNextImageArtifact(const Image *),
*RemoveImageArtifact(Image *,const char *);
extern MagickExport const char
*GetImageArtifact(const Image *,const char *);
extern MagickExport MagickBooleanType
CloneImageArtifacts(Image *,const Image *),
DefineImageArtifact(Image *,const char *),
DeleteImageArtifact(Image *,const char *),
SetImageArtifact(Image *,const char *,const char *);
extern MagickExport void
DestroyImageArtifacts(Image *),
ResetImageArtifactIterator(const Image *);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,51 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore methods to set or get image attributes.
*/
#ifndef _MAGICKCORE_ATTRIBUTE_H
#define _MAGICKCORE_ATTRIBUTE_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#include "magick/image.h"
#include "magick/exception.h"
extern MagickExport ImageType
GetImageType(const Image *,ExceptionInfo *);
extern MagickExport MagickBooleanType
IsGrayImage(const Image *,ExceptionInfo *),
IsMonochromeImage(const Image *,ExceptionInfo *),
IsOpaqueImage(const Image *,ExceptionInfo *),
SetImageChannelDepth(Image *,const ChannelType,const size_t),
SetImageDepth(Image *,const size_t),
SetImageType(Image *,const ImageType);
extern MagickExport RectangleInfo
GetImageBoundingBox(const Image *,ExceptionInfo *exception);
extern MagickExport size_t
GetImageChannelDepth(const Image *,const ChannelType,ExceptionInfo *),
GetImageDepth(const Image *,ExceptionInfo *),
GetImageQuantumDepth(const Image *,const MagickBooleanType);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

View file

@ -0,0 +1,133 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore Binary Large OBjects private methods.
*/
#ifndef _MAGICKCORE_BLOB_PRIVATE_H
#define _MAGICKCORE_BLOB_PRIVATE_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#include "magick/image.h"
#include "magick/stream.h"
#define MagickMinBlobExtent 32767L
#if defined(MAGICKCORE_HAVE_FSEEKO)
# define fseek fseeko
# define ftell ftello
#endif
typedef enum
{
UndefinedBlobMode,
ReadBlobMode,
ReadBinaryBlobMode,
WriteBlobMode,
WriteBinaryBlobMode,
AppendBlobMode,
AppendBinaryBlobMode
} BlobMode;
typedef enum
{
UndefinedStream,
FileStream,
StandardStream,
PipeStream,
ZipStream,
BZipStream,
FifoStream,
BlobStream
} StreamType;
typedef int
*(*BlobFifo)(const Image *,const void *,const size_t);
extern MagickExport BlobInfo
*CloneBlobInfo(const BlobInfo *),
*ReferenceBlob(BlobInfo *);
extern MagickExport char
*ReadBlobString(Image *,char *);
extern MagickExport const struct stat
*GetBlobProperties(const Image *);
extern MagickExport double
ReadBlobDouble(Image *);
extern MagickExport float
ReadBlobFloat(Image *);
extern MagickExport int
EOFBlob(const Image *),
ReadBlobByte(Image *);
extern MagickExport MagickBooleanType
CloseBlob(Image *),
DiscardBlobBytes(Image *,const MagickSizeType),
OpenBlob(const ImageInfo *,Image *,const BlobMode,ExceptionInfo *),
SetBlobExtent(Image *,const MagickSizeType),
UnmapBlob(void *,const size_t);
extern MagickExport MagickOffsetType
SeekBlob(Image *,const MagickOffsetType,const int),
TellBlob(const Image *);
extern MagickExport MagickSizeType
ReadBlobLongLong(Image *),
ReadBlobMSBLongLong(Image *);
extern MagickExport ssize_t
ReadBlob(Image *,const size_t,unsigned char *),
WriteBlob(Image *,const size_t,const unsigned char *),
WriteBlobByte(Image *,const unsigned char),
WriteBlobFloat(Image *,const float),
WriteBlobLong(Image *,const unsigned int),
WriteBlobShort(Image *,const unsigned short),
WriteBlobLSBLong(Image *,const unsigned int),
WriteBlobLSBShort(Image *,const unsigned short),
WriteBlobMSBLong(Image *,const unsigned int),
WriteBlobMSBLongLong(Image *,const MagickSizeType),
WriteBlobMSBShort(Image *,const unsigned short),
WriteBlobString(Image *,const char *);
extern MagickExport unsigned char
*DetachBlob(BlobInfo *),
*MapBlob(int,const MapMode,const MagickOffsetType,const size_t);
extern MagickExport unsigned int
ReadBlobLong(Image *),
ReadBlobLSBLong(Image *),
ReadBlobMSBLong(Image *);
extern MagickExport unsigned short
ReadBlobShort(Image *),
ReadBlobLSBShort(Image *),
ReadBlobMSBShort(Image *);
extern MagickExport void
AttachBlob(BlobInfo *,const void *,const size_t),
GetBlobInfo(BlobInfo *),
MSBOrderLong(unsigned char *,const size_t),
MSBOrderShort(unsigned char *,const size_t);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

4566
ImageMagick/magick/blob.c Normal file

File diff suppressed because it is too large Load diff

76
ImageMagick/magick/blob.h Normal file
View file

@ -0,0 +1,76 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore Binary Large OBjects methods.
*/
#ifndef _MAGICKCORE_BLOB_H
#define _MAGICKCORE_BLOB_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#include "magick/image.h"
#include "magick/stream.h"
#define MagickMaxBufferExtent (32*8192-2)
typedef enum
{
ReadMode,
WriteMode,
IOMode
} MapMode;
extern MagickExport FILE
*GetBlobFileHandle(const Image *);
extern MagickExport Image
*BlobToImage(const ImageInfo *,const void *,const size_t,ExceptionInfo *),
*PingBlob(const ImageInfo *,const void *,const size_t,ExceptionInfo *);
extern MagickExport MagickBooleanType
BlobToFile(char *,const void *,const size_t,ExceptionInfo *),
FileToImage(Image *,const char *),
GetBlobError(const Image *),
ImageToFile(Image *,char *,ExceptionInfo *),
InjectImageBlob(const ImageInfo *,Image *,Image *,const char *,
ExceptionInfo *),
IsBlobExempt(const Image *),
IsBlobSeekable(const Image *),
IsBlobTemporary(const Image *);
extern MagickExport MagickSizeType
GetBlobSize(const Image *);
extern MagickExport StreamHandler
GetBlobStreamHandler(const Image *);
extern MagickExport unsigned char
*FileToBlob(const char *,const size_t,size_t *,ExceptionInfo *),
*GetBlobStreamData(const Image *),
*ImageToBlob(const ImageInfo *,Image *,size_t *,ExceptionInfo *),
*ImagesToBlob(const ImageInfo *,Image *,size_t *,ExceptionInfo *);
extern MagickExport void
DestroyBlob(Image *),
DuplicateBlob(Image *,const Image *),
SetBlobExempt(Image *,const MagickBooleanType);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

View file

@ -0,0 +1,261 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore cache private methods.
*/
#ifndef _MAGICKCORE_CACHE_PRIVATE_H
#define _MAGICKCORE_CACHE_PRIVATE_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#include <time.h>
#include "magick/cache.h"
#include "magick/distribute-cache.h"
#include "magick/random_.h"
#include "magick/thread-private.h"
#include "magick/semaphore.h"
typedef void
*Cache;
typedef const IndexPacket
*(*GetVirtualIndexesFromHandler)(const Image *);
typedef IndexPacket
*(*GetAuthenticIndexesFromHandler)(const Image *);
typedef MagickBooleanType
(*GetOneAuthenticPixelFromHandler)(Image *,const ssize_t,const ssize_t,
PixelPacket *,ExceptionInfo *),
(*GetOneVirtualPixelFromHandler)(const Image *,const VirtualPixelMethod,
const ssize_t,const ssize_t,PixelPacket *,ExceptionInfo *),
(*SyncAuthenticPixelsHandler)(Image *,ExceptionInfo *);
typedef const PixelPacket
*(*GetVirtualPixelHandler)(const Image *,const VirtualPixelMethod,
const ssize_t,const ssize_t,const size_t,const size_t,ExceptionInfo *),
*(*GetVirtualPixelsHandler)(const Image *);
typedef PixelPacket
*(*GetAuthenticPixelsHandler)(Image *,const ssize_t,const ssize_t,
const size_t,const size_t,ExceptionInfo *);
typedef PixelPacket
*(*GetAuthenticPixelsFromHandler)(const Image *);
typedef PixelPacket
*(*QueueAuthenticPixelsHandler)(Image *,const ssize_t,const ssize_t,
const size_t,const size_t,ExceptionInfo *);
typedef void
(*DestroyPixelHandler)(Image *);
typedef struct _CacheMethods
{
GetVirtualPixelHandler
get_virtual_pixel_handler;
GetVirtualPixelsHandler
get_virtual_pixels_handler;
GetVirtualIndexesFromHandler
get_virtual_indexes_from_handler;
GetOneVirtualPixelFromHandler
get_one_virtual_pixel_from_handler;
GetAuthenticPixelsHandler
get_authentic_pixels_handler;
GetAuthenticIndexesFromHandler
get_authentic_indexes_from_handler;
GetOneAuthenticPixelFromHandler
get_one_authentic_pixel_from_handler;
GetAuthenticPixelsFromHandler
get_authentic_pixels_from_handler;
QueueAuthenticPixelsHandler
queue_authentic_pixels_handler;
SyncAuthenticPixelsHandler
sync_authentic_pixels_handler;
DestroyPixelHandler
destroy_pixel_handler;
} CacheMethods;
typedef struct _NexusInfo
NexusInfo;
typedef struct _CacheInfo
{
ClassType
storage_class;
ColorspaceType
colorspace;
size_t
channels;
CacheType
type;
MapMode
mode;
MagickBooleanType
mapped;
size_t
columns,
rows;
MagickOffsetType
offset;
MagickSizeType
length;
VirtualPixelMethod
virtual_pixel_method;
MagickPixelPacket
virtual_pixel_color;
size_t
number_threads;
NexusInfo
**nexus_info;
PixelPacket
*pixels;
IndexPacket
*indexes;
MagickBooleanType
active_index_channel;
int
file;
char
filename[MaxTextExtent],
cache_filename[MaxTextExtent];
CacheMethods
methods;
RandomInfo
*random_info;
size_t
number_connections;
void
*server_info;
MagickBooleanType
synchronize,
debug;
MagickThreadType
id;
ssize_t
reference_count;
SemaphoreInfo
*semaphore,
*file_semaphore;
time_t
timestamp;
size_t
signature;
} CacheInfo;
extern MagickExport Cache
AcquirePixelCache(const size_t),
ClonePixelCache(const Cache),
DestroyPixelCache(Cache),
ReferencePixelCache(Cache);
extern MagickExport CacheType
GetPixelCacheType(const Image *);
extern MagickExport ClassType
GetPixelCacheStorageClass(const Cache);
extern MagickExport ColorspaceType
GetPixelCacheColorspace(const Cache);
extern MagickExport const IndexPacket
*GetVirtualIndexesFromNexus(const Cache,NexusInfo *);
extern MagickExport const PixelPacket
*GetVirtualPixelsFromNexus(const Image *,const VirtualPixelMethod,
const ssize_t,const ssize_t,const size_t,const size_t,NexusInfo *,
ExceptionInfo *) magick_hot_spot,
*GetVirtualPixelsNexus(const Cache,NexusInfo *);
extern MagickExport IndexPacket
*GetPixelCacheNexusIndexes(const Cache,NexusInfo *);
extern MagickExport MagickBooleanType
SyncAuthenticPixelCacheNexus(Image *,NexusInfo *,ExceptionInfo *)
magick_hot_spot;
extern MagickExport MagickSizeType
GetPixelCacheNexusExtent(const Cache,NexusInfo *);
extern MagickExport NexusInfo
**AcquirePixelCacheNexus(const size_t),
**DestroyPixelCacheNexus(NexusInfo **,const size_t);
extern MagickExport PixelPacket
*GetAuthenticPixelCacheNexus(Image *,const ssize_t,const ssize_t,
const size_t,const size_t,NexusInfo *,ExceptionInfo *) magick_hot_spot,
*GetPixelCacheNexusPixels(const Cache,NexusInfo *),
*QueueAuthenticPixel(Image *,const ssize_t,const ssize_t,const size_t,
const size_t,const MagickBooleanType,NexusInfo *,ExceptionInfo *),
*QueueAuthenticPixelCacheNexus(Image *,const ssize_t,const ssize_t,
const size_t,const size_t,const MagickBooleanType,NexusInfo *,
ExceptionInfo *) magick_hot_spot;
extern MagickExport size_t
GetPixelCacheChannels(const Cache);
extern MagickExport void
ClonePixelCacheMethods(Cache,const Cache),
GetPixelCacheTileSize(const Image *,size_t *,size_t *),
GetPixelCacheMethods(CacheMethods *),
SetPixelCacheMethods(Cache,CacheMethods *);
extern MagickPrivate MagickBooleanType
SyncImagePixelCache(Image *,ExceptionInfo *);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,108 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore cache view methods.
*/
#ifndef _MAGICKCORE_CACHE_VIEW_H
#define _MAGICKCORE_CACHE_VIEW_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#include "magick/pixel.h"
typedef enum
{
UndefinedVirtualPixelMethod,
BackgroundVirtualPixelMethod,
ConstantVirtualPixelMethod, /* deprecated */
DitherVirtualPixelMethod,
EdgeVirtualPixelMethod,
MirrorVirtualPixelMethod,
RandomVirtualPixelMethod,
TileVirtualPixelMethod,
TransparentVirtualPixelMethod,
MaskVirtualPixelMethod,
BlackVirtualPixelMethod,
GrayVirtualPixelMethod,
WhiteVirtualPixelMethod,
HorizontalTileVirtualPixelMethod,
VerticalTileVirtualPixelMethod,
HorizontalTileEdgeVirtualPixelMethod,
VerticalTileEdgeVirtualPixelMethod,
CheckerTileVirtualPixelMethod
} VirtualPixelMethod;
typedef struct _CacheView
CacheView;
extern MagickExport CacheView
*AcquireAuthenticCacheView(const Image *,ExceptionInfo *),
*AcquireCacheView(const Image *),
*AcquireVirtualCacheView(const Image *,ExceptionInfo *),
*CloneCacheView(const CacheView *),
*DestroyCacheView(CacheView *);
extern MagickExport ClassType
GetCacheViewStorageClass(const CacheView *);
extern MagickExport ColorspaceType
GetCacheViewColorspace(const CacheView *);
extern MagickExport const IndexPacket
*GetCacheViewVirtualIndexQueue(const CacheView *);
extern MagickExport const PixelPacket
*GetCacheViewVirtualPixels(const CacheView *,const ssize_t,const ssize_t,
const size_t,const size_t,ExceptionInfo *) magick_hot_spot,
*GetCacheViewVirtualPixelQueue(const CacheView *) magick_hot_spot;
extern MagickExport ExceptionInfo
*GetCacheViewException(const CacheView *);
extern MagickExport IndexPacket
*GetCacheViewAuthenticIndexQueue(CacheView *);
extern MagickExport MagickBooleanType
GetOneCacheViewVirtualPixel(const CacheView *,const ssize_t,const ssize_t,
PixelPacket *,ExceptionInfo *),
GetOneCacheViewVirtualMethodPixel(const CacheView *,
const VirtualPixelMethod,const ssize_t,const ssize_t,PixelPacket *,
ExceptionInfo *),
GetOneCacheViewAuthenticPixel(const CacheView *,const ssize_t,const ssize_t,
PixelPacket *,ExceptionInfo *),
SetCacheViewStorageClass(CacheView *,const ClassType),
SetCacheViewVirtualPixelMethod(CacheView *,const VirtualPixelMethod),
SyncCacheViewAuthenticPixels(CacheView *,ExceptionInfo *) magick_hot_spot;
extern MagickExport MagickSizeType
GetCacheViewExtent(const CacheView *);
extern MagickExport size_t
GetCacheViewChannels(const CacheView *);
extern MagickExport PixelPacket
*GetCacheViewAuthenticPixelQueue(CacheView *) magick_hot_spot,
*GetCacheViewAuthenticPixels(CacheView *,const ssize_t,const ssize_t,
const size_t,const size_t,ExceptionInfo *) magick_hot_spot,
*QueueCacheViewAuthenticPixels(CacheView *,const ssize_t,const ssize_t,
const size_t,const size_t,ExceptionInfo *) magick_hot_spot;
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

5508
ImageMagick/magick/cache.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,90 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore cache methods.
*/
#ifndef _MAGICKCORE_CACHE_H
#define _MAGICKCORE_CACHE_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#include "magick/blob.h"
typedef enum
{
UndefinedCache,
MemoryCache,
MapCache,
DiskCache,
PingCache,
DistributedCache
} CacheType;
extern MagickExport CacheType
GetImagePixelCacheType(const Image *);
extern MagickExport const IndexPacket
*GetVirtualIndexQueue(const Image *);
extern MagickExport const PixelPacket
*GetVirtualPixels(const Image *,const ssize_t,const ssize_t,const size_t,
const size_t,ExceptionInfo *),
*GetVirtualPixelQueue(const Image *);
extern MagickExport const void
*AcquirePixelCachePixels(const Image *,MagickSizeType *,ExceptionInfo *);
extern MagickExport IndexPacket
*GetAuthenticIndexQueue(const Image *);
extern MagickExport MagickBooleanType
CacheComponentGenesis(void),
GetOneVirtualMagickPixel(const Image *,const ssize_t,const ssize_t,
MagickPixelPacket *,ExceptionInfo *),
GetOneVirtualPixel(const Image *,const ssize_t,const ssize_t,PixelPacket *,
ExceptionInfo *),
GetOneVirtualMethodPixel(const Image *,const VirtualPixelMethod,const ssize_t,
const ssize_t,PixelPacket *,ExceptionInfo *),
GetOneAuthenticPixel(Image *,const ssize_t,const ssize_t,PixelPacket *,
ExceptionInfo *),
PersistPixelCache(Image *,const char *,const MagickBooleanType,
MagickOffsetType *,ExceptionInfo *),
SyncAuthenticPixels(Image *,ExceptionInfo *);
extern MagickExport MagickSizeType
GetImageExtent(const Image *);
extern MagickExport PixelPacket
*GetAuthenticPixels(Image *,const ssize_t,const ssize_t,const size_t,
const size_t,ExceptionInfo *),
*GetAuthenticPixelQueue(const Image *),
*QueueAuthenticPixels(Image *,const ssize_t,const ssize_t,const size_t,
const size_t,ExceptionInfo *);
extern MagickExport VirtualPixelMethod
GetPixelCacheVirtualMethod(const Image *),
SetPixelCacheVirtualMethod(const Image *,const VirtualPixelMethod);
extern MagickExport void
CacheComponentTerminus(void),
*GetPixelCachePixels(Image *,MagickSizeType *,ExceptionInfo *);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

View file

@ -0,0 +1,874 @@
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% CCCC H H AAA N N N N EEEEE L %
% C H H A A NN N NN N E L %
% C HHHHH AAAAA N N N N N N RRR L %
% C H H A A N NN N NN E L %
% CCCC H H A A N N N N EEEEE LLLLL %
% %
% %
% MagickCore Image Channel Methods %
% %
% Software Design %
% John Cristy %
% December 2003 %
% %
% %
% Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization %
% dedicated to making software imaging solutions freely available. %
% %
% You may not use this file except in compliance with the License. You may %
% obtain a copy of the License at %
% %
% http://www.imagemagick.org/script/license.php %
% %
% Unless required by applicable law or agreed to in writing, software %
% distributed under the License is distributed on an "AS IS" BASIS, %
% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
% See the License for the specific language governing permissions and %
% limitations under the License. %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
%
*/
/*
Include declarations.
*/
#include "magick/studio.h"
#include "magick/cache-private.h"
#include "magick/channel.h"
#include "magick/color-private.h"
#include "magick/colorspace-private.h"
#include "magick/composite-private.h"
#include "magick/exception-private.h"
#include "magick/enhance.h"
#include "magick/image.h"
#include "magick/list.h"
#include "magick/log.h"
#include "magick/monitor.h"
#include "magick/monitor-private.h"
#include "magick/option.h"
#include "magick/pixel-accessor.h"
#include "magick/resource_.h"
#include "magick/string-private.h"
#include "magick/thread-private.h"
#include "magick/token.h"
#include "magick/utility.h"
#include "magick/version.h"
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% C o m b i n e I m a g e s %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% CombineImages() combines one or more images into a single image. The
% grayscale value of the pixels of each image in the sequence is assigned in
% order to the specified channels of the combined image. The typical
% ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
%
% The format of the CombineImages method is:
%
% Image *CombineImages(const Image *image,const ChannelType channel,
% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o image: the image.
%
% o exception: return any errors or warnings in this structure.
%
*/
MagickExport Image *CombineImages(const Image *image,const ChannelType channel,
ExceptionInfo *exception)
{
#define CombineImageTag "Combine/Image"
CacheView
*combine_view;
const Image
*next;
Image
*combine_image;
MagickBooleanType
status;
MagickOffsetType
progress;
ssize_t
y;
/*
Ensure the image are the same size.
*/
assert(image != (const Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
for (next=image; next != (Image *) NULL; next=GetNextImageInList(next))
{
if ((next->columns != image->columns) || (next->rows != image->rows))
ThrowImageException(OptionError,"ImagesAreNotTheSameSize");
}
combine_image=CloneImage(image,0,0,MagickTrue,exception);
if (combine_image == (Image *) NULL)
return((Image *) NULL);
if (SetImageStorageClass(combine_image,DirectClass) == MagickFalse)
{
InheritException(exception,&combine_image->exception);
combine_image=DestroyImage(combine_image);
return((Image *) NULL);
}
if (IsGrayColorspace(image->colorspace) != MagickFalse)
(void) SetImageColorspace(combine_image,RGBColorspace);
if ((channel & OpacityChannel) != 0)
combine_image->matte=MagickTrue;
(void) SetImageBackgroundColor(combine_image);
/*
Combine images.
*/
status=MagickTrue;
progress=0;
combine_view=AcquireAuthenticCacheView(combine_image,exception);
for (y=0; y < (ssize_t) combine_image->rows; y++)
{
CacheView
*image_view;
const Image
*next;
PixelPacket
*pixels;
register const PixelPacket
*restrict p;
register PixelPacket
*restrict q;
register ssize_t
x;
if (status == MagickFalse)
continue;
pixels=GetCacheViewAuthenticPixels(combine_view,0,y,combine_image->columns,
1,exception);
if (pixels == (PixelPacket *) NULL)
{
status=MagickFalse;
continue;
}
next=image;
if (((channel & RedChannel) != 0) && (next != (Image *) NULL))
{
image_view=AcquireVirtualCacheView(next,exception);
p=GetCacheViewVirtualPixels(image_view,0,y,next->columns,1,exception);
if (p == (const PixelPacket *) NULL)
continue;
q=pixels;
for (x=0; x < (ssize_t) combine_image->columns; x++)
{
SetPixelRed(q,PixelIntensityToQuantum(image,p));
p++;
q++;
}
image_view=DestroyCacheView(image_view);
next=GetNextImageInList(next);
}
if (((channel & GreenChannel) != 0) && (next != (Image *) NULL))
{
image_view=AcquireVirtualCacheView(next,exception);
p=GetCacheViewVirtualPixels(image_view,0,y,next->columns,1,exception);
if (p == (const PixelPacket *) NULL)
continue;
q=pixels;
for (x=0; x < (ssize_t) combine_image->columns; x++)
{
SetPixelGreen(q,PixelIntensityToQuantum(image,p));
p++;
q++;
}
image_view=DestroyCacheView(image_view);
next=GetNextImageInList(next);
}
if (((channel & BlueChannel) != 0) && (next != (Image *) NULL))
{
image_view=AcquireVirtualCacheView(next,exception);
p=GetCacheViewVirtualPixels(image_view,0,y,next->columns,1,exception);
if (p == (const PixelPacket *) NULL)
continue;
q=pixels;
for (x=0; x < (ssize_t) combine_image->columns; x++)
{
SetPixelBlue(q,PixelIntensityToQuantum(image,p));
p++;
q++;
}
image_view=DestroyCacheView(image_view);
next=GetNextImageInList(next);
}
if (((channel & OpacityChannel) != 0) && (next != (Image *) NULL))
{
image_view=AcquireVirtualCacheView(next,exception);
p=GetCacheViewVirtualPixels(image_view,0,y,next->columns,1,exception);
if (p == (const PixelPacket *) NULL)
continue;
q=pixels;
for (x=0; x < (ssize_t) combine_image->columns; x++)
{
SetPixelAlpha(q,PixelIntensityToQuantum(image,p));
p++;
q++;
}
image_view=DestroyCacheView(image_view);
next=GetNextImageInList(next);
}
if (((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace) && (next != (Image *) NULL))
{
IndexPacket
*indexes;
image_view=AcquireVirtualCacheView(next,exception);
p=GetCacheViewVirtualPixels(image_view,0,y,next->columns,1,exception);
if (p == (const PixelPacket *) NULL)
continue;
indexes=GetCacheViewAuthenticIndexQueue(combine_view);
for (x=0; x < (ssize_t) combine_image->columns; x++)
{
SetPixelIndex(indexes+x,PixelIntensityToQuantum(image,p));
p++;
}
image_view=DestroyCacheView(image_view);
next=GetNextImageInList(next);
}
if (SyncCacheViewAuthenticPixels(combine_view,exception) == MagickFalse)
status=MagickFalse;
if (image->progress_monitor != (MagickProgressMonitor) NULL)
{
MagickBooleanType
proceed;
proceed=SetImageProgress(image,CombineImageTag,progress++,
combine_image->rows);
if (proceed == MagickFalse)
status=MagickFalse;
}
}
combine_view=DestroyCacheView(combine_view);
if (IsGrayColorspace(combine_image->colorspace) != MagickFalse)
(void) TransformImageColorspace(combine_image,RGBColorspace);
if (status == MagickFalse)
combine_image=DestroyImage(combine_image);
return(combine_image);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% G e t I m a g e A l p h a C h a n n e l %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% GetImageAlphaChannel() returns MagickFalse if the image alpha channel is
% not activated. That is, the image is RGB rather than RGBA or CMYK rather
% than CMYKA.
%
% The format of the GetImageAlphaChannel method is:
%
% MagickBooleanType GetImageAlphaChannel(const Image *image)
%
% A description of each parameter follows:
%
% o image: the image.
%
*/
MagickExport MagickBooleanType GetImageAlphaChannel(const Image *image)
{
assert(image != (const Image *) NULL);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
assert(image->signature == MagickSignature);
return(image->matte);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% S e p a r a t e I m a g e C h a n n e l %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% SeparateImageChannel() separates a channel from the image and returns it as
% a grayscale image. A channel is a particular color component of each pixel
% in the image.
%
% The format of the SeparateImageChannel method is:
%
% MagickBooleanType SeparateImageChannel(Image *image,
% const ChannelType channel)
%
% A description of each parameter follows:
%
% o image: the image.
%
% o channel: Identify which channel to extract: RedChannel, GreenChannel,
% BlueChannel, OpacityChannel, CyanChannel, MagentaChannel,
% YellowChannel, or BlackChannel.
%
*/
MagickExport MagickBooleanType SeparateImageChannel(Image *image,
const ChannelType channel)
{
#define SeparateImageTag "Separate/Image"
CacheView
*image_view;
ExceptionInfo
*exception;
MagickBooleanType
status;
MagickOffsetType
progress;
ssize_t
y;
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
if (SetImageStorageClass(image,DirectClass) == MagickFalse)
return(MagickFalse);
if (channel == GrayChannels)
image->matte=MagickTrue;
/*
Separate image channels.
*/
status=MagickTrue;
progress=0;
exception=(&image->exception);
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(progress,status) \
magick_threads(image,image,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
register IndexPacket
*restrict indexes;
register PixelPacket
*restrict q;
register ssize_t
x;
if (status == MagickFalse)
continue;
q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
{
status=MagickFalse;
continue;
}
indexes=GetCacheViewAuthenticIndexQueue(image_view);
switch (channel)
{
case RedChannel:
{
for (x=0; x < (ssize_t) image->columns; x++)
{
SetPixelGreen(q,GetPixelRed(q));
SetPixelBlue(q,GetPixelRed(q));
q++;
}
break;
}
case GreenChannel:
{
for (x=0; x < (ssize_t) image->columns; x++)
{
SetPixelRed(q,GetPixelGreen(q));
SetPixelBlue(q,GetPixelGreen(q));
q++;
}
break;
}
case BlueChannel:
{
for (x=0; x < (ssize_t) image->columns; x++)
{
SetPixelRed(q,GetPixelBlue(q));
SetPixelGreen(q,GetPixelBlue(q));
q++;
}
break;
}
case OpacityChannel:
{
for (x=0; x < (ssize_t) image->columns; x++)
{
SetPixelRed(q,GetPixelOpacity(q));
SetPixelGreen(q,GetPixelOpacity(q));
SetPixelBlue(q,GetPixelOpacity(q));
q++;
}
break;
}
case BlackChannel:
{
if ((image->storage_class != PseudoClass) &&
(image->colorspace != CMYKColorspace))
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
SetPixelRed(q,GetPixelIndex(indexes+x));
SetPixelGreen(q,GetPixelIndex(indexes+x));
SetPixelBlue(q,GetPixelIndex(indexes+x));
q++;
}
break;
}
case TrueAlphaChannel:
{
for (x=0; x < (ssize_t) image->columns; x++)
{
SetPixelRed(q,GetPixelAlpha(q));
SetPixelGreen(q,GetPixelAlpha(q));
SetPixelBlue(q,GetPixelAlpha(q));
q++;
}
break;
}
case GrayChannels:
{
for (x=0; x < (ssize_t) image->columns; x++)
{
SetPixelAlpha(q,PixelIntensityToQuantum(image,q));
q++;
}
break;
}
default:
break;
}
if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
status=MagickFalse;
if (image->progress_monitor != (MagickProgressMonitor) NULL)
{
MagickBooleanType
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp critical (MagickCore_SeparateImageChannel)
#endif
proceed=SetImageProgress(image,SeparateImageTag,progress++,image->rows);
if (proceed == MagickFalse)
status=MagickFalse;
}
}
image_view=DestroyCacheView(image_view);
if (channel != GrayChannels)
image->matte=MagickFalse;
if (IssRGBColorspace(image->colorspace) == MagickFalse)
(void) SetImageColorspace(image,GRAYColorspace);
else
(void) TransformImageColorspace(image,GRAYColorspace);
return(status);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% S e p a r a t e I m a g e s %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% SeparateImages() returns a separate grayscale image for each channel
% specified.
%
% The format of the SeparateImages method is:
%
% MagickBooleanType SeparateImages(const Image *image,
% const ChannelType channel,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o image: the image.
%
% o channel: Identify which channels to extract: RedChannel, GreenChannel,
% BlueChannel, OpacityChannel, CyanChannel, MagentaChannel,
% YellowChannel, or BlackChannel.
%
% o exception: return any errors or warnings in this structure.
%
*/
MagickExport Image *SeparateImages(const Image *image,const ChannelType channel,
ExceptionInfo *exception)
{
Image
*images,
*separate_image;
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
images=NewImageList();
if ((channel & RedChannel) != 0)
{
separate_image=CloneImage(image,0,0,MagickTrue,exception);
(void) SeparateImageChannel(separate_image,RedChannel);
AppendImageToList(&images,separate_image);
}
if ((channel & GreenChannel) != 0)
{
separate_image=CloneImage(image,0,0,MagickTrue,exception);
(void) SeparateImageChannel(separate_image,GreenChannel);
AppendImageToList(&images,separate_image);
}
if ((channel & BlueChannel) != 0)
{
separate_image=CloneImage(image,0,0,MagickTrue,exception);
(void) SeparateImageChannel(separate_image,BlueChannel);
AppendImageToList(&images,separate_image);
}
if (((channel & BlackChannel) != 0) && (image->colorspace == CMYKColorspace))
{
separate_image=CloneImage(image,0,0,MagickTrue,exception);
(void) SeparateImageChannel(separate_image,BlackChannel);
AppendImageToList(&images,separate_image);
}
if ((channel & AlphaChannel) != 0)
{
separate_image=CloneImage(image,0,0,MagickTrue,exception);
(void) SeparateImageChannel(separate_image,TrueAlphaChannel);
AppendImageToList(&images,separate_image);
}
return(images);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% S e t I m a g e A l p h a C h a n n e l %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% SetImageAlphaChannel() activates, deactivates, resets, or sets the alpha
% channel.
%
% The format of the SetImageAlphaChannel method is:
%
% MagickBooleanType SetImageAlphaChannel(Image *image,
% const AlphaChannelType alpha_type)
%
% A description of each parameter follows:
%
% o image: the image.
%
% o alpha_type: The alpha channel type: ActivateAlphaChannel,
% CopyAlphaChannel, DeactivateAlphaChannel, ExtractAlphaChannel,
% OpaqueAlphaChannel, ResetAlphaChannel, SetAlphaChannel,
% ShapeAlphaChannel, and TransparentAlphaChannel.
%
*/
MagickExport MagickBooleanType SetImageAlphaChannel(Image *image,
const AlphaChannelType alpha_type)
{
MagickBooleanType
status;
assert(image != (Image *) NULL);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
assert(image->signature == MagickSignature);
status=MagickTrue;
switch (alpha_type)
{
case ActivateAlphaChannel:
{
image->matte=MagickTrue;
break;
}
case BackgroundAlphaChannel:
{
CacheView
*image_view;
ExceptionInfo
*exception;
IndexPacket
index;
MagickBooleanType
status;
MagickPixelPacket
background;
PixelPacket
pixel;
ssize_t
y;
/*
Set transparent pixels to background color.
*/
if (image->matte == MagickFalse)
break;
if (SetImageStorageClass(image,DirectClass) == MagickFalse)
break;
GetMagickPixelPacket(image,&background);
SetMagickPixelPacket(image,&image->background_color,(const IndexPacket *)
NULL,&background);
if (image->colorspace == CMYKColorspace)
ConvertRGBToCMYK(&background);
index=0;
SetPixelPacket(image,&background,&pixel,&index);
status=MagickTrue;
exception=(&image->exception);
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(status) \
magick_threads(image,image,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
register IndexPacket
*restrict indexes;
register PixelPacket
*restrict q;
register ssize_t
x;
if (status == MagickFalse)
continue;
q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,
exception);
if (q == (PixelPacket *) NULL)
{
status=MagickFalse;
continue;
}
for (x=0; x < (ssize_t) image->columns; x++)
{
if (q->opacity == TransparentOpacity)
{
SetPixelRed(q,pixel.red);
SetPixelGreen(q,pixel.green);
SetPixelBlue(q,pixel.blue);
}
q++;
}
if (image->colorspace == CMYKColorspace)
{
indexes=GetCacheViewAuthenticIndexQueue(image_view);
for (x=0; x < (ssize_t) image->columns; x++)
SetPixelIndex(indexes+x,index);
}
if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
status=MagickFalse;
}
image_view=DestroyCacheView(image_view);
return(status);
}
case CopyAlphaChannel:
case ShapeAlphaChannel:
{
/*
Special usage case for SeparateImageChannel(): copy grayscale color to
the alpha channel.
*/
status=SeparateImageChannel(image,GrayChannels);
image->matte=MagickTrue; /* make sure transparency is now on! */
if (alpha_type == ShapeAlphaChannel)
{
MagickPixelPacket
background;
/*
Reset all color channels to background color.
*/
GetMagickPixelPacket(image,&background);
SetMagickPixelPacket(image,&(image->background_color),(IndexPacket *)
NULL,&background);
(void) LevelColorsImage(image,&background,&background,MagickTrue);
}
break;
}
case DeactivateAlphaChannel:
{
image->matte=MagickFalse;
break;
}
case ExtractAlphaChannel:
{
status=SeparateImageChannel(image,TrueAlphaChannel);
image->matte=MagickFalse;
break;
}
case RemoveAlphaChannel:
case FlattenAlphaChannel:
{
CacheView
*image_view;
ExceptionInfo
*exception;
IndexPacket
index;
MagickBooleanType
status;
MagickPixelPacket
background;
PixelPacket
pixel;
ssize_t
y;
/*
Flatten image pixels over the background pixels.
*/
if (image->matte == MagickFalse)
break;
if (SetImageStorageClass(image,DirectClass) == MagickFalse)
break;
GetMagickPixelPacket(image,&background);
SetMagickPixelPacket(image,&image->background_color,(const IndexPacket *)
NULL,&background);
if (image->colorspace == CMYKColorspace)
ConvertRGBToCMYK(&background);
index=0;
SetPixelPacket(image,&background,&pixel,&index);
status=MagickTrue;
exception=(&image->exception);
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(status) \
magick_threads(image,image,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
register IndexPacket
*restrict indexes;
register PixelPacket
*restrict q;
register ssize_t
x;
if (status == MagickFalse)
continue;
q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,
exception);
if (q == (PixelPacket *) NULL)
{
status=MagickFalse;
continue;
}
for (x=0; x < (ssize_t) image->columns; x++)
{
double
gamma,
opacity;
gamma=1.0-QuantumScale*QuantumScale*q->opacity*pixel.opacity;
opacity=(double) QuantumRange*(1.0-gamma);
gamma=PerceptibleReciprocal(gamma);
q->red=ClampToQuantum(gamma*MagickOver_((MagickRealType) q->red,
(MagickRealType) q->opacity,(MagickRealType) pixel.red,
(MagickRealType) pixel.opacity));
q->green=ClampToQuantum(gamma*MagickOver_((MagickRealType) q->green,
(MagickRealType) q->opacity,(MagickRealType) pixel.green,
(MagickRealType) pixel.opacity));
q->blue=ClampToQuantum(gamma*MagickOver_((MagickRealType) q->blue,
(MagickRealType) q->opacity,(MagickRealType) pixel.blue,
(MagickRealType) pixel.opacity));
q->opacity=ClampToQuantum(opacity);
q++;
}
if (image->colorspace == CMYKColorspace)
{
indexes=GetCacheViewAuthenticIndexQueue(image_view);
for (x=0; x < (ssize_t) image->columns; x++)
SetPixelIndex(indexes+x,index);
}
if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
status=MagickFalse;
}
image_view=DestroyCacheView(image_view);
return(status);
}
case ResetAlphaChannel: /* deprecated */
case OpaqueAlphaChannel:
{
status=SetImageOpacity(image,OpaqueOpacity);
break;
}
case SetAlphaChannel:
{
if (image->matte == MagickFalse)
status=SetImageOpacity(image,OpaqueOpacity);
break;
}
case TransparentAlphaChannel:
{
status=SetImageOpacity(image,TransparentOpacity);
break;
}
case UndefinedAlphaChannel:
break;
}
if (status == MagickFalse)
return(status);
return(SyncImagePixelCache(image,&image->exception));
}

View file

@ -0,0 +1,41 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore image channel methods.
*/
#ifndef _MAGICKCORE_CHANNEL_H
#define _MAGICKCORE_CHANNEL_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#include "magick/image.h"
extern MagickExport Image
*CombineImages(const Image *,const ChannelType,ExceptionInfo *),
*SeparateImage(const Image *,const ChannelType,ExceptionInfo *),
*SeparateImages(const Image *,const ChannelType,ExceptionInfo *);
extern MagickExport MagickBooleanType
GetImageAlphaChannel(const Image *),
SeparateImageChannel(Image *,const ChannelType),
SetImageAlphaChannel(Image *,const AlphaChannelType);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

1195
ImageMagick/magick/cipher.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,35 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore cipher methods.
*/
#ifndef _MAGICKCORE_CIPHER_H
#define _MAGICKCORE_CIPHER_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
extern MagickExport MagickBooleanType
DecipherImage(Image *,const char *,ExceptionInfo *),
EncipherImage(Image *,const char *,ExceptionInfo *),
PasskeyDecipherImage(Image *,const StringInfo *,ExceptionInfo *),
PasskeyEncipherImage(Image *,const StringInfo *,ExceptionInfo *);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

156
ImageMagick/magick/client.c Normal file
View file

@ -0,0 +1,156 @@
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% CCCC L IIIII EEEEE N N TTTTT %
% C L I E NN N T %
% C L I EEE N N N T %
% C L I E N NN T %
% CCCC LLLLL IIIII EEEEE N N T %
% %
% %
% MagickCore Client Methods %
% %
% Software Design %
% John Cristy %
% March 2003 %
% %
% %
% Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization %
% dedicated to making software imaging solutions freely available. %
% %
% You may not use this file except in compliance with the License. You may %
% obtain a copy of the License at %
% %
% http://www.imagemagick.org/script/license.php %
% %
% Unless required by applicable law or agreed to in writing, software %
% distributed under the License is distributed on an "AS IS" BASIS, %
% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
% See the License for the specific language governing permissions and %
% limitations under the License. %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
*/
/*
Include declarations.
*/
#include "magick/studio.h"
#include "magick/client.h"
#include "magick/string_.h"
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% G e t C l i e n t N a m e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% GetClientName returns the current client name.
%
% The format of the GetClientName method is:
%
% const char *GetClientName(void)
%
*/
MagickExport const char *GetClientName(void)
{
return(SetClientName((const char *) NULL));
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% G e t C l i e n t P a t h %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% GetClientPath returns the current client name.
%
% The format of the GetClientPath method is:
%
% const char *GetClientPath(void)
%
*/
MagickExport const char *GetClientPath(void)
{
return(SetClientPath((const char *) NULL));
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% S e t C l i e n t N a m e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% SetClientName sets the client name and returns it.
%
% The format of the SetClientName method is:
%
% const char *SetClientName(const char *name)
%
% A description of each parameter follows:
%
% o name: Specifies the new client name.
%
*/
MagickExport const char *SetClientName(const char *name)
{
static char
client_name[MaxTextExtent] = "Magick";
if ((name != (char *) NULL) && (*name != '\0'))
(void) CopyMagickString(client_name,name,MaxTextExtent);
return(client_name);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% S e t C l i e n t P a t h %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% SetClientPath() sets the client path if the name is specified. Otherwise
% the current client path is returned. A zero-length string is returned if
% the client path has never been set.
%
% The format of the SetClientPath method is:
%
% const char *SetClientPath(const char *path)
%
% A description of each parameter follows:
%
% o path: Specifies the new client path.
%
*/
MagickExport const char *SetClientPath(const char *path)
{
static char
client_path[MaxTextExtent] = "";
if ((path != (char *) NULL) && (*path != '\0'))
(void) CopyMagickString(client_path,path,MaxTextExtent);
return(client_path);
}

View file

@ -0,0 +1,35 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore client methods.
*/
#ifndef _MAGICKCORE_CLIENT_H
#define _MAGICKCORE_CLIENT_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
extern MagickExport const char
*GetClientPath(void),
*GetClientName(void),
*SetClientName(const char *),
*SetClientPath(const char *);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

950
ImageMagick/magick/coder.c Normal file
View file

@ -0,0 +1,950 @@
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% CCCC OOO DDDD EEEEE RRRR %
% C O O D D E R R %
% C O O D D EEE RRRR %
% C O O D D E R R %
% CCCC OOO DDDD EEEEE R R %
% %
% %
% MagickCore Image Coder Methods %
% %
% Software Design %
% John Cristy %
% May 2001 %
% %
% %
% Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization %
% dedicated to making software imaging solutions freely available. %
% %
% You may not use this file except in compliance with the License. You may %
% obtain a copy of the License at %
% %
% http://www.imagemagick.org/script/license.php %
% %
% Unless required by applicable law or agreed to in writing, software %
% distributed under the License is distributed on an "AS IS" BASIS, %
% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
% See the License for the specific language governing permissions and %
% limitations under the License. %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
*/
/*
Include declarations.
*/
#include "magick/studio.h"
#include "magick/blob.h"
#include "magick/client.h"
#include "magick/coder.h"
#include "magick/configure.h"
#include "magick/draw.h"
#include "magick/exception.h"
#include "magick/exception-private.h"
#include "magick/hashmap.h"
#include "magick/log.h"
#include "magick/memory_.h"
#include "magick/option.h"
#include "magick/semaphore.h"
#include "magick/string_.h"
#include "magick/splay-tree.h"
#include "magick/token.h"
#include "magick/utility.h"
#include "magick/xml-tree.h"
/*
Define declarations.
*/
#define MagickCoderFilename "coder.xml"
/*
Typedef declarations.
*/
typedef struct _CoderMapInfo
{
const char
*magick,
*name;
} CoderMapInfo;
/*
Static declarations.
*/
static const CoderMapInfo
CoderMap[] =
{
{ "3FR", "DNG" },
{ "8BIM", "META" },
{ "8BIMTEXT", "META" },
{ "8BIMWTEXT", "META" },
{ "AFM", "TTF" },
{ "A", "RAW" },
{ "AI", "PDF" },
{ "APP1JPEG", "META" },
{ "APP1", "META" },
{ "ARW", "DNG" },
{ "AVI", "MPEG" },
{ "BIE", "JBIG" },
{ "BMP2", "BMP" },
{ "BMP3", "BMP" },
{ "B", "RAW" },
{ "BRF", "BRAILLE" },
{ "BGRA", "BGR" },
{ "CMYKA", "CMYK" },
{ "C", "RAW" },
{ "CAL", "CALS" },
{ "CANVAS", "XC" },
{ "CR2", "DNG" },
{ "CRW", "DNG" },
{ "CUR", "ICON" },
{ "DCR", "DNG" },
{ "DCX", "PCX" },
{ "DFONT", "TTF" },
{ "EPDF", "PDF" },
{ "EPI", "PS" },
{ "EPS2", "PS2" },
{ "EPS3", "PS3" },
{ "EPSF", "PS" },
{ "EPSI", "PS" },
{ "EPS", "PS" },
{ "EPT2", "EPT" },
{ "EPT3", "EPT" },
{ "ERF", "DNG" },
{ "EXIF", "META" },
{ "FILE", "URL" },
{ "FRACTAL", "PLASMA" },
{ "FTP", "URL" },
{ "FTS", "FITS" },
{ "G3", "FAX" },
{ "GIF87", "GIF" },
{ "G", "RAW" },
{ "GRANITE", "MAGICK" },
{ "GROUP4", "TIFF" },
{ "GV", "DOT" },
{ "K25", "DNG" },
{ "KDC", "DNG" },
{ "H", "MAGICK" },
{ "HTM", "HTML" },
{ "HTTP", "URL" },
{ "ICB", "TGA" },
{ "ICC", "META" },
{ "ICM", "META" },
{ "ICO", "ICON" },
{ "IMPLICIT", "***" },
{ "IPTC", "META" },
{ "IPTCTEXT", "META" },
{ "IPTCWTEXT", "META" },
{ "ISOBRL", "BRAILLE" },
{ "JBG", "JBIG" },
{ "JNG", "PNG" },
{ "JPC", "JP2" },
{ "J2C", "JP2" },
{ "J2K", "JP2" },
{ "JPG", "JPEG" },
{ "JPX", "JP2" },
{ "K", "RAW" },
{ "LOGO", "MAGICK" },
{ "M2V", "MPEG" },
{ "M4V", "MPEG" },
{ "M", "RAW" },
{ "MNG", "PNG" },
{ "MOV", "MPEG" },
{ "MP4", "MPEG" },
{ "MPG", "MPEG" },
{ "MPRI", "MPR" },
{ "MEF", "DNG" },
{ "MRW", "DNG" },
{ "MSVG", "SVG" },
{ "NEF", "DNG" },
{ "NETSCAPE", "MAGICK" },
{ "NRW", "DNG" },
{ "O", "RAW" },
{ "ORF", "DNG" },
{ "OTF", "TTF" },
{ "P7", "PNM" },
{ "PAL", "UYVY" },
{ "PAM", "PNM" },
{ "PBM", "PNM" },
{ "PCDS", "PCD" },
{ "PDFA", "PDF" },
{ "PEF", "DNG" },
{ "PEF", "DNG" },
{ "PFA", "TTF" },
{ "PFB", "TTF" },
{ "PFM", "PNM" },
{ "PGM", "PNM" },
{ "PGX", "JP2" },
{ "PICON", "XPM" },
{ "PJPEG", "JPEG" },
{ "PM", "XPM" },
{ "PNG24", "PNG" },
{ "PNG32", "PNG" },
{ "PNG8", "PNG" },
{ "PPM", "PNM" },
{ "PSB", "PSD" },
{ "PTIF", "TIFF" },
{ "RADIAL-GRADIENT", "GRADIENT" },
{ "RAF", "DNG" },
{ "RAS", "SUN" },
{ "RGBA", "RGB" },
{ "RGBO", "RGB" },
{ "R", "RAW" },
{ "ROSE", "MAGICK" },
{ "RW2", "DNG" },
{ "SHTML", "HTML" },
{ "SR2", "DNG" },
{ "SRF", "DNG" },
{ "SVGZ", "SVG" },
{ "TEXT", "TXT" },
{ "TIFF64", "TIFF" },
{ "TIF", "TIFF" },
{ "TTC", "TTF" },
{ "UBRL", "BRAILLE" },
{ "VDA", "TGA" },
{ "VST", "TGA" },
{ "WIZARD", "MAGICK" },
{ "WMV", "MPEG" },
{ "WMFWIN32", "EMF" },
{ "WMZ", "WMF" },
{ "X3f", "DNG" },
{ "XMP", "META" },
{ "XTRNARRAY", "XTRN" },
{ "XTRNBLOB", "XTRN" },
{ "XTRNFILE", "XTRN" },
{ "XTRNIMAGE", "XTRN" },
{ "XV", "VIFF" },
{ "Y", "RAW" },
{ "YCbCrA", "YCbCr" }
};
static SemaphoreInfo
*coder_semaphore = (SemaphoreInfo *) NULL;
static SplayTreeInfo
*coder_list = (SplayTreeInfo *) NULL;
static volatile MagickBooleanType
instantiate_coder = MagickFalse;
/*
Forward declarations.
*/
static MagickBooleanType
InitializeCoderList(ExceptionInfo *),
LoadCoderLists(const char *,ExceptionInfo *);
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
+ C o d e r C o m p o n e n t G e n e s i s %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% CoderComponentGenesis() instantiates the coder component.
%
% The format of the CoderComponentGenesis method is:
%
% MagickBooleanType CoderComponentGenesis(void)
%
*/
MagickExport MagickBooleanType CoderComponentGenesis(void)
{
AcquireSemaphoreInfo(&coder_semaphore);
return(MagickTrue);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
+ C o d e r C o m p o n e n t T e r m i n u s %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% CoderComponentTerminus() destroys the coder component.
%
% The format of the CoderComponentTerminus method is:
%
% CoderComponentTerminus(void)
%
*/
MagickExport void CoderComponentTerminus(void)
{
if (coder_semaphore == (SemaphoreInfo *) NULL)
AcquireSemaphoreInfo(&coder_semaphore);
LockSemaphoreInfo(coder_semaphore);
if (coder_list != (SplayTreeInfo *) NULL)
coder_list=DestroySplayTree(coder_list);
instantiate_coder=MagickFalse;
UnlockSemaphoreInfo(coder_semaphore);
DestroySemaphoreInfo(&coder_semaphore);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
+ G e t C o d e r I n f o %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% GetCoderInfo searches the coder list for the specified name and if found
% returns attributes for that coder.
%
% The format of the GetCoderInfo method is:
%
% const CoderInfo *GetCoderInfo(const char *name,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o name: the coder name.
%
% o exception: return any errors or warnings in this structure.
%
*/
MagickExport const CoderInfo *GetCoderInfo(const char *name,
ExceptionInfo *exception)
{
assert(exception != (ExceptionInfo *) NULL);
if ((coder_list == (SplayTreeInfo *) NULL) ||
(instantiate_coder == MagickFalse))
if (InitializeCoderList(exception) == MagickFalse)
return((const CoderInfo *) NULL);
if ((coder_list == (SplayTreeInfo *) NULL) ||
(GetNumberOfNodesInSplayTree(coder_list) == 0))
return((const CoderInfo *) NULL);
if ((name == (const char *) NULL) || (LocaleCompare(name,"*") == 0))
{
ResetSplayTreeIterator(coder_list);
return((const CoderInfo *) GetNextValueInSplayTree(coder_list));
}
return((const CoderInfo *) GetValueFromSplayTree(coder_list,name));
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% G e t C o d e r I n f o L i s t %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% GetCoderInfoList() returns any coder_map that match the specified pattern.
% The format of the GetCoderInfoList function is:
%
% const CoderInfo **GetCoderInfoList(const char *pattern,
% size_t *number_coders,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o pattern: Specifies a pointer to a text string containing a pattern.
%
% o number_coders: This integer returns the number of coders in the list.
%
% o exception: return any errors or warnings in this structure.
%
*/
static int CoderInfoCompare(const void *x,const void *y)
{
const CoderInfo
**p,
**q;
p=(const CoderInfo **) x,
q=(const CoderInfo **) y;
if (LocaleCompare((*p)->path,(*q)->path) == 0)
return(LocaleCompare((*p)->name,(*q)->name));
return(LocaleCompare((*p)->path,(*q)->path));
}
MagickExport const CoderInfo **GetCoderInfoList(const char *pattern,
size_t *number_coders,ExceptionInfo *exception)
{
const CoderInfo
**coder_map;
register const CoderInfo
*p;
register ssize_t
i;
/*
Allocate coder list.
*/
assert(pattern != (char *) NULL);
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",pattern);
assert(number_coders != (size_t *) NULL);
*number_coders=0;
p=GetCoderInfo("*",exception);
if (p == (const CoderInfo *) NULL)
return((const CoderInfo **) NULL);
coder_map=(const CoderInfo **) AcquireQuantumMemory((size_t)
GetNumberOfNodesInSplayTree(coder_list)+1UL,sizeof(*coder_map));
if (coder_map == (const CoderInfo **) NULL)
return((const CoderInfo **) NULL);
/*
Generate coder list.
*/
LockSemaphoreInfo(coder_semaphore);
ResetSplayTreeIterator(coder_list);
p=(const CoderInfo *) GetNextValueInSplayTree(coder_list);
for (i=0; p != (const CoderInfo *) NULL; )
{
if ((p->stealth == MagickFalse) &&
(GlobExpression(p->name,pattern,MagickFalse) != MagickFalse))
coder_map[i++]=p;
p=(const CoderInfo *) GetNextValueInSplayTree(coder_list);
}
UnlockSemaphoreInfo(coder_semaphore);
qsort((void *) coder_map,(size_t) i,sizeof(*coder_map),CoderInfoCompare);
coder_map[i]=(CoderInfo *) NULL;
*number_coders=(size_t) i;
return(coder_map);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% G e t C o d e r L i s t %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% GetCoderList() returns any coder_map that match the specified pattern.
%
% The format of the GetCoderList function is:
%
% char **GetCoderList(const char *pattern,size_t *number_coders,
% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o pattern: Specifies a pointer to a text string containing a pattern.
%
% o number_coders: This integer returns the number of coders in the list.
%
% o exception: return any errors or warnings in this structure.
%
*/
static int CoderCompare(const void *x,const void *y)
{
register const char
**p,
**q;
p=(const char **) x;
q=(const char **) y;
return(LocaleCompare(*p,*q));
}
MagickExport char **GetCoderList(const char *pattern,
size_t *number_coders,ExceptionInfo *exception)
{
char
**coder_map;
register const CoderInfo
*p;
register ssize_t
i;
/*
Allocate coder list.
*/
assert(pattern != (char *) NULL);
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",pattern);
assert(number_coders != (size_t *) NULL);
*number_coders=0;
p=GetCoderInfo("*",exception);
if (p == (const CoderInfo *) NULL)
return((char **) NULL);
coder_map=(char **) AcquireQuantumMemory((size_t)
GetNumberOfNodesInSplayTree(coder_list)+1UL,sizeof(*coder_map));
if (coder_map == (char **) NULL)
return((char **) NULL);
/*
Generate coder list.
*/
LockSemaphoreInfo(coder_semaphore);
ResetSplayTreeIterator(coder_list);
p=(const CoderInfo *) GetNextValueInSplayTree(coder_list);
for (i=0; p != (const CoderInfo *) NULL; )
{
if ((p->stealth == MagickFalse) &&
(GlobExpression(p->name,pattern,MagickFalse) != MagickFalse))
coder_map[i++]=ConstantString(p->name);
p=(const CoderInfo *) GetNextValueInSplayTree(coder_list);
}
UnlockSemaphoreInfo(coder_semaphore);
qsort((void *) coder_map,(size_t) i,sizeof(*coder_map),CoderCompare);
coder_map[i]=(char *) NULL;
*number_coders=(size_t) i;
return(coder_map);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
+ I n i t i a l i z e C o d e r L i s t %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% InitializeCoderList() initializes the coder list.
%
% The format of the InitializeCoderList method is:
%
% MagickBooleanType InitializeCoderList(ExceptionInfo *exception)
%
% A description of each parameter follows.
%
% o exception: return any errors or warnings in this structure.
%
*/
static MagickBooleanType InitializeCoderList(ExceptionInfo *exception)
{
if ((coder_list == (SplayTreeInfo *) NULL) &&
(instantiate_coder == MagickFalse))
{
if (coder_semaphore == (SemaphoreInfo *) NULL)
AcquireSemaphoreInfo(&coder_semaphore);
LockSemaphoreInfo(coder_semaphore);
if ((coder_list == (SplayTreeInfo *) NULL) &&
(instantiate_coder == MagickFalse))
{
(void) LoadCoderLists(MagickCoderFilename,exception);
instantiate_coder=MagickTrue;
}
UnlockSemaphoreInfo(coder_semaphore);
}
return(coder_list != (SplayTreeInfo *) NULL ? MagickTrue : MagickFalse);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% L i s t C o d e r I n f o %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ListCoderInfo() lists the coder info to a file.
%
% The format of the ListCoderInfo coder is:
%
% MagickBooleanType ListCoderInfo(FILE *file,ExceptionInfo *exception)
%
% A description of each parameter follows.
%
% o file: An pointer to a FILE.
%
% o exception: return any errors or warnings in this structure.
%
*/
MagickExport MagickBooleanType ListCoderInfo(FILE *file,
ExceptionInfo *exception)
{
const char
*path;
const CoderInfo
**coder_info;
register ssize_t
i;
size_t
number_coders;
ssize_t
j;
if (file == (const FILE *) NULL)
file=stdout;
coder_info=GetCoderInfoList("*",&number_coders,exception);
if (coder_info == (const CoderInfo **) NULL)
return(MagickFalse);
path=(const char *) NULL;
for (i=0; i < (ssize_t) number_coders; i++)
{
if (coder_info[i]->stealth != MagickFalse)
continue;
if ((path == (const char *) NULL) ||
(LocaleCompare(path,coder_info[i]->path) != 0))
{
if (coder_info[i]->path != (char *) NULL)
(void) FormatLocaleFile(file,"\nPath: %s\n\n",coder_info[i]->path);
(void) FormatLocaleFile(file,"Magick Coder\n");
(void) FormatLocaleFile(file,
"-------------------------------------------------"
"------------------------------\n");
}
path=coder_info[i]->path;
(void) FormatLocaleFile(file,"%s",coder_info[i]->magick);
for (j=(ssize_t) strlen(coder_info[i]->magick); j <= 11; j++)
(void) FormatLocaleFile(file," ");
if (coder_info[i]->name != (char *) NULL)
(void) FormatLocaleFile(file,"%s",coder_info[i]->name);
(void) FormatLocaleFile(file,"\n");
}
coder_info=(const CoderInfo **) RelinquishMagickMemory((void *) coder_info);
(void) fflush(file);
return(MagickTrue);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
+ L o a d C o d e r L i s t %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% LoadCoderList() loads the coder configuration file which provides a
% mapping between coder attributes and a coder name.
%
% The format of the LoadCoderList coder is:
%
% MagickBooleanType LoadCoderList(const char *xml,const char *filename,
% const size_t depth,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o xml: The coder list in XML format.
%
% o filename: The coder list filename.
%
% o depth: depth of <include /> statements.
%
% o exception: return any errors or warnings in this structure.
%
*/
static void *DestroyCoderNode(void *coder_info)
{
register CoderInfo
*p;
p=(CoderInfo *) coder_info;
if (p->exempt == MagickFalse)
{
if (p->path != (char *) NULL)
p->path=DestroyString(p->path);
if (p->name != (char *) NULL)
p->name=DestroyString(p->name);
if (p->magick != (char *) NULL)
p->magick=DestroyString(p->magick);
}
return(RelinquishMagickMemory(p));
}
static MagickBooleanType LoadCoderList(const char *xml,const char *filename,
const size_t depth,ExceptionInfo *exception)
{
char
keyword[MaxTextExtent],
*token;
const char
*q;
CoderInfo
*coder_info;
MagickBooleanType
status;
/*
Load the coder map file.
*/
(void) LogMagickEvent(ConfigureEvent,GetMagickModule(),
"Loading coder configuration file \"%s\" ...",filename);
if (xml == (const char *) NULL)
return(MagickFalse);
if (coder_list == (SplayTreeInfo *) NULL)
{
coder_list=NewSplayTree(CompareSplayTreeString,RelinquishMagickMemory,
DestroyCoderNode);
if (coder_list == (SplayTreeInfo *) NULL)
{
ThrowFileException(exception,ResourceLimitError,
"MemoryAllocationFailed",filename);
return(MagickFalse);
}
}
status=MagickTrue;
coder_info=(CoderInfo *) NULL;
token=AcquireString(xml);
for (q=(char *) xml; *q != '\0'; )
{
/*
Interpret XML.
*/
GetMagickToken(q,&q,token);
if (*token == '\0')
break;
(void) CopyMagickString(keyword,token,MaxTextExtent);
if (LocaleNCompare(keyword,"<!DOCTYPE",9) == 0)
{
/*
Doctype element.
*/
while ((LocaleNCompare(q,"]>",2) != 0) && (*q != '\0'))
GetMagickToken(q,&q,token);
continue;
}
if (LocaleNCompare(keyword,"<!--",4) == 0)
{
/*
Comment element.
*/
while ((LocaleNCompare(q,"->",2) != 0) && (*q != '\0'))
GetMagickToken(q,&q,token);
continue;
}
if (LocaleCompare(keyword,"<include") == 0)
{
/*
Include element.
*/
while (((*token != '/') && (*(token+1) != '>')) && (*q != '\0'))
{
(void) CopyMagickString(keyword,token,MaxTextExtent);
GetMagickToken(q,&q,token);
if (*token != '=')
continue;
GetMagickToken(q,&q,token);
if (LocaleCompare(keyword,"file") == 0)
{
if (depth > 200)
(void) ThrowMagickException(exception,GetMagickModule(),
ConfigureError,"IncludeNodeNestedTooDeeply","`%s'",token);
else
{
char
path[MaxTextExtent],
*xml;
GetPathComponent(filename,HeadPath,path);
if (*path != '\0')
(void) ConcatenateMagickString(path,DirectorySeparator,
MaxTextExtent);
if (*token == *DirectorySeparator)
(void) CopyMagickString(path,token,MaxTextExtent);
else
(void) ConcatenateMagickString(path,token,MaxTextExtent);
xml=FileToString(path,~0,exception);
if (xml != (char *) NULL)
{
status=LoadCoderList(xml,path,depth+1,exception);
xml=(char *) RelinquishMagickMemory(xml);
}
}
}
}
continue;
}
if (LocaleCompare(keyword,"<coder") == 0)
{
/*
Coder element.
*/
coder_info=(CoderInfo *) AcquireMagickMemory(sizeof(*coder_info));
if (coder_info == (CoderInfo *) NULL)
ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
(void) ResetMagickMemory(coder_info,0,sizeof(*coder_info));
coder_info->path=ConstantString(filename);
coder_info->exempt=MagickFalse;
coder_info->signature=MagickSignature;
continue;
}
if (coder_info == (CoderInfo *) NULL)
continue;
if (LocaleCompare(keyword,"/>") == 0)
{
status=AddValueToSplayTree(coder_list,ConstantString(
coder_info->magick),coder_info);
if (status == MagickFalse)
(void) ThrowMagickException(exception,GetMagickModule(),
ResourceLimitError,"MemoryAllocationFailed","`%s'",
coder_info->magick);
coder_info=(CoderInfo *) NULL;
}
GetMagickToken(q,(const char **) NULL,token);
if (*token != '=')
continue;
GetMagickToken(q,&q,token);
GetMagickToken(q,&q,token);
switch (*keyword)
{
case 'M':
case 'm':
{
if (LocaleCompare((char *) keyword,"magick") == 0)
{
coder_info->magick=ConstantString(token);
break;
}
break;
}
case 'N':
case 'n':
{
if (LocaleCompare((char *) keyword,"name") == 0)
{
coder_info->name=ConstantString(token);
break;
}
break;
}
case 'S':
case 's':
{
if (LocaleCompare((char *) keyword,"stealth") == 0)
{
coder_info->stealth=IsMagickTrue(token);
break;
}
break;
}
default:
break;
}
}
token=(char *) RelinquishMagickMemory(token);
return(status);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% L o a d C o d e r L i s t s %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% LoadCoderLists() loads one or more coder configuration file which
% provides a mapping between coder attributes and a coder name.
%
% The format of the LoadCoderLists coder is:
%
% MagickBooleanType LoadCoderLists(const char *filename,
% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o filename: the font file name.
%
% o exception: return any errors or warnings in this structure.
%
*/
static MagickBooleanType LoadCoderLists(const char *filename,
ExceptionInfo *exception)
{
const StringInfo
*option;
LinkedListInfo
*options;
MagickStatusType
status;
register ssize_t
i;
/*
Load built-in coder map.
*/
status=MagickFalse;
if (coder_list == (SplayTreeInfo *) NULL)
{
coder_list=NewSplayTree(CompareSplayTreeString,RelinquishMagickMemory,
DestroyCoderNode);
if (coder_list == (SplayTreeInfo *) NULL)
{
ThrowFileException(exception,ResourceLimitError,
"MemoryAllocationFailed",filename);
return(MagickFalse);
}
}
for (i=0; i < (ssize_t) (sizeof(CoderMap)/sizeof(*CoderMap)); i++)
{
CoderInfo
*coder_info;
register const CoderMapInfo
*p;
p=CoderMap+i;
coder_info=(CoderInfo *) AcquireMagickMemory(sizeof(*coder_info));
if (coder_info == (CoderInfo *) NULL)
{
(void) ThrowMagickException(exception,GetMagickModule(),
ResourceLimitError,"MemoryAllocationFailed","`%s'",coder_info->name);
continue;
}
(void) ResetMagickMemory(coder_info,0,sizeof(*coder_info));
coder_info->path=(char *) "[built-in]";
coder_info->magick=(char *) p->magick;
coder_info->name=(char *) p->name;
coder_info->exempt=MagickTrue;
coder_info->signature=MagickSignature;
status=AddValueToSplayTree(coder_list,ConstantString(coder_info->magick),
coder_info);
if (status == MagickFalse)
(void) ThrowMagickException(exception,GetMagickModule(),
ResourceLimitError,"MemoryAllocationFailed","`%s'",coder_info->name);
}
/*
Load external coder map.
*/
options=GetConfigureOptions(filename,exception);
option=(const StringInfo *) GetNextValueInLinkedList(options);
while (option != (const StringInfo *) NULL)
{
status|=LoadCoderList((const char *) GetStringInfoDatum(option),
GetStringInfoPath(option),0,exception);
option=(const StringInfo *) GetNextValueInLinkedList(options);
}
options=DestroyConfigureOptions(options);
return(status != 0 ? MagickTrue : MagickFalse);
}

View file

@ -0,0 +1,62 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore image coder methods.
*/
#ifndef _MAGICKCORE_CODER_H
#define _MAGICKCORE_CODER_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
typedef struct _CoderInfo
{
char
*path,
*magick,
*name;
MagickBooleanType
exempt,
stealth;
struct _CoderInfo
*previous,
*next; /* deprecated, use GetCoderInfoList() */
size_t
signature;
} CoderInfo;
extern MagickExport char
**GetCoderList(const char *,size_t *,ExceptionInfo *);
extern MagickExport const CoderInfo
*GetCoderInfo(const char *,ExceptionInfo *),
**GetCoderInfoList(const char *,size_t *,ExceptionInfo *);
extern MagickExport MagickBooleanType
CoderComponentGenesis(void),
ListCoderInfo(FILE *,ExceptionInfo *);
MagickExport void
CoderComponentTerminus(void);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

View file

@ -0,0 +1,146 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore image color methods.
*/
#ifndef _MAGICKCORE_COLOR_PRIVATE_H
#define _MAGICKCORE_COLOR_PRIVATE_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#include "magick/image.h"
#include "magick/color.h"
#include "magick/exception-private.h"
#include "magick/pixel-accessor.h"
static inline MagickBooleanType IsColorEqual(const PixelPacket *p,
const PixelPacket *q)
{
MagickRealType
blue,
green,
red;
red=(MagickRealType) p->red;
green=(MagickRealType) p->green;
blue=(MagickRealType) p->blue;
if ((fabs(red-q->red) < MagickEpsilon) &&
(fabs(green-q->green) < MagickEpsilon) &&
(fabs(blue-q->blue) < MagickEpsilon))
return(MagickTrue);
return(MagickFalse);
}
static inline MagickBooleanType IsMagickColorEqual(const MagickPixelPacket *p,
const MagickPixelPacket *q)
{
if ((p->matte != MagickFalse) && (q->matte == MagickFalse) &&
(fabs(p->opacity-OpaqueOpacity) >= MagickEpsilon))
return(MagickFalse);
if ((q->matte != MagickFalse) && (p->matte == MagickFalse) &&
(fabs(q->opacity-OpaqueOpacity)) >= MagickEpsilon)
return(MagickFalse);
if ((p->matte != MagickFalse) && (q->matte != MagickFalse))
{
if (fabs(p->opacity-q->opacity) >= MagickEpsilon)
return(MagickFalse);
if (fabs(p->opacity-TransparentOpacity) < MagickEpsilon)
return(MagickTrue);
}
if (fabs(p->red-q->red) >= MagickEpsilon)
return(MagickFalse);
if (fabs(p->green-q->green) >= MagickEpsilon)
return(MagickFalse);
if (fabs(p->blue-q->blue) >= MagickEpsilon)
return(MagickFalse);
if ((p->colorspace == CMYKColorspace) &&
(fabs(p->index-q->index) >= MagickEpsilon))
return(MagickFalse);
return(MagickTrue);
}
static inline MagickBooleanType IsMagickGray(const MagickPixelPacket *pixel)
{
if ((pixel->colorspace != GRAYColorspace) &&
(pixel->colorspace != RGBColorspace))
return(MagickFalse);
if ((fabs(pixel->red-pixel->green) < MagickEpsilon) &&
(fabs(pixel->green-pixel->blue) < MagickEpsilon))
return(MagickTrue);
return(MagickFalse);
}
static inline MagickRealType MagickPixelIntensity(
const MagickPixelPacket *pixel)
{
MagickRealType
blue,
green,
red;
if (pixel->colorspace == GRAYColorspace)
return(pixel->red);
if (pixel->colorspace != sRGBColorspace)
return(0.298839f*pixel->red+0.586811f*pixel->green+0.114350f*pixel->blue);
red=DecodePixelGamma(pixel->red);
green=DecodePixelGamma(pixel->green);
blue=DecodePixelGamma(pixel->blue);
return(0.298839f*red+0.586811f*green+0.114350f*blue);
}
static inline Quantum MagickPixelIntensityToQuantum(
const MagickPixelPacket *pixel)
{
MagickRealType
blue,
green,
red;
if (pixel->colorspace == GRAYColorspace)
return(ClampToQuantum(pixel->red));
if (pixel->colorspace != sRGBColorspace)
return(ClampToQuantum(0.298839f*pixel->red+0.586811f*pixel->green+
0.114350f*pixel->blue));
red=DecodePixelGamma(pixel->red);
green=DecodePixelGamma(pixel->green);
blue=DecodePixelGamma(pixel->blue);
return(ClampToQuantum(0.298839f*red+0.586811f*green+0.114350f*blue));
}
static inline MagickRealType MagickPixelLuminance(
const MagickPixelPacket *pixel)
{
MagickRealType
blue,
green,
red;
if (pixel->colorspace == GRAYColorspace)
return(pixel->red);
if (pixel->colorspace != sRGBColorspace)
return(0.21267f*pixel->red+0.71516f*pixel->green+0.07217f*pixel->blue);
red=DecodePixelGamma(pixel->red);
green=DecodePixelGamma(pixel->green);
blue=DecodePixelGamma(pixel->blue);
return(0.21267f*red+0.71516f*green+0.07217f*blue);
}
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

2926
ImageMagick/magick/color.c Normal file

File diff suppressed because it is too large Load diff

109
ImageMagick/magick/color.h Normal file
View file

@ -0,0 +1,109 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore image color methods.
*/
#ifndef _MAGICKCORE_COLOR_H
#define _MAGICKCORE_COLOR_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#include "magick/pixel.h"
#include "magick/exception.h"
typedef enum
{
UndefinedCompliance,
NoCompliance = 0x0000,
SVGCompliance = 0x0001,
X11Compliance = 0x0002,
XPMCompliance = 0x0004,
AllCompliance = 0x7fffffff
} ComplianceType;
typedef struct _ColorInfo
{
char
*path,
*name;
ComplianceType
compliance;
MagickPixelPacket
color;
MagickBooleanType
exempt,
stealth;
struct _ColorInfo
*previous,
*next; /* deprecated, use GetColorInfoList() */
size_t
signature;
} ColorInfo;
typedef struct _ErrorInfo
{
double
mean_error_per_pixel,
normalized_mean_error,
normalized_maximum_error;
} ErrorInfo;
extern MagickExport char
**GetColorList(const char *,size_t *,ExceptionInfo *);
extern MagickExport const ColorInfo
*GetColorInfo(const char *,ExceptionInfo *),
**GetColorInfoList(const char *,size_t *,ExceptionInfo *);
extern MagickExport MagickBooleanType
ColorComponentGenesis(void),
IsColorSimilar(const Image *,const PixelPacket *,const PixelPacket *),
IsGrayImage(const Image *,ExceptionInfo *),
IsImageSimilar(const Image *,const Image *,ssize_t *x,ssize_t *y,
ExceptionInfo *),
IsMagickColorSimilar(const MagickPixelPacket *,const MagickPixelPacket *),
IsMonochromeImage(const Image *,ExceptionInfo *),
IsOpacitySimilar(const Image *,const PixelPacket *,const PixelPacket *),
IsOpaqueImage(const Image *,ExceptionInfo *),
ListColorInfo(FILE *,ExceptionInfo *),
QueryColorCompliance(const char *,const ComplianceType,PixelPacket *,
ExceptionInfo *),
QueryColorDatabase(const char *,PixelPacket *,ExceptionInfo *),
QueryColorname(const Image *,const PixelPacket *,const ComplianceType,char *,
ExceptionInfo *),
QueryMagickColorCompliance(const char *,const ComplianceType,
MagickPixelPacket *,ExceptionInfo *),
QueryMagickColor(const char *,MagickPixelPacket *,ExceptionInfo *),
QueryMagickColorname(const Image *,const MagickPixelPacket *,
const ComplianceType,char *,ExceptionInfo *);
extern MagickExport void
ColorComponentTerminus(void),
ConcatenateColorComponent(const MagickPixelPacket *,const ChannelType,
const ComplianceType,char *),
GetColorTuple(const MagickPixelPacket *,const MagickBooleanType,char *);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

View file

@ -0,0 +1,43 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore image colormap methods.
*/
#ifndef _MAGICKCORE_COLORMAP_PRIVATE_H
#define _MAGICKCORE_COLORMAP_PRIVATE_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#include "magick/image.h"
#include "magick/color.h"
#include "magick/exception-private.h"
static inline IndexPacket ConstrainColormapIndex(Image *image,
const size_t index)
{
if (index < image->colors)
return((IndexPacket) index);
(void) ThrowMagickException(&image->exception,GetMagickModule(),
CorruptImageError,"InvalidColormapIndex","`%s'",image->filename);
return((IndexPacket) 0);
}
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

View file

@ -0,0 +1,397 @@
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% CCCC OOO L OOO RRRR M M AAA PPPP %
% C O O L O O R R MM MM A A P P %
% C O O L O O RRRR M M M AAAAA PPPP %
% C O O L O O R R M M A A P %
% CCCC OOO LLLLL OOO R R M M A A P %
% %
% %
% MagickCore Colormap Methods %
% %
% Software Design %
% John Cristy %
% July 1992 %
% %
% %
% Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization %
% dedicated to making software imaging solutions freely available. %
% %
% You may not use this file except in compliance with the License. You may %
% obtain a copy of the License at %
% %
% http://www.imagemagick.org/script/license.php %
% %
% Unless required by applicable law or agreed to in writing, software %
% distributed under the License is distributed on an "AS IS" BASIS, %
% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
% See the License for the specific language governing permissions and %
% limitations under the License. %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% We use linked-lists because splay-trees do not currently support duplicate
% key / value pairs (.e.g X11 green compliance and SVG green compliance).
%
*/
/*
Include declarations.
*/
#include "magick/studio.h"
#include "magick/attribute.h"
#include "magick/blob.h"
#include "magick/cache-view.h"
#include "magick/cache.h"
#include "magick/color.h"
#include "magick/color-private.h"
#include "magick/colormap.h"
#include "magick/client.h"
#include "magick/configure.h"
#include "magick/exception.h"
#include "magick/exception-private.h"
#include "magick/gem.h"
#include "magick/geometry.h"
#include "magick/image-private.h"
#include "magick/memory_.h"
#include "magick/monitor.h"
#include "magick/monitor-private.h"
#include "magick/option.h"
#include "magick/pixel-accessor.h"
#include "magick/pixel-private.h"
#include "magick/quantize.h"
#include "magick/quantum.h"
#include "magick/semaphore.h"
#include "magick/resource_.h"
#include "magick/string_.h"
#include "magick/thread-private.h"
#include "magick/token.h"
#include "magick/utility.h"
#include "magick/xml-tree.h"
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% A c q u i r e I m a g e C o l o r m a p %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% AcquireImageColormap() allocates an image colormap and initializes
% it to a linear gray colorspace. If the image already has a colormap,
% it is replaced. AcquireImageColormap() returns MagickTrue if successful,
% otherwise MagickFalse if there is not enough memory.
%
% The format of the AcquireImageColormap method is:
%
% MagickBooleanType AcquireImageColormap(Image *image,
% const size_t colors)
%
% A description of each parameter follows:
%
% o image: the image.
%
% o colors: the number of colors in the image colormap.
%
*/
static inline size_t MagickMax(const size_t x,
const size_t y)
{
if (x > y)
return(x);
return(y);
}
static inline size_t MagickMin(const size_t x,
const size_t y)
{
if (x < y)
return(x);
return(y);
}
MagickExport MagickBooleanType AcquireImageColormap(Image *image,
const size_t colors)
{
register ssize_t
i;
size_t
length;
/*
Allocate image colormap.
*/
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
image->colors=colors;
length=(size_t) colors;
if (image->colormap == (PixelPacket *) NULL)
image->colormap=(PixelPacket *) AcquireQuantumMemory(length,
sizeof(*image->colormap));
else
image->colormap=(PixelPacket *) ResizeQuantumMemory(image->colormap,length,
sizeof(*image->colormap));
if (image->colormap == (PixelPacket *) NULL)
ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
image->filename);
for (i=0; i < (ssize_t) image->colors; i++)
{
size_t
pixel;
pixel=(size_t) (i*(QuantumRange/MagickMax(colors-1,1)));
image->colormap[i].red=(Quantum) pixel;
image->colormap[i].green=(Quantum) pixel;
image->colormap[i].blue=(Quantum) pixel;
image->colormap[i].opacity=OpaqueOpacity;
}
return(SetImageStorageClass(image,PseudoClass));
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% C y c l e C o l o r m a p I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% CycleColormap() displaces an image's colormap by a given number of
% positions. If you cycle the colormap a number of times you can produce
% a psychodelic effect.
%
% The format of the CycleColormapImage method is:
%
% MagickBooleanType CycleColormapImage(Image *image,const ssize_t displace)
%
% A description of each parameter follows:
%
% o image: the image.
%
% o displace: displace the colormap this amount.
%
*/
MagickExport MagickBooleanType CycleColormapImage(Image *image,
const ssize_t displace)
{
CacheView
*image_view;
ExceptionInfo
*exception;
MagickBooleanType
status;
ssize_t
y;
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
if (image->storage_class == DirectClass)
(void) SetImageType(image,PaletteType);
status=MagickTrue;
exception=(&image->exception);
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(status) \
magick_threads(image,image,1,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
register IndexPacket
*restrict indexes;
register ssize_t
x;
register PixelPacket
*restrict q;
ssize_t
index;
if (status == MagickFalse)
continue;
q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
{
status=MagickFalse;
continue;
}
indexes=GetCacheViewAuthenticIndexQueue(image_view);
for (x=0; x < (ssize_t) image->columns; x++)
{
index=(ssize_t) (GetPixelIndex(indexes+x)+displace) %
image->colors;
if (index < 0)
index+=(ssize_t) image->colors;
SetPixelIndex(indexes+x,index);
SetPixelRGBO(q,image->colormap+(ssize_t) index);
q++;
}
if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
status=MagickFalse;
}
image_view=DestroyCacheView(image_view);
return(status);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
+ S o r t C o l o r m a p B y I n t e n s i t y %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% SortColormapByIntensity() sorts the colormap of a PseudoClass image by
% decreasing color intensity.
%
% The format of the SortColormapByIntensity method is:
%
% MagickBooleanType SortColormapByIntensity(Image *image)
%
% A description of each parameter follows:
%
% o image: A pointer to an Image structure.
%
*/
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
static int IntensityCompare(const void *x,const void *y)
{
const PixelPacket
*color_1,
*color_2;
int
intensity;
color_1=(const PixelPacket *) x;
color_2=(const PixelPacket *) y;
intensity=PixelPacketIntensity(color_2)-(int) PixelPacketIntensity(color_1);
return(intensity);
}
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
MagickExport MagickBooleanType SortColormapByIntensity(Image *image)
{
CacheView
*image_view;
ExceptionInfo
*exception;
MagickBooleanType
status;
register ssize_t
i;
ssize_t
y;
unsigned short
*pixels;
assert(image != (Image *) NULL);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
assert(image->signature == MagickSignature);
if (image->storage_class != PseudoClass)
return(MagickTrue);
/*
Allocate memory for pixel indexes.
*/
pixels=(unsigned short *) AcquireQuantumMemory((size_t) image->colors,
sizeof(*pixels));
if (pixels == (unsigned short *) NULL)
ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
image->filename);
/*
Assign index values to colormap entries.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(status) \
magick_threads(image,image,1,1)
#endif
for (i=0; i < (ssize_t) image->colors; i++)
image->colormap[i].opacity=(IndexPacket) i;
/*
Sort image colormap by decreasing color popularity.
*/
qsort((void *) image->colormap,(size_t) image->colors,
sizeof(*image->colormap),IntensityCompare);
/*
Update image colormap indexes to sorted colormap order.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(status)
#endif
for (i=0; i < (ssize_t) image->colors; i++)
pixels[(ssize_t) image->colormap[i].opacity]=(unsigned short) i;
status=MagickTrue;
exception=(&image->exception);
image_view=AcquireAuthenticCacheView(image,exception);
for (y=0; y < (ssize_t) image->rows; y++)
{
IndexPacket
index;
register ssize_t
x;
register IndexPacket
*restrict indexes;
register PixelPacket
*restrict q;
q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
{
status=MagickFalse;
continue;
}
indexes=GetCacheViewAuthenticIndexQueue(image_view);
for (x=0; x < (ssize_t) image->columns; x++)
{
index=(IndexPacket) pixels[(ssize_t) GetPixelIndex(indexes+x)];
SetPixelIndex(indexes+x,index);
SetPixelRGBO(q,image->colormap+(ssize_t) index);
q++;
}
if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
status=MagickFalse;
if (status == MagickFalse)
break;
}
image_view=DestroyCacheView(image_view);
pixels=(unsigned short *) RelinquishMagickMemory(pixels);
return(status);
}

View file

@ -0,0 +1,34 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore image colormap methods.
*/
#ifndef _MAGICKCORE_COLORMAP_H
#define _MAGICKCORE_COLORMAP_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
extern MagickExport MagickBooleanType
AcquireImageColormap(Image *,const size_t),
CycleColormapImage(Image *,const ssize_t),
SortColormapByIntensity(Image *);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

View file

@ -0,0 +1,121 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore image colorspace private methods.
*/
#ifndef _MAGICKCORE_COLORSPACE_PRIVATE_H
#define _MAGICKCORE_COLORSPACE_PRIVATE_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#include "magick/image.h"
#include "magick/image-private.h"
#include "magick/pixel.h"
#include "magick/pixel-accessor.h"
static inline void ConvertRGBToCMYK(MagickPixelPacket *pixel)
{
MagickRealType
black,
blue,
cyan,
green,
magenta,
red,
yellow;
if (pixel->colorspace != sRGBColorspace)
{
red=QuantumScale*pixel->red;
green=QuantumScale*pixel->green;
blue=QuantumScale*pixel->blue;
}
else
{
red=DecodePixelGamma(pixel->red);
green=DecodePixelGamma(pixel->green);
blue=DecodePixelGamma(pixel->blue);
}
if ((fabs(red) < MagickEpsilon) && (fabs(green) < MagickEpsilon) &&
(fabs(blue) < MagickEpsilon))
{
pixel->index=(MagickRealType) QuantumRange;
return;
}
cyan=(MagickRealType) (1.0-red);
magenta=(MagickRealType) (1.0-green);
yellow=(MagickRealType) (1.0-blue);
black=cyan;
if (magenta < black)
black=magenta;
if (yellow < black)
black=yellow;
cyan=(MagickRealType) ((cyan-black)/(1.0-black));
magenta=(MagickRealType) ((magenta-black)/(1.0-black));
yellow=(MagickRealType) ((yellow-black)/(1.0-black));
pixel->colorspace=CMYKColorspace;
pixel->red=QuantumRange*cyan;
pixel->green=QuantumRange*magenta;
pixel->blue=QuantumRange*yellow;
pixel->index=QuantumRange*black;
}
static inline MagickBooleanType IsCMYKColorspace(
const ColorspaceType colorspace)
{
if (colorspace == CMYKColorspace)
return(MagickTrue);
return(MagickFalse);
}
static inline MagickBooleanType IsGrayColorspace(
const ColorspaceType colorspace)
{
if ((colorspace == GRAYColorspace) || (colorspace == Rec601LumaColorspace) ||
(colorspace == Rec709LumaColorspace))
return(MagickTrue);
return(MagickFalse);
}
static inline MagickBooleanType IsRGBColorspace(const ColorspaceType colorspace)
{
if (colorspace == RGBColorspace)
return(MagickTrue);
return(MagickFalse);
}
static inline MagickBooleanType IssRGBColorspace(
const ColorspaceType colorspace)
{
if ((colorspace == sRGBColorspace) || (colorspace == TransparentColorspace))
return(MagickTrue);
return(MagickFalse);
}
static inline MagickBooleanType IssRGBCompatibleColorspace(
const ColorspaceType colorspace)
{
if ((colorspace == sRGBColorspace) || (colorspace == TransparentColorspace) || (colorspace == RGBColorspace) || (colorspace == GRAYColorspace))
return(MagickTrue);
return(MagickFalse);
}
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,66 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore image colorspace methods.
*/
#ifndef _MAGICKCORE_COLORSPACE_H
#define _MAGICKCORE_COLORSPACE_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
typedef enum
{
UndefinedColorspace,
RGBColorspace,
GRAYColorspace,
TransparentColorspace,
OHTAColorspace,
LabColorspace,
XYZColorspace,
YCbCrColorspace,
YCCColorspace,
YIQColorspace,
YPbPrColorspace,
YUVColorspace,
CMYKColorspace,
sRGBColorspace,
HSBColorspace,
HSLColorspace,
HWBColorspace,
Rec601LumaColorspace,
Rec601YCbCrColorspace,
Rec709LumaColorspace,
Rec709YCbCrColorspace,
LogColorspace,
CMYColorspace,
LuvColorspace,
HCLColorspace,
LCHColorspace,
LMSColorspace
} ColorspaceType;
extern MagickExport MagickBooleanType
RGBTransformImage(Image *,const ColorspaceType),
SetImageColorspace(Image *,const ColorspaceType),
TransformImageColorspace(Image *,const ColorspaceType),
TransformRGBImage(Image *,const ColorspaceType);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

1874
ImageMagick/magick/compare.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,66 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore image compare methods.
*/
#ifndef _MAGICKCORE_COMPARE_H
#define _MAGICKCORE_COMPARE_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#include "magick/image.h"
typedef enum
{
UndefinedMetric,
AbsoluteErrorMetric,
MeanAbsoluteErrorMetric,
MeanErrorPerPixelMetric,
MeanSquaredErrorMetric,
PeakAbsoluteErrorMetric,
PeakSignalToNoiseRatioMetric,
RootMeanSquaredErrorMetric,
NormalizedCrossCorrelationErrorMetric,
FuzzErrorMetric
} MetricType;
extern MagickExport double
*GetImageChannelDistortions(Image *,const Image *,const MetricType,
ExceptionInfo *);
extern MagickExport Image
*CompareImageChannels(Image *,const Image *,const ChannelType,
const MetricType,double *,ExceptionInfo *),
*CompareImages(Image *,const Image *,const MetricType,double *,
ExceptionInfo *),
*SimilarityImage(Image *,const Image *,RectangleInfo *,double *,
ExceptionInfo *),
*SimilarityMetricImage(Image *,const Image *,const MetricType,
RectangleInfo *,double *,ExceptionInfo *);
extern MagickExport MagickBooleanType
GetImageChannelDistortion(Image *,const Image *,const ChannelType,
const MetricType,double *,ExceptionInfo *),
GetImageDistortion(Image *,const Image *,const MetricType,double *,
ExceptionInfo *),
IsImagesEqual(Image *,const Image *);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

View file

@ -0,0 +1,164 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore image composite private methods.
*/
#ifndef _MAGICKCORE_COMPOSITE_PRIVATE_H
#define _MAGICKCORE_COMPOSITE_PRIVATE_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
/*
ImageMagick Alpha Composite Inline Methods (special export)
*/
#include "magick/color.h"
#include "magick/image.h"
#include "magick/image-private.h"
#include "magick/pixel-private.h"
static inline MagickRealType RoundToUnity(const MagickRealType value)
{
return(value < 0.0 ? 0.0 : (value > 1.0) ? 1.0 : value);
}
static inline MagickRealType MagickOver_(const MagickRealType p,
const MagickRealType alpha,const MagickRealType q,const MagickRealType beta)
{
return((1.0-QuantumScale*alpha)*p+(1.0-QuantumScale*beta)*q*
QuantumScale*alpha);
}
static inline void MagickCompositeOver(const PixelPacket *p,
const MagickRealType alpha,const PixelPacket *q,const MagickRealType beta,
PixelPacket *composite)
{
double
gamma;
/*
Compose pixel p over pixel q with the given opacities.
*/
if (alpha == TransparentOpacity)
{
if (composite != q)
*composite=(*q);
return;
}
gamma=1.0-QuantumScale*QuantumScale*alpha*beta;
#if !defined(MAGICKCORE_HDRI_SUPPORT)
composite->opacity=(Quantum) (QuantumRange*(1.0-gamma)+0.5);
gamma=PerceptibleReciprocal(gamma);
SetPixelRed(composite,gamma*MagickOver_((MagickRealType)
GetPixelRed(p),alpha,(MagickRealType) GetPixelRed(q),beta)+0.5);
SetPixelGreen(composite,gamma*MagickOver_((MagickRealType)
GetPixelGreen(p),alpha,(MagickRealType) GetPixelGreen(q),beta)+0.5);
SetPixelBlue(composite,gamma*MagickOver_((MagickRealType)
GetPixelBlue(p),alpha,(MagickRealType) GetPixelBlue(q),beta)+0.5);
#else
SetPixelOpacity(composite,QuantumRange*(1.0-gamma));
gamma=PerceptibleReciprocal(gamma);
SetPixelRed(composite,gamma*MagickOver_((MagickRealType)
GetPixelRed(p),alpha,(MagickRealType) GetPixelRed(q),beta));
SetPixelGreen(composite,gamma*MagickOver_((MagickRealType)
GetPixelGreen(p),alpha,(MagickRealType) GetPixelGreen(q),beta));
SetPixelBlue(composite,gamma*MagickOver_((MagickRealType)
GetPixelBlue(p),alpha,(MagickRealType) GetPixelBlue(q),beta));
#endif
}
static inline void MagickPixelCompositeOver(const MagickPixelPacket *p,
const MagickRealType alpha,const MagickPixelPacket *q,
const MagickRealType beta,MagickPixelPacket *composite)
{
double
gamma;
/*
Compose pixel p over pixel q with the given opacities.
*/
if (alpha == OpaqueOpacity)
{
*composite=(*p);
return;
}
gamma=1.0-QuantumScale*QuantumScale*alpha*beta;
composite->opacity=(MagickRealType) QuantumRange*(1.0-gamma);
gamma=PerceptibleReciprocal(gamma);
composite->red=gamma*MagickOver_(p->red,alpha,q->red,beta);
composite->green=gamma*MagickOver_(p->green,alpha,q->green,beta);
composite->blue=gamma*MagickOver_(p->blue,alpha,q->blue,beta);
if (q->colorspace == CMYKColorspace)
composite->index=gamma*MagickOver_(p->index,alpha,q->index,beta);
}
static inline void MagickPixelCompositePlus(const MagickPixelPacket *p,
const MagickRealType alpha,const MagickPixelPacket *q,
const MagickRealType beta,MagickPixelPacket *composite)
{
double
gamma;
MagickRealType
Da,
Sa;
/*
Add two pixels with the given opacities.
*/
Sa=1.0-QuantumScale*alpha;
Da=1.0-QuantumScale*beta;
gamma=RoundToUnity(Sa+Da); /* 'Plus' blending -- not 'Over' blending */
composite->opacity=(MagickRealType) QuantumRange*(1.0-gamma);
gamma=PerceptibleReciprocal(gamma);
composite->red=gamma*(Sa*p->red+Da*q->red);
composite->green=gamma*(Sa*p->green+Da*q->green);
composite->blue=gamma*(Sa*p->blue+Da*q->blue);
if (q->colorspace == CMYKColorspace)
composite->index=gamma*(Sa*p->index+Da*q->index);
}
/*
Blend pixel colors p and q by the amount given.
*/
static inline void MagickPixelCompositeBlend(const MagickPixelPacket *p,
const MagickRealType alpha,const MagickPixelPacket *q,
const MagickRealType beta,MagickPixelPacket *composite)
{
MagickPixelCompositePlus(p,(MagickRealType) (QuantumRange-alpha*
(QuantumRange-p->opacity)),q,(MagickRealType) (QuantumRange-beta*
(QuantumRange-q->opacity)),composite);
}
/*
Blend pixel colors p and q by the amount given and area.
*/
static inline void MagickPixelCompositeAreaBlend(const MagickPixelPacket *p,
const MagickRealType alpha,const MagickPixelPacket *q,
const MagickRealType beta,const MagickRealType area,
MagickPixelPacket *composite)
{
MagickPixelCompositePlus(p,(MagickRealType) QuantumRange-(1.0-area)*
(QuantumRange-alpha),q,(MagickRealType) (QuantumRange-area*(QuantumRange-
beta)),composite);
}
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,120 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore image composite methods.
*/
#ifndef _MAGICKCORE_COMPOSITE_H
#define _MAGICKCORE_COMPOSITE_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
typedef enum
{
UndefinedCompositeOp,
NoCompositeOp,
ModulusAddCompositeOp,
AtopCompositeOp,
BlendCompositeOp,
BumpmapCompositeOp,
ChangeMaskCompositeOp,
ClearCompositeOp,
ColorBurnCompositeOp,
ColorDodgeCompositeOp,
ColorizeCompositeOp,
CopyBlackCompositeOp,
CopyBlueCompositeOp,
CopyCompositeOp,
CopyCyanCompositeOp,
CopyGreenCompositeOp,
CopyMagentaCompositeOp,
CopyOpacityCompositeOp,
CopyRedCompositeOp,
CopyYellowCompositeOp,
DarkenCompositeOp,
DstAtopCompositeOp,
DstCompositeOp,
DstInCompositeOp,
DstOutCompositeOp,
DstOverCompositeOp,
DifferenceCompositeOp,
DisplaceCompositeOp,
DissolveCompositeOp,
ExclusionCompositeOp,
HardLightCompositeOp,
HueCompositeOp,
InCompositeOp,
LightenCompositeOp,
LinearLightCompositeOp,
LuminizeCompositeOp,
MinusDstCompositeOp,
ModulateCompositeOp,
MultiplyCompositeOp,
OutCompositeOp,
OverCompositeOp,
OverlayCompositeOp,
PlusCompositeOp,
ReplaceCompositeOp,
SaturateCompositeOp,
ScreenCompositeOp,
SoftLightCompositeOp,
SrcAtopCompositeOp,
SrcCompositeOp,
SrcInCompositeOp,
SrcOutCompositeOp,
SrcOverCompositeOp,
ModulusSubtractCompositeOp,
ThresholdCompositeOp,
XorCompositeOp,
/* These are new operators, added after the above was last sorted.
* The list should be re-sorted only when a new library version is
* created.
*/
DivideDstCompositeOp,
DistortCompositeOp,
BlurCompositeOp,
PegtopLightCompositeOp,
VividLightCompositeOp,
PinLightCompositeOp,
LinearDodgeCompositeOp,
LinearBurnCompositeOp,
MathematicsCompositeOp,
DivideSrcCompositeOp,
MinusSrcCompositeOp,
DarkenIntensityCompositeOp,
LightenIntensityCompositeOp
} CompositeOperator;
/* Depreciated (renamed) Method Names for backward compatibility
* However the CompositeOp value has not changed, just renamed.
*/
#define AddCompositeOp ModulusAddCompositeOp
#define SubtractCompositeOp ModulusSubtractCompositeOp
#define MinusCompositeOp MinusDstCompositeOp
#define DivideCompositeOp DivideDstCompositeOp
extern MagickExport MagickBooleanType
CompositeImage(Image *,const CompositeOperator,const Image *,const ssize_t,
const ssize_t),
CompositeImageChannel(Image *,const ChannelType,const CompositeOperator,
const Image *,const ssize_t,const ssize_t),
TextureImage(Image *,const Image *);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,70 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore image compression/decompression methods.
*/
#ifndef _MAGICKCORE_COMPRESS_H
#define _MAGICKCORE_COMPRESS_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
typedef enum
{
UndefinedCompression,
NoCompression,
BZipCompression,
DXT1Compression,
DXT3Compression,
DXT5Compression,
FaxCompression,
Group4Compression,
JPEGCompression,
JPEG2000Compression, /* ISO/IEC std 15444-1 */
LosslessJPEGCompression,
LZWCompression,
RLECompression,
ZipCompression,
ZipSCompression,
PizCompression,
Pxr24Compression,
B44Compression,
B44ACompression,
LZMACompression, /* Lempel-Ziv-Markov chain algorithm */
JBIG1Compression, /* ISO/IEC std 11544 / ITU-T rec T.82 */
JBIG2Compression /* ISO/IEC std 14492 / ITU-T rec T.88 */
} CompressionType;
typedef struct _Ascii85Info
Ascii85Info;
extern MagickExport MagickBooleanType
HuffmanDecodeImage(Image *),
HuffmanEncodeImage(const ImageInfo *,Image *,Image *),
LZWEncodeImage(Image *,const size_t,unsigned char *),
PackbitsEncodeImage(Image *,const size_t,unsigned char *),
ZLIBEncodeImage(Image *,const size_t,unsigned char *);
extern MagickExport void
Ascii85Encode(Image *,const unsigned char),
Ascii85Flush(Image *),
Ascii85Initialize(Image *);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

View file

@ -0,0 +1,286 @@
/* magick/config.h.in. Generated automatically from configure.in by autoheader. */
/* Define if you don't have vprintf but do have _doprnt. */
#undef MAGICKCORE_HAVE_DOPRNT
/* Define if you have a working `mmap' system call. */
#define MAGICKCORE_HAVE_MMAP 1
/* Define if you have the vprintf function. */
#define MAGICKCORE_HAVE_VPRINTF 1
/* Define as __inline if that's what the C compiler calls it. */
#define MAGICKCORE_inline __inline
/* Define as the return type of signal handlers (int or void). */
#define MAGICKCORE_RETSIGTYPE void
/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */
#undef MAGICKCORE_STAT_MACROS_BROKEN
/* Define if you have the ANSI C header files. */
#define MAGICKCORE_STDC_HEADERS 1
/* Define if you can safely include both <sys/time.h> and <time.h>. */
#define MAGICKCORE_TIME_WITH_SYS_TIME 1
/* Define if your processor stores words with the most significant
byte first (like Motorola and SPARC, unlike Intel and VAX). */
#undef MAGICKCORE_WORDS_BIGENDIAN
/* Define if the X Window System is missing or not being used. */
#undef MAGICKCORE_X_DISPLAY_MISSING
/* The number of bytes in a int. */
#define MAGICKCORE_SIZEOF_INT 4
/* The number of bytes in a long long. */
#define MAGICKCORE_SIZEOF_UNSIGNED_LONG_LONG 8
/* Define if you have the getcwd function. */
#define MAGICKCORE_HAVE_GETCWD 1
/* Define if you have the getexecname function. */
#undef MAGICKCORE_HAVE_GETEXECNAME
/* Define if you have the getpagesize function. */
#define MAGICKCORE_HAVE_GETPAGESIZE 1
/* Define if you have the gettimeofday function. */
#define MAGICKCORE_HAVE_GETTIMEOFDAY 1
/* Define if you have the mkdir function. */
#define MAGICKCORE_HAVE_MKDIR 1
/* Define if you have the poll function. */
#undef MAGICKCORE_HAVE_POLL
/* Define if you have the select function. */
#undef MAGICKCORE_HAVE_SELECT
/* Define if you have the snprintf function. */
#undef MAGICKCORE_HAVE_SNPRINTF
/* Define if you have the strchr function. */
#define MAGICKCORE_HAVE_STRCHR 1
/* Define if you have the strerror function. */
#define MAGICKCORE_HAVE_STRERROR 1
/* Define if you have the strtol function. */
#define MAGICKCORE_HAVE_STRTOL 1
/* Define if you have the sysconf function. */
#define MAGICKCORE_HAVE_SYSCONF 1
/* Define if you have the tempnam function. */
#define MAGICKCORE_HAVE_TEMPNAM 1
/* Define if you have the vsnprintf function. */
#undef MAGICKCORE_HAVE_VSNPRINTF
/* Define if you have the <dirent.h> header file. */
#define MAGICKCORE_HAVE_DIRENT_H 1
/* Define if you have the <errno.h> header file. */
#define MAGICKCORE_HAVE_ERRNO_H 1
/* Define if you have the <fcntl.h> header file. */
#define MAGICKCORE_HAVE_FCNTL_H 1
/* Define if you have the <ft2build.h> header file. */
#define MAGICKCORE_HAVE_FT2BUILD_H 1
/* Define if you have the <freetype/freetype.h> header file. */
#define MAGICKCORE_HAVE_FREETYPE_FREETYPE_H 1
/* Define if you have the <hdf.h> header file. */
#define MAGICKCORE_HAVE_HDF_H 1
/* Define if you have the <hdf/hdf.h> header file. */
#undef MAGICKCORE_HAVE_HDF_HDF_H
/* Define if you have the <libxml/xml-error.h> header file. */
#undef MAGICKCORE_HAVE_LIBXML_XML_ERROR_H
/* Define if you have the <libxml/xmlerror.h> header file. */
#undef MAGICKCORE_HAVE_LIBXML_XMLERROR_H
/* Define if you have the <jp2conf.h> header file. */
#undef MAGICKCORE_HAVE_JP2CONF_H
/* Define if you have the <malloc.h> header file. */
#undef MAGICKCORE_HAVE_MALLOC_H
/* Define if you have the <math.h> header file. */
#define MAGICKCORE_HAVE_MATH_H 1
/* Define if you have the <memory.h> header file. */
#define MAGICKCORE_HAVE_MEMORY_H 1
/* Define if you have the <ndir.h> header file. */
#undef MAGICKCORE_HAVE_NDIR_H
/* Define if you have the <pwd.h> header file. */
#define MAGICKCORE_HAVE_PWD_H 1
/* Define if you have the <stdarg.h> header file. */
#define MAGICKCORE_HAVE_STDARG_H 1
/* Define if you have the <stdint.h> header file. */
#undef MAGICKCORE_HAVE_STDINT_H
/* Define if you have the <string.h> header file. */
#define MAGICKCORE_HAVE_STRING_H 1
/* Define if you have the <sys/dir.h> header file. */
#undef MAGICKCORE_HAVE_SYS_DIR_H
/* Define if you have the <sys/ndir.h> header file. */
#undef MAGICKCORE_HAVE_SYS_NDIR_H
/* Define if you have the <sys/select.h> header file. */
#define MAGICKCORE_HAVE_SYS_SELECT_H 1
/* Define if you have the <sys/stat.h> header file. */
#define MAGICKCORE_HAVE_SYS_STAT_H 1
/* Define if you have the <sys/time.h> header file. */
#define MAGICKCORE_HAVE_SYS_TIME_H 1
/* Define if you have the <sys/types.h> header file. */
#define MAGICKCORE_HAVE_SYS_TYPES_H 1
/* Define if you have the <tiffconf.h> header file. */
#define MAGICKCORE_HAVE_TIFFCONF_H 1
/* Define if you have the <unistd.h> header file. */
#define MAGICKCORE_HAVE_UNISTD_H 1
/* Define if you have the <varargs.h> header file. */
#undef MAGICKCORE_HAVE_VARARGS_H
/* Define if using libltdl to create dynamically loadable modules */
#undef MAGICKCORE_LTDL_DELEGATE
/* Location of coder modules */
#undef MAGICKCORE_MagickModulesPath
/* Number of bits in a pixel Quantum (8 or 16) */
#define MAGICKCORE_QUANTUM_DEPTH 16
/* Pixel cache threshold (default 2047MB) */
#undef MAGICKCORE_PixelCacheThreshold
/* Define to specify default TrueType font path. */
#undef MAGICKCORE_TT_FONT_PATH
/* Location of X11 configure files */
#undef MAGICKCORE_X11ConfigurePath
/* Define if you have Posix thread methods. */
#undef MAGICKCORE_HasPTHREADS
/* Define if you have zlib compression library */
#define MAGICKCORE_ZLIB_DELEGATE 1
/* Define if you have the bzip2 library */
#define MAGICKCORE_BZLIB_DELEGATE 1
/* Define if you have X11 library */
#define MAGICKCORE_X11_DELEGATE 1
/* X11 server supports shared memory extension */
#undef MAGICKCORE_HAVE_SHARED_MEMORY
/* X11 server supports shape extension */
#undef MAGICKCORE_HAVE_SHAPE
/* Define if you have Display Postscript */
#undef MAGICKCORE_DPS_DELEGATE
/* Define if you have FlashPIX library */
#undef MAGICKCORE_FPX_DELEGATE
/* Define if you have LCMS library */
#undef MAGICKCORE_LCMS_DELEGATE
/* Define if you have PNG library */
#define MAGICKCORE_PNG_DELEGATE 1
/* Define if you have JPEG library */
#define MAGICKCORE_JPEG_DELEGATE 1
/* Define if you have JPEG version 2 Jasper library */
#define MAGICKCORE_JP2_DELEGATE 1
/* Define if you have Ghostscript library */
#undef MAGICKCORE_GS_DELEGATE
/* Define if you have FreeType (TrueType font) library */
#define MAGICKCORE_FREETYPE_DELEGATE 1
/* Define if you have TIFF library */
#define MAGICKCORE_TIFF_DELEGATE 1
/* Define if you have HDF4 library */
#define MAGICKCORE_HDF_DELEGATE 1
/* Define if you have JBIG library */
#define MAGICKCORE_JBIG_DELEGATE 1
/* Define if you have XML library */
#undef MAGICKCORE_XML_DELEGATE
/* Define if you have WMF library */
#undef MAGICKCORE_WMF_DELEGATE
/* Define if you have sys_errlist in libc */
#undef MAGICKCORE_HAVE_SYS_ERRLIST
/* Define directory where ImageMagick/delegates.xml lives. */
#undef MAGICKCORE_MagickConfigurePath
/* define MAGICKCORE_if bool is a built-in type */
#define MAGICKCORE_HAVE_BOOL 1
/* define MAGICKCORE_if the compiler supports const_cast<> */
#undef MAGICKCORE_HAVE_CONST_CAST
/* define MAGICKCORE_if the compiler supports default template parameters */
#undef MAGICKCORE_HAVE_DEFAULT_TEMPLATE_PARAMETERS
/* define MAGICKCORE_if the compiler supports exceptions */
#undef MAGICKCORE_HAVE_EXCEPTIONS
/* define MAGICKCORE_if the compiler implements namespaces */
#undef MAGICKCORE_HAVE_NAMESPACES
/* define MAGICKCORE_if the compiler supports the explicit keyword */
#undef MAGICKCORE_HAVE_EXPLICIT
/* define MAGICKCORE_if the compiler supports ISO C++ standard library */
#define MAGICKCORE_HAVE_STD 1
/* define MAGICKCORE_if the compiler supports Standard Template Library */
#define MAGICKCORE_HAVE_STL 1
/* define MAGICKCORE_if the compiler supports the mutable keyword */
#undef MAGICKCORE_HAVE_MUTABLE
/* define MAGICKCORE_if the compiler accepts the new for scoping rules */
#undef MAGICKCORE_HAVE_NEW_FOR_SCOPING
/* define MAGICKCORE_if the compiler supports static_cast<> */
#undef MAGICKCORE_HAVE_STATIC_CAST
/* define MAGICKCORE_if the compiler supports basic templates */
#undef MAGICKCORE_HAVE_TEMPLATES
#define MAGICKCORE_LIBRARY_RELATIVE_PATH "/"
#define MAGICKCORE_HAVE_MKSTEMP 1
#define round nint
#define MAGICKCORE_CIPHER_SUPPORT 1

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,73 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore configure methods.
*/
#ifndef _MAGICKCORE_CONFIGURE_H
#define _MAGICKCORE_CONFIGURE_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#include "magick/hashmap.h"
typedef struct _ConfigureInfo
{
char
*path,
*name,
*value;
MagickBooleanType
exempt,
stealth;
struct _ConfigureInfo
*previous,
*next; /* deprecated, use GetConfigureInfoList() */
size_t
signature;
} ConfigureInfo;
extern MagickExport char
**GetConfigureList(const char *,size_t *,ExceptionInfo *),
*GetConfigureOption(const char *);
extern MagickExport const char
*GetConfigureValue(const ConfigureInfo *);
extern MagickExport const ConfigureInfo
*GetConfigureInfo(const char *,ExceptionInfo *),
**GetConfigureInfoList(const char *,size_t *,ExceptionInfo *);
extern MagickExport LinkedListInfo
*DestroyConfigureOptions(LinkedListInfo *),
*GetConfigurePaths(const char *,ExceptionInfo *),
*GetConfigureOptions(const char *,ExceptionInfo *);
extern MagickExport MagickBooleanType
ConfigureComponentGenesis(void),
ListConfigureInfo(FILE *,ExceptionInfo *);
extern MagickExport void
ConfigureComponentTerminus(void);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,58 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore image constitute methods.
*/
#ifndef _MAGICKCORE_CONSTITUTE_H
#define _MAGICKCORE_CONSTITUTE_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
typedef enum
{
UndefinedPixel,
CharPixel,
DoublePixel,
FloatPixel,
IntegerPixel,
LongPixel,
QuantumPixel,
ShortPixel
} StorageType;
extern MagickExport Image
*ConstituteImage(const size_t,const size_t,const char *,const StorageType,
const void *,ExceptionInfo *),
*PingImage(const ImageInfo *,ExceptionInfo *),
*PingImages(const ImageInfo *,ExceptionInfo *),
*ReadImage(const ImageInfo *,ExceptionInfo *),
*ReadImages(const ImageInfo *,ExceptionInfo *),
*ReadInlineImage(const ImageInfo *,const char *,ExceptionInfo *);
extern MagickExport MagickBooleanType
ConstituteComponentGenesis(void),
WriteImage(const ImageInfo *,Image *),
WriteImages(const ImageInfo *,Image *,const char *,ExceptionInfo *);
extern MagickExport void
ConstituteComponentTerminus(void);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

View file

@ -0,0 +1,952 @@
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% DDDD EEEEE CCCC OOO RRRR AAA TTTTT EEEEE %
% D D E C O O R R A A T E %
% D D EEE C O O RRRR AAAAA T EEE %
% D D E C O O R R A A T E %
% DDDD EEEEE CCCC OOO R R A A T EEEEE %
% %
% %
% MagickCore Image Decoration Methods %
% %
% Software Design %
% John Cristy %
% July 1992 %
% %
% %
% Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization %
% dedicated to making software imaging solutions freely available. %
% %
% You may not use this file except in compliance with the License. You may %
% obtain a copy of the License at %
% %
% http://www.imagemagick.org/script/license.php %
% %
% Unless required by applicable law or agreed to in writing, software %
% distributed under the License is distributed on an "AS IS" BASIS, %
% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
% See the License for the specific language governing permissions and %
% limitations under the License. %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
%
*/
/*
Include declarations.
*/
#include "magick/studio.h"
#include "magick/cache-view.h"
#include "magick/channel.h"
#include "magick/color-private.h"
#include "magick/colorspace-private.h"
#include "magick/composite.h"
#include "magick/decorate.h"
#include "magick/exception.h"
#include "magick/exception-private.h"
#include "magick/image.h"
#include "magick/memory_.h"
#include "magick/monitor.h"
#include "magick/monitor-private.h"
#include "magick/pixel-accessor.h"
#include "magick/pixel-private.h"
#include "magick/quantum.h"
#include "magick/resource_.h"
#include "magick/thread-private.h"
#include "magick/transform.h"
/*
Define declarations.
*/
#define AccentuateModulate ScaleCharToQuantum(80)
#define HighlightModulate ScaleCharToQuantum(125)
#define ShadowModulate ScaleCharToQuantum(135)
#define DepthModulate ScaleCharToQuantum(185)
#define TroughModulate ScaleCharToQuantum(110)
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% B o r d e r I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% BorderImage() surrounds the image with a border of the color defined by
% the bordercolor member of the image structure. The width and height
% of the border are defined by the corresponding members of the border_info
% structure.
%
% The format of the BorderImage method is:
%
% Image *BorderImage(const Image *image,const RectangleInfo *border_info,
% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o image: the image.
%
% o border_info: Define the width and height of the border.
%
% o exception: return any errors or warnings in this structure.
%
*/
MagickExport Image *BorderImage(const Image *image,
const RectangleInfo *border_info,ExceptionInfo *exception)
{
Image
*border_image,
*clone_image;
FrameInfo
frame_info;
assert(image != (const Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(border_info != (RectangleInfo *) NULL);
frame_info.width=image->columns+(border_info->width << 1);
frame_info.height=image->rows+(border_info->height << 1);
frame_info.x=(ssize_t) border_info->width;
frame_info.y=(ssize_t) border_info->height;
frame_info.inner_bevel=0;
frame_info.outer_bevel=0;
clone_image=CloneImage(image,0,0,MagickTrue,exception);
if (clone_image == (Image *) NULL)
return((Image *) NULL);
clone_image->matte_color=image->border_color;
border_image=FrameImage(clone_image,&frame_info,exception);
clone_image=DestroyImage(clone_image);
if (border_image != (Image *) NULL)
border_image->matte_color=image->matte_color;
return(border_image);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% F r a m e I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% FrameImage() adds a simulated three-dimensional border around the image.
% The color of the border is defined by the matte_color member of image.
% Members width and height of frame_info specify the border width of the
% vertical and horizontal sides of the frame. Members inner and outer
% indicate the width of the inner and outer shadows of the frame.
%
% The format of the FrameImage method is:
%
% Image *FrameImage(const Image *image,const FrameInfo *frame_info,
% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o image: the image.
%
% o frame_info: Define the width and height of the frame and its bevels.
%
% o exception: return any errors or warnings in this structure.
%
*/
MagickExport Image *FrameImage(const Image *image,const FrameInfo *frame_info,
ExceptionInfo *exception)
{
#define FrameImageTag "Frame/Image"
CacheView
*image_view,
*frame_view;
Image
*frame_image;
MagickBooleanType
status;
MagickOffsetType
progress;
MagickPixelPacket
accentuate,
border,
highlight,
interior,
matte,
shadow,
trough;
register ssize_t
x;
size_t
bevel_width,
height,
width;
ssize_t
y;
/*
Check frame geometry.
*/
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(frame_info != (FrameInfo *) NULL);
if ((frame_info->outer_bevel < 0) || (frame_info->inner_bevel < 0))
ThrowImageException(OptionError,"FrameIsLessThanImageSize");
bevel_width=(size_t) (frame_info->outer_bevel+frame_info->inner_bevel);
width=frame_info->width-frame_info->x-bevel_width;
height=frame_info->height-frame_info->y-bevel_width;
if ((width < image->columns) || (height < image->rows))
ThrowImageException(OptionError,"FrameIsLessThanImageSize");
/*
Initialize framed image attributes.
*/
frame_image=CloneImage(image,frame_info->width,frame_info->height,MagickTrue,
exception);
if (frame_image == (Image *) NULL)
return((Image *) NULL);
if (SetImageStorageClass(frame_image,DirectClass) == MagickFalse)
{
InheritException(exception,&frame_image->exception);
frame_image=DestroyImage(frame_image);
return((Image *) NULL);
}
if ((IsPixelGray(&frame_image->border_color) == MagickFalse) &&
(IsGrayColorspace(frame_image->colorspace) != MagickFalse))
(void) SetImageColorspace(frame_image,RGBColorspace);
if ((frame_image->border_color.opacity != OpaqueOpacity) &&
(frame_image->matte == MagickFalse))
(void) SetImageAlphaChannel(frame_image,OpaqueAlphaChannel);
frame_image->page=image->page;
if ((image->page.width != 0) && (image->page.height != 0))
{
frame_image->page.width+=frame_image->columns-image->columns;
frame_image->page.height+=frame_image->rows-image->rows;
}
/*
Initialize 3D effects color.
*/
GetMagickPixelPacket(frame_image,&interior);
SetMagickPixelPacket(frame_image,&image->border_color,(IndexPacket *) NULL,
&interior);
GetMagickPixelPacket(frame_image,&matte);
matte.colorspace=sRGBColorspace;
SetMagickPixelPacket(frame_image,&image->matte_color,(IndexPacket *) NULL,
&matte);
GetMagickPixelPacket(frame_image,&border);
border.colorspace=sRGBColorspace;
SetMagickPixelPacket(frame_image,&image->border_color,(IndexPacket *) NULL,
&border);
GetMagickPixelPacket(frame_image,&accentuate);
accentuate.red=(MagickRealType) (QuantumScale*((QuantumRange-
AccentuateModulate)*matte.red+(QuantumRange*AccentuateModulate)));
accentuate.green=(MagickRealType) (QuantumScale*((QuantumRange-
AccentuateModulate)*matte.green+(QuantumRange*AccentuateModulate)));
accentuate.blue=(MagickRealType) (QuantumScale*((QuantumRange-
AccentuateModulate)*matte.blue+(QuantumRange*AccentuateModulate)));
accentuate.opacity=matte.opacity;
GetMagickPixelPacket(frame_image,&highlight);
highlight.red=(MagickRealType) (QuantumScale*((QuantumRange-
HighlightModulate)*matte.red+(QuantumRange*HighlightModulate)));
highlight.green=(MagickRealType) (QuantumScale*((QuantumRange-
HighlightModulate)*matte.green+(QuantumRange*HighlightModulate)));
highlight.blue=(MagickRealType) (QuantumScale*((QuantumRange-
HighlightModulate)*matte.blue+(QuantumRange*HighlightModulate)));
highlight.opacity=matte.opacity;
GetMagickPixelPacket(frame_image,&shadow);
shadow.red=QuantumScale*matte.red*ShadowModulate;
shadow.green=QuantumScale*matte.green*ShadowModulate;
shadow.blue=QuantumScale*matte.blue*ShadowModulate;
shadow.opacity=matte.opacity;
GetMagickPixelPacket(frame_image,&trough);
trough.red=QuantumScale*matte.red*TroughModulate;
trough.green=QuantumScale*matte.green*TroughModulate;
trough.blue=QuantumScale*matte.blue*TroughModulate;
trough.opacity=matte.opacity;
if (image->colorspace == CMYKColorspace)
{
ConvertRGBToCMYK(&interior);
ConvertRGBToCMYK(&matte);
ConvertRGBToCMYK(&border);
ConvertRGBToCMYK(&accentuate);
ConvertRGBToCMYK(&highlight);
ConvertRGBToCMYK(&shadow);
ConvertRGBToCMYK(&trough);
}
status=MagickTrue;
progress=0;
image_view=AcquireVirtualCacheView(image,exception);
frame_view=AcquireAuthenticCacheView(frame_image,exception);
height=(size_t) (frame_info->outer_bevel+(frame_info->y-bevel_width)+
frame_info->inner_bevel);
if (height != 0)
{
register IndexPacket
*restrict frame_indexes;
register ssize_t
x;
register PixelPacket
*restrict q;
/*
Draw top of ornamental border.
*/
q=QueueCacheViewAuthenticPixels(frame_view,0,0,frame_image->columns,
height,exception);
frame_indexes=GetCacheViewAuthenticIndexQueue(frame_view);
if (q != (PixelPacket *) NULL)
{
/*
Draw top of ornamental border.
*/
for (y=0; y < (ssize_t) frame_info->outer_bevel; y++)
{
for (x=0; x < (ssize_t) (frame_image->columns-y); x++)
{
if (x < y)
SetPixelPacket(frame_image,&highlight,q,frame_indexes);
else
SetPixelPacket(frame_image,&accentuate,q,frame_indexes);
q++;
frame_indexes++;
}
for ( ; x < (ssize_t) frame_image->columns; x++)
{
SetPixelPacket(frame_image,&shadow,q,frame_indexes);
q++;
frame_indexes++;
}
}
for (y=0; y < (ssize_t) (frame_info->y-bevel_width); y++)
{
for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
{
SetPixelPacket(frame_image,&highlight,q,frame_indexes);
q++;
frame_indexes++;
}
width=frame_image->columns-2*frame_info->outer_bevel;
for (x=0; x < (ssize_t) width; x++)
{
SetPixelPacket(frame_image,&matte,q,frame_indexes);
q++;
frame_indexes++;
}
for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
{
SetPixelPacket(frame_image,&shadow,q,frame_indexes);
q++;
frame_indexes++;
}
}
for (y=0; y < (ssize_t) frame_info->inner_bevel; y++)
{
for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
{
SetPixelPacket(frame_image,&highlight,q,frame_indexes);
q++;
frame_indexes++;
}
for (x=0; x < (ssize_t) (frame_info->x-bevel_width); x++)
{
SetPixelPacket(frame_image,&matte,q,frame_indexes);
q++;
frame_indexes++;
}
width=image->columns+((size_t) frame_info->inner_bevel << 1)-
y;
for (x=0; x < (ssize_t) width; x++)
{
if (x < y)
SetPixelPacket(frame_image,&shadow,q,frame_indexes);
else
SetPixelPacket(frame_image,&trough,q,frame_indexes);
q++;
frame_indexes++;
}
for ( ; x < (ssize_t) (image->columns+2*frame_info->inner_bevel); x++)
{
SetPixelPacket(frame_image,&highlight,q,frame_indexes);
q++;
frame_indexes++;
}
width=frame_info->width-frame_info->x-image->columns-bevel_width;
for (x=0; x < (ssize_t) width; x++)
{
SetPixelPacket(frame_image,&matte,q,frame_indexes);
q++;
frame_indexes++;
}
for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
{
SetPixelPacket(frame_image,&shadow,q,frame_indexes);
q++;
frame_indexes++;
}
}
(void) SyncCacheViewAuthenticPixels(frame_view,exception);
}
}
/*
Draw sides of ornamental border.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(status) \
magick_threads(image,frame_image,1,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
register IndexPacket
*restrict frame_indexes;
register ssize_t
x;
register PixelPacket
*restrict q;
/*
Initialize scanline with matte color.
*/
if (status == MagickFalse)
continue;
q=QueueCacheViewAuthenticPixels(frame_view,0,frame_info->y+y,
frame_image->columns,1,exception);
if (q == (PixelPacket *) NULL)
{
status=MagickFalse;
continue;
}
frame_indexes=GetCacheViewAuthenticIndexQueue(frame_view);
for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
{
SetPixelPacket(frame_image,&highlight,q,frame_indexes);
q++;
frame_indexes++;
}
for (x=0; x < (ssize_t) (frame_info->x-bevel_width); x++)
{
SetPixelPacket(frame_image,&matte,q,frame_indexes);
q++;
frame_indexes++;
}
for (x=0; x < (ssize_t) frame_info->inner_bevel; x++)
{
SetPixelPacket(frame_image,&shadow,q,frame_indexes);
q++;
frame_indexes++;
}
/*
Set frame interior to interior color.
*/
if ((image->compose != CopyCompositeOp) &&
((image->compose != OverCompositeOp) || (image->matte != MagickFalse)))
for (x=0; x < (ssize_t) image->columns; x++)
{
SetPixelPacket(frame_image,&interior,q,frame_indexes);
q++;
frame_indexes++;
}
else
{
register const IndexPacket
*indexes;
register const PixelPacket
*p;
p=GetCacheViewVirtualPixels(image_view,0,y,image->columns,1,exception);
if (p == (const PixelPacket *) NULL)
{
status=MagickFalse;
continue;
}
indexes=GetCacheViewVirtualIndexQueue(image_view);
(void) CopyMagickMemory(q,p,image->columns*sizeof(*p));
if ((image->colorspace == CMYKColorspace) &&
(frame_image->colorspace == CMYKColorspace))
{
(void) CopyMagickMemory(frame_indexes,indexes,image->columns*
sizeof(*indexes));
frame_indexes+=image->columns;
}
q+=image->columns;
}
for (x=0; x < (ssize_t) frame_info->inner_bevel; x++)
{
SetPixelPacket(frame_image,&highlight,q,frame_indexes);
q++;
frame_indexes++;
}
width=frame_info->width-frame_info->x-image->columns-bevel_width;
for (x=0; x < (ssize_t) width; x++)
{
SetPixelPacket(frame_image,&matte,q,frame_indexes);
q++;
frame_indexes++;
}
for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
{
SetPixelPacket(frame_image,&shadow,q,frame_indexes);
q++;
frame_indexes++;
}
if (SyncCacheViewAuthenticPixels(frame_view,exception) == MagickFalse)
status=MagickFalse;
if (image->progress_monitor != (MagickProgressMonitor) NULL)
{
MagickBooleanType
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp critical (MagickCore_FrameImage)
#endif
proceed=SetImageProgress(image,FrameImageTag,progress++,image->rows);
if (proceed == MagickFalse)
status=MagickFalse;
}
}
height=(size_t) (frame_info->inner_bevel+frame_info->height-
frame_info->y-image->rows-bevel_width+frame_info->outer_bevel);
if (height != 0)
{
register IndexPacket
*restrict frame_indexes;
register ssize_t
x;
register PixelPacket
*restrict q;
/*
Draw bottom of ornamental border.
*/
q=QueueCacheViewAuthenticPixels(frame_view,0,(ssize_t) (frame_image->rows-
height),frame_image->columns,height,exception);
if (q != (PixelPacket *) NULL)
{
/*
Draw bottom of ornamental border.
*/
frame_indexes=GetCacheViewAuthenticIndexQueue(frame_view);
for (y=frame_info->inner_bevel-1; y >= 0; y--)
{
for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
{
SetPixelPacket(frame_image,&highlight,q,frame_indexes);
q++;
frame_indexes++;
}
for (x=0; x < (ssize_t) (frame_info->x-bevel_width); x++)
{
SetPixelPacket(frame_image,&matte,q,frame_indexes);
q++;
frame_indexes++;
}
for (x=0; x < y; x++)
{
SetPixelPacket(frame_image,&shadow,q,frame_indexes);
q++;
frame_indexes++;
}
for ( ; x < (ssize_t) (image->columns+2*frame_info->inner_bevel); x++)
{
if (x >= (ssize_t) (image->columns+2*frame_info->inner_bevel-y))
SetPixelPacket(frame_image,&highlight,q,frame_indexes);
else
SetPixelPacket(frame_image,&accentuate,q,frame_indexes);
q++;
frame_indexes++;
}
width=frame_info->width-frame_info->x-image->columns-bevel_width;
for (x=0; x < (ssize_t) width; x++)
{
SetPixelPacket(frame_image,&matte,q,frame_indexes);
q++;
frame_indexes++;
}
for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
{
SetPixelPacket(frame_image,&shadow,q,frame_indexes);
q++;
frame_indexes++;
}
}
height=frame_info->height-frame_info->y-image->rows-bevel_width;
for (y=0; y < (ssize_t) height; y++)
{
for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
{
SetPixelPacket(frame_image,&highlight,q,frame_indexes);
q++;
frame_indexes++;
}
width=frame_image->columns-2*frame_info->outer_bevel;
for (x=0; x < (ssize_t) width; x++)
{
SetPixelPacket(frame_image,&matte,q,frame_indexes);
q++;
frame_indexes++;
}
for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
{
SetPixelPacket(frame_image,&shadow,q,frame_indexes);
q++;
frame_indexes++;
}
}
for (y=frame_info->outer_bevel-1; y >= 0; y--)
{
for (x=0; x < y; x++)
{
SetPixelPacket(frame_image,&highlight,q,frame_indexes);
q++;
frame_indexes++;
}
for ( ; x < (ssize_t) frame_image->columns; x++)
{
if (x >= (ssize_t) (frame_image->columns-y))
SetPixelPacket(frame_image,&shadow,q,frame_indexes);
else
SetPixelPacket(frame_image,&trough,q,frame_indexes);
q++;
frame_indexes++;
}
}
(void) SyncCacheViewAuthenticPixels(frame_view,exception);
}
}
frame_view=DestroyCacheView(frame_view);
image_view=DestroyCacheView(image_view);
if ((image->compose != CopyCompositeOp) &&
((image->compose != OverCompositeOp) || (image->matte != MagickFalse)))
{
x=(ssize_t) (frame_info->outer_bevel+(frame_info->x-bevel_width)+
frame_info->inner_bevel);
y=(ssize_t) (frame_info->outer_bevel+(frame_info->y-bevel_width)+
frame_info->inner_bevel);
(void) CompositeImage(frame_image,image->compose,image,x,y);
}
if (status == MagickFalse)
frame_image=DestroyImage(frame_image);
return(frame_image);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% R a i s e I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% RaiseImage() creates a simulated three-dimensional button-like effect
% by lightening and darkening the edges of the image. Members width and
% height of raise_info define the width of the vertical and horizontal
% edge of the effect.
%
% The format of the RaiseImage method is:
%
% MagickBooleanType RaiseImage(const Image *image,
% const RectangleInfo *raise_info,const MagickBooleanType raise)
%
% A description of each parameter follows:
%
% o image: the image.
%
% o raise_info: Define the width and height of the raise area.
%
% o raise: A value other than zero creates a 3-D raise effect,
% otherwise it has a lowered effect.
%
*/
MagickExport MagickBooleanType RaiseImage(Image *image,
const RectangleInfo *raise_info,const MagickBooleanType raise)
{
#define AccentuateFactor ScaleCharToQuantum(135)
#define HighlightFactor ScaleCharToQuantum(190)
#define ShadowFactor ScaleCharToQuantum(190)
#define RaiseImageTag "Raise/Image"
#define TroughFactor ScaleCharToQuantum(135)
CacheView
*image_view;
ExceptionInfo
*exception;
MagickBooleanType
status;
MagickOffsetType
progress;
Quantum
foreground,
background;
ssize_t
y;
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(raise_info != (RectangleInfo *) NULL);
if ((image->columns <= (raise_info->width << 1)) ||
(image->rows <= (raise_info->height << 1)))
ThrowBinaryException(OptionError,"ImageSizeMustExceedBevelWidth",
image->filename);
foreground=QuantumRange;
background=(Quantum) 0;
if (raise == MagickFalse)
{
foreground=(Quantum) 0;
background=QuantumRange;
}
if (SetImageStorageClass(image,DirectClass) == MagickFalse)
return(MagickFalse);
/*
Raise image.
*/
status=MagickTrue;
progress=0;
exception=(&image->exception);
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(status) \
magick_threads(image,image,1,1)
#endif
for (y=0; y < (ssize_t) raise_info->height; y++)
{
register ssize_t
x;
register PixelPacket
*restrict q;
if (status == MagickFalse)
continue;
q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
{
status=MagickFalse;
continue;
}
for (x=0; x < y; x++)
{
SetPixelRed(q,ClampToQuantum(QuantumScale*((MagickRealType)
GetPixelRed(q)*HighlightFactor+(MagickRealType) foreground*
(QuantumRange-HighlightFactor))));
SetPixelGreen(q,ClampToQuantum(QuantumScale*((MagickRealType)
GetPixelGreen(q)*HighlightFactor+(MagickRealType) foreground*
(QuantumRange-HighlightFactor))));
SetPixelBlue(q,ClampToQuantum(QuantumScale*((MagickRealType)
GetPixelBlue(q)*HighlightFactor+(MagickRealType) foreground*
(QuantumRange-HighlightFactor))));
q++;
}
for ( ; x < (ssize_t) (image->columns-y); x++)
{
SetPixelRed(q,ClampToQuantum(QuantumScale*((MagickRealType)
GetPixelRed(q)*AccentuateFactor+(MagickRealType) foreground*
(QuantumRange-AccentuateFactor))));
SetPixelGreen(q,ClampToQuantum(QuantumScale*((MagickRealType)
GetPixelGreen(q)*AccentuateFactor+(MagickRealType) foreground*
(QuantumRange-AccentuateFactor))));
SetPixelBlue(q,ClampToQuantum(QuantumScale*((MagickRealType)
GetPixelBlue(q)*AccentuateFactor+(MagickRealType) foreground*
(QuantumRange-AccentuateFactor))));
q++;
}
for ( ; x < (ssize_t) image->columns; x++)
{
SetPixelRed(q,ClampToQuantum(QuantumScale*((MagickRealType)
GetPixelRed(q)*ShadowFactor+(MagickRealType) background*
(QuantumRange-ShadowFactor))));
SetPixelGreen(q,ClampToQuantum(QuantumScale*((MagickRealType)
GetPixelGreen(q)*ShadowFactor+(MagickRealType) background*
(QuantumRange-ShadowFactor))));
SetPixelBlue(q,ClampToQuantum(QuantumScale*((MagickRealType)
GetPixelBlue(q)*ShadowFactor+(MagickRealType) background*
(QuantumRange-ShadowFactor))));
q++;
}
if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
status=MagickFalse;
if (image->progress_monitor != (MagickProgressMonitor) NULL)
{
MagickBooleanType
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp critical (MagickCore_RaiseImage)
#endif
proceed=SetImageProgress(image,RaiseImageTag,progress++,image->rows);
if (proceed == MagickFalse)
status=MagickFalse;
}
}
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(status) \
magick_threads(image,image,1,1)
#endif
for (y=(ssize_t) raise_info->height; y < (ssize_t) (image->rows-raise_info->height); y++)
{
register ssize_t
x;
register PixelPacket
*restrict q;
if (status == MagickFalse)
continue;
q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
{
status=MagickFalse;
continue;
}
for (x=0; x < (ssize_t) raise_info->width; x++)
{
SetPixelRed(q,ClampToQuantum(QuantumScale*((MagickRealType)
GetPixelRed(q)*HighlightFactor+(MagickRealType) foreground*
(QuantumRange-HighlightFactor))));
SetPixelGreen(q,ClampToQuantum(QuantumScale*((MagickRealType)
GetPixelGreen(q)*HighlightFactor+(MagickRealType) foreground*
(QuantumRange-HighlightFactor))));
SetPixelBlue(q,ClampToQuantum(QuantumScale*((MagickRealType)
GetPixelBlue(q)*HighlightFactor+(MagickRealType) foreground*
(QuantumRange-HighlightFactor))));
q++;
}
for ( ; x < (ssize_t) (image->columns-raise_info->width); x++)
q++;
for ( ; x < (ssize_t) image->columns; x++)
{
SetPixelRed(q,ClampToQuantum(QuantumScale*((MagickRealType)
GetPixelRed(q)*ShadowFactor+(MagickRealType) background*
(QuantumRange-ShadowFactor))));
SetPixelGreen(q,ClampToQuantum(QuantumScale*((MagickRealType)
GetPixelGreen(q)*ShadowFactor+(MagickRealType) background*
(QuantumRange-ShadowFactor))));
SetPixelBlue(q,ClampToQuantum(QuantumScale*((MagickRealType)
GetPixelBlue(q)*ShadowFactor+(MagickRealType) background*
(QuantumRange-ShadowFactor))));
q++;
}
if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
status=MagickFalse;
if (image->progress_monitor != (MagickProgressMonitor) NULL)
{
MagickBooleanType
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp critical (MagickCore_RaiseImage)
#endif
proceed=SetImageProgress(image,RaiseImageTag,progress++,image->rows);
if (proceed == MagickFalse)
status=MagickFalse;
}
}
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(status) \
magick_threads(image,image,1,1)
#endif
for (y=(ssize_t) (image->rows-raise_info->height); y < (ssize_t) image->rows; y++)
{
register ssize_t
x;
register PixelPacket
*restrict q;
if (status == MagickFalse)
continue;
q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
{
status=MagickFalse;
continue;
}
for (x=0; x < (ssize_t) (image->rows-y); x++)
{
SetPixelRed(q,ClampToQuantum(QuantumScale*((MagickRealType)
GetPixelRed(q)*HighlightFactor+(MagickRealType) foreground*
(QuantumRange-HighlightFactor))));
SetPixelGreen(q,ClampToQuantum(QuantumScale*((MagickRealType)
GetPixelGreen(q)*HighlightFactor+(MagickRealType) foreground*
(QuantumRange-HighlightFactor))));
SetPixelBlue(q,ClampToQuantum(QuantumScale*((MagickRealType)
GetPixelBlue(q)*HighlightFactor+(MagickRealType) foreground*
(QuantumRange-HighlightFactor))));
q++;
}
for ( ; x < (ssize_t) (image->columns-(image->rows-y)); x++)
{
SetPixelRed(q,ClampToQuantum(QuantumScale*((MagickRealType)
GetPixelRed(q)*TroughFactor+(MagickRealType) background*
(QuantumRange-TroughFactor))));
SetPixelGreen(q,ClampToQuantum(QuantumScale*((MagickRealType)
GetPixelGreen(q)*TroughFactor+(MagickRealType) background*
(QuantumRange-TroughFactor))));
SetPixelBlue(q,ClampToQuantum(QuantumScale*((MagickRealType)
GetPixelBlue(q)*TroughFactor+(MagickRealType) background*
(QuantumRange-TroughFactor))));
q++;
}
for ( ; x < (ssize_t) image->columns; x++)
{
SetPixelRed(q,ClampToQuantum(QuantumScale*((MagickRealType)
GetPixelRed(q)*ShadowFactor+(MagickRealType) background*
(QuantumRange-ShadowFactor))));
SetPixelGreen(q,ClampToQuantum(QuantumScale*((MagickRealType)
GetPixelGreen(q)*ShadowFactor+(MagickRealType) background*
(QuantumRange-ShadowFactor))));
SetPixelBlue(q,ClampToQuantum(QuantumScale*((MagickRealType)
GetPixelBlue(q)*ShadowFactor+(MagickRealType) background*
(QuantumRange-ShadowFactor))));
q++;
}
if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
status=MagickFalse;
if (image->progress_monitor != (MagickProgressMonitor) NULL)
{
MagickBooleanType
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp critical (MagickCore_RaiseImage)
#endif
proceed=SetImageProgress(image,RaiseImageTag,progress++,image->rows);
if (proceed == MagickFalse)
status=MagickFalse;
}
}
image_view=DestroyCacheView(image_view);
return(status);
}

View file

@ -0,0 +1,49 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore image decorate methods.
*/
#ifndef _MAGICKCORE_DECORATE_H
#define _MAGICKCORE_DECORATE_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
typedef struct _FrameInfo
{
size_t
width,
height;
ssize_t
x,
y,
inner_bevel,
outer_bevel;
} FrameInfo;
extern MagickExport Image
*BorderImage(const Image *,const RectangleInfo *,ExceptionInfo *),
*FrameImage(const Image *,const FrameInfo *,ExceptionInfo *);
extern MagickExport MagickBooleanType
RaiseImage(Image *,const RectangleInfo *,const MagickBooleanType);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

View file

@ -0,0 +1,66 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore delegates private methods.
*/
#ifndef _MAGICKCORE_DELEGATE_PRIVATE_H
#define _MAGICKCORE_DELEGATE_PRIVATE_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#if defined(MAGICKCORE_GS_DELEGATE)
#include "ghostscript/iapi.h"
#include "ghostscript/ierrors.h"
#endif
#ifndef gs_main_instance_DEFINED
# define gs_main_instance_DEFINED
typedef struct gs_main_instance_s
gs_main_instance;
#endif
#if !defined(MagickDLLCall)
# if defined(MAGICKCORE_WINDOWS_SUPPORT)
# define MagickDLLCall __stdcall
# else
# define MagickDLLCall
# endif
#endif
typedef struct _GhostInfo
{
int
(MagickDLLCall *exit)(gs_main_instance *);
int
(MagickDLLCall *init_with_args)(gs_main_instance *,int,char **);
int
(MagickDLLCall *new_instance)(gs_main_instance **,void *);
int
(MagickDLLCall *run_string)(gs_main_instance *,const char *,int,int *);
void
(MagickDLLCall *delete_instance)(gs_main_instance *);
} GhostInfo;
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,77 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore delegates methods.
*/
#ifndef _MAGICKCORE_DELEGATE_H
#define _MAGICKCORE_DELEGATE_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
typedef struct _DelegateInfo
{
char
*path,
*decode,
*encode,
*commands;
ssize_t
mode;
MagickBooleanType
thread_support,
spawn,
stealth;
struct _DelegateInfo
*previous,
*next; /* deprecated, use GetDelegateInfoList() */
size_t
signature;
} DelegateInfo;
extern MagickExport char
*GetDelegateCommand(const ImageInfo *,Image *,const char *,const char *,
ExceptionInfo *),
**GetDelegateList(const char *,size_t *,ExceptionInfo *);
extern MagickExport const char
*GetDelegateCommands(const DelegateInfo *);
extern MagickExport const DelegateInfo
*GetDelegateInfo(const char *,const char *,ExceptionInfo *exception),
**GetDelegateInfoList(const char *,size_t *,ExceptionInfo *);
extern MagickExport ssize_t
GetDelegateMode(const DelegateInfo *);
extern MagickExport MagickBooleanType
DelegateComponentGenesis(void),
GetDelegateThreadSupport(const DelegateInfo *),
InvokeDelegate(ImageInfo *,Image *,const char *,const char *,ExceptionInfo *),
ListDelegateInfo(FILE *,ExceptionInfo *);
extern MagickExport void
DelegateComponentTerminus(void);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,367 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore deprecated methods.
*/
#ifndef _MAGICKCORE_DEPRECATE_H
#define _MAGICKCORE_DEPRECATE_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED)
#include <stdarg.h>
#include "magick/blob.h"
#include "magick/cache-view.h"
#include "magick/draw.h"
#include "magick/constitute.h"
#include "magick/magick-config.h"
#include "magick/pixel.h"
#include "magick/quantize.h"
#include "magick/quantum.h"
#include "magick/registry.h"
#include "magick/semaphore.h"
#if !defined(magick_attribute)
# if !defined(__GNUC__)
# define magick_attribute(x) /*nothing*/
# else
# define magick_attribute __attribute__
# endif
#endif
#define Downscale(quantum) ScaleQuantumToChar(quantum)
#define LABColorspace LabColorspace
#define CompressPixelGamma(pixel) DecodePixelGamma(pixel)
#define DecodesRGBGamma(pixel) DecodePixelGamma(pixel)
#define EncodesRGBGamma(pixel) EncodePixelGamma(pixel)
#define ExpandPixelGamma(pixel) EncodePixelGamma(pixel)
#define Intensity(color) PixelIntensityToQuantum(color)
#define LiberateUniqueFileResource(resource) \
RelinquishUniqueFileResource(resource)
#define LiberateMagickResource(resource) RelinquishMagickResource(resource)
#define LiberateSemaphore(semaphore) RelinquishSemaphore(semaphore)
#define QuantumDepth MAGICKCORE_QUANTUM_DEPTH
#define MaxRGB QuantumRange /* deprecated */
#define RunlengthEncodedCompression RLECompression
#define Upscale(value) ScaleCharToQuantum(value)
#define XDownscale(value) ScaleShortToQuantum(value)
#define XUpscale(quantum) ScaleQuantumToShort(quantum)
typedef enum
{
UndefinedMagickLayerMethod
} MagickLayerMethod;
typedef MagickOffsetType ExtendedSignedIntegralType;
typedef MagickSizeType ExtendedUnsignedIntegralType;
typedef MagickRealType ExtendedRationalType;
typedef struct _ViewInfo ViewInfo;
typedef MagickBooleanType
(*MonitorHandler)(const char *,const MagickOffsetType,const MagickSizeType,
ExceptionInfo *);
typedef struct _ImageAttribute
{
char
*key,
*value;
MagickBooleanType
compression;
struct _ImageAttribute
*previous,
*next; /* deprecated */
} ImageAttribute;
extern MagickExport CacheView
*CloseCacheView(CacheView *) magick_attribute((deprecated)),
*OpenCacheView(const Image *) magick_attribute((deprecated));
extern MagickExport char
*AllocateString(const char *) magick_attribute((deprecated)),
*InterpretImageAttributes(const ImageInfo *,Image *,const char *)
magick_attribute((deprecated)),
*PostscriptGeometry(const char *) magick_attribute((deprecated)),
*TranslateText(const ImageInfo *,Image *,const char *)
magick_attribute((deprecated));
extern MagickExport const ImageAttribute
*GetImageAttribute(const Image *,const char *),
*GetImageClippingPathAttribute(Image *) magick_attribute((deprecated)),
*GetNextImageAttribute(const Image *) magick_attribute((deprecated));
extern MagickExport const IndexPacket
*AcquireCacheViewIndexes(const CacheView *) magick_attribute((deprecated)),
*AcquireIndexes(const Image *) magick_attribute((deprecated));
extern MagickExport const PixelPacket
*AcquirePixels(const Image *) magick_attribute((deprecated)),
*AcquireCacheViewPixels(const CacheView *,const ssize_t,const ssize_t,
const size_t,const size_t,ExceptionInfo *)
magick_attribute((deprecated)),
*AcquireImagePixels(const Image *,const ssize_t,const ssize_t,const size_t,
const size_t,ExceptionInfo *) magick_attribute((deprecated));
extern MagickExport FILE
*OpenMagickStream(const char *,const char *);
extern MagickExport Image
*AllocateImage(const ImageInfo *) magick_attribute((deprecated)),
*AverageImages(const Image *,ExceptionInfo *),
*ExtractSubimageFromImage(Image *,const Image *,ExceptionInfo *)
magick_attribute((deprecated)),
*GetImageFromMagickRegistry(const char *,ssize_t *id,ExceptionInfo *)
magick_attribute((deprecated)),
*GetImageList(const Image *,const ssize_t,ExceptionInfo *)
magick_attribute((deprecated)),
*GetNextImage(const Image *) magick_attribute((deprecated)),
*GetPreviousImage(const Image *) magick_attribute((deprecated)),
*FlattenImages(Image *,ExceptionInfo *) magick_attribute((deprecated)),
*MaximumImages(const Image *,ExceptionInfo *),
*MedianFilterImage(const Image *,const double,ExceptionInfo *),
*ModeImage(const Image *,const double,ExceptionInfo *),
*MinimumImages(const Image *,ExceptionInfo *),
*MosaicImages(Image *,ExceptionInfo *) magick_attribute((deprecated)),
*PopImageList(Image **) magick_attribute((deprecated)),
*RecolorImage(const Image *,const size_t,const double *,ExceptionInfo *)
magick_attribute((deprecated)),
*ReduceNoiseImage(const Image *,const double,ExceptionInfo *),
*ShiftImageList(Image **) magick_attribute((deprecated)),
*SpliceImageList(Image *,const ssize_t,const size_t,const Image *,
ExceptionInfo *) magick_attribute((deprecated)),
*ZoomImage(const Image *,const size_t,const size_t,ExceptionInfo *)
magick_attribute((deprecated));
extern MagickExport IndexPacket
*GetCacheViewIndexes(CacheView *) magick_attribute((deprecated)),
*GetIndexes(const Image *) magick_attribute((deprecated)),
ValidateColormapIndex(Image *,const size_t) magick_attribute((deprecated));
extern MagickExport int
GetImageGeometry(Image *,const char *,const unsigned int,RectangleInfo *)
magick_attribute((deprecated)),
ParseImageGeometry(const char *,ssize_t *,ssize_t *,size_t *,size_t *)
magick_attribute((deprecated));
extern MagickExport MagickBooleanType
AcquireOneCacheViewPixel(const CacheView *,const ssize_t,const ssize_t,
PixelPacket *,ExceptionInfo *) magick_attribute((deprecated)),
AcquireOneCacheViewVirtualPixel(const CacheView *,const VirtualPixelMethod,
const ssize_t,const ssize_t,PixelPacket *,ExceptionInfo *)
magick_attribute((deprecated)),
AffinityImage(const QuantizeInfo *,Image *,const Image *)
magick_attribute((deprecated)),
AffinityImages(const QuantizeInfo *,Image *,const Image *)
magick_attribute((deprecated)),
AllocateImageColormap(Image *,const size_t)
magick_attribute((deprecated)),
ClipPathImage(Image *,const char *,const MagickBooleanType)
magick_attribute((deprecated)),
CloneImageAttributes(Image *,const Image *) magick_attribute((deprecated)),
ColorFloodfillImage(Image *,const DrawInfo *,const PixelPacket,const ssize_t,
const ssize_t,const PaintMethod) magick_attribute((deprecated)),
DeleteImageAttribute(Image *,const char *) magick_attribute((deprecated)),
DeleteMagickRegistry(const ssize_t) magick_attribute((deprecated)),
DescribeImage(Image *,FILE *,const MagickBooleanType)
magick_attribute((deprecated)),
FormatImageAttribute(Image *,const char *,const char *,...)
magick_attribute((__format__ (__printf__,3,4)))
magick_attribute((deprecated)),
FormatImageAttributeList(Image *,const char *,const char *,va_list)
magick_attribute((__format__ (__printf__,3,0)))
magick_attribute((deprecated)),
FormatImagePropertyList(Image *,const char *,const char *,va_list)
magick_attribute((__format__ (__printf__,3,0))),
FuzzyColorCompare(const Image *,const PixelPacket *,const PixelPacket *)
magick_attribute((deprecated)),
FuzzyOpacityCompare(const Image *,const PixelPacket *,const PixelPacket *)
magick_attribute((deprecated)),
LevelImageColors(Image *,const ChannelType,const MagickPixelPacket *,
const MagickPixelPacket *, const MagickBooleanType)
magick_attribute((deprecated)),
MagickMonitor(const char *,const MagickOffsetType,const MagickSizeType,
void *) magick_attribute((deprecated)),
MapImage(Image *,const Image *,const MagickBooleanType)
magick_attribute((deprecated)),
MapImages(Image *,const Image *,const MagickBooleanType)
magick_attribute((deprecated)),
MatteFloodfillImage(Image *,const PixelPacket,const Quantum,const ssize_t,
const ssize_t,const PaintMethod) magick_attribute((deprecated)),
OpaqueImage(Image *,const PixelPacket,const PixelPacket)
magick_attribute((deprecated)),
PaintFloodfillImage(Image *,const ChannelType,const MagickPixelPacket *,
const ssize_t,const ssize_t,const DrawInfo *,const PaintMethod)
magick_attribute((deprecated)),
PaintOpaqueImage(Image *,const MagickPixelPacket *,const MagickPixelPacket *)
magick_attribute((deprecated)),
PaintOpaqueImageChannel(Image *,const ChannelType,const MagickPixelPacket *,
const MagickPixelPacket *) magick_attribute((deprecated)),
PaintTransparentImage(Image *,const MagickPixelPacket *,const Quantum)
magick_attribute((deprecated)),
SetExceptionInfo(ExceptionInfo *,ExceptionType)
magick_attribute((deprecated)),
SetImageAttribute(Image *,const char *,const char *)
magick_attribute((deprecated)),
SyncCacheViewPixels(CacheView *) magick_attribute((deprecated)),
SyncImagePixels(Image *) magick_attribute((deprecated)),
TransparentImage(Image *,const PixelPacket,const Quantum)
magick_attribute((deprecated));
extern MagickExport MagickPixelPacket
AcquireOneMagickPixel(const Image *,const ssize_t,const ssize_t,
ExceptionInfo *) magick_attribute((deprecated));
extern MagickExport MonitorHandler
GetMonitorHandler(void) magick_attribute((deprecated)),
SetMonitorHandler(MonitorHandler) magick_attribute((deprecated));
extern MagickExport MagickOffsetType
SizeBlob(Image *image) magick_attribute((deprecated));
extern MagickExport MagickPixelPacket
InterpolatePixelColor(const Image *,CacheView *,const InterpolatePixelMethod,
const double,const double,ExceptionInfo *) magick_attribute((deprecated));
extern MagickExport MagickStatusType
ParseSizeGeometry(const Image *,const char *,RectangleInfo *)
magick_attribute((deprecated));
extern MagickExport PixelPacket
AcquireOnePixel(const Image *,const ssize_t,const ssize_t,ExceptionInfo *)
magick_attribute((deprecated)),
AcquireOneVirtualPixel(const Image *,const VirtualPixelMethod,const ssize_t,
const ssize_t,ExceptionInfo *) magick_attribute((deprecated)),
*GetCacheView(CacheView *,const ssize_t,const ssize_t,const size_t,
const size_t) magick_attribute((deprecated)),
*GetCacheViewPixels(CacheView *,const ssize_t,const ssize_t,const size_t,
const size_t) magick_attribute((deprecated)),
*GetImagePixels(Image *,const ssize_t,const ssize_t,const size_t,
const size_t) magick_attribute((deprecated)),
GetOnePixel(Image *,const ssize_t,const ssize_t)
magick_attribute((deprecated)),
*GetPixels(const Image *) magick_attribute((deprecated)),
*SetCacheViewPixels(CacheView *,const ssize_t,const ssize_t,const size_t,
const size_t) magick_attribute((deprecated)),
*SetImagePixels(Image *,const ssize_t,const ssize_t,const size_t,
const size_t) magick_attribute((deprecated));
extern MagickExport MagickRealType
InversesRGBCompandor(const MagickRealType) magick_attribute((deprecated)),
sRGBCompandor(const MagickRealType) magick_attribute((deprecated));
extern MagickExport size_t
GetImageListSize(const Image *) magick_attribute((deprecated)),
PopImagePixels(Image *,const QuantumType,unsigned char *)
magick_attribute((deprecated)),
PushImagePixels(Image *,const QuantumType,const unsigned char *)
magick_attribute((deprecated));
extern MagickExport ssize_t
FormatMagickString(char *,const size_t,const char *,...)
magick_attribute((__format__ (__printf__,3,4)))
magick_attribute((deprecated)),
FormatMagickStringList(char *,const size_t,const char *,va_list)
magick_attribute((__format__ (__printf__,3,0))),
GetImageListIndex(const Image *) magick_attribute((deprecated)),
SetMagickRegistry(const RegistryType,const void *,const size_t,
ExceptionInfo *) magick_attribute((deprecated));
extern MagickExport unsigned int
ChannelImage(Image *,const ChannelType) magick_attribute((deprecated)),
ChannelThresholdImage(Image *,const char *) magick_attribute((deprecated)),
DispatchImage(const Image *,const ssize_t,const ssize_t,const size_t,
const size_t,const char *,const StorageType,void *,ExceptionInfo *)
magick_attribute((deprecated)),
FuzzyColorMatch(const PixelPacket *,const PixelPacket *,const double)
magick_attribute((deprecated)),
GetNumberScenes(const Image *) magick_attribute((deprecated)),
GetMagickGeometry(const char *,ssize_t *,ssize_t *,size_t *,size_t *)
magick_attribute((deprecated)),
IsSubimage(const char *,const unsigned int) magick_attribute((deprecated)),
PushImageList(Image **,const Image *,ExceptionInfo *)
magick_attribute((deprecated)),
QuantizationError(Image *) magick_attribute((deprecated)),
RandomChannelThresholdImage(Image *,const char *,const char *,
ExceptionInfo *) magick_attribute((deprecated)),
SetImageList(Image **,const Image *,const ssize_t,ExceptionInfo *)
magick_attribute((deprecated)),
TransformColorspace(Image *,const ColorspaceType)
magick_attribute((deprecated)),
ThresholdImage(Image *,const double) magick_attribute((deprecated)),
ThresholdImageChannel(Image *,const char *) magick_attribute((deprecated)),
UnshiftImageList(Image **,const Image *,ExceptionInfo *)
magick_attribute((deprecated));
extern MagickExport void
*AcquireMemory(const size_t) magick_attribute((deprecated)),
AllocateNextImage(const ImageInfo *,Image *) magick_attribute((deprecated)),
*CloneMemory(void *,const void *,const size_t) magick_attribute((deprecated)),
DestroyConstitute(void),
DestroyImageAttributes(Image *) magick_attribute((deprecated)),
DestroyImages(Image *) magick_attribute((deprecated)),
DestroyMagick(void) magick_attribute((deprecated)),
DestroyMagickRegistry(void) magick_attribute((deprecated)),
*GetConfigureBlob(const char *,char *,size_t *,ExceptionInfo *)
magick_attribute((deprecated)),
*GetMagickRegistry(const ssize_t,RegistryType *,size_t *,ExceptionInfo *)
magick_attribute((deprecated)),
IdentityAffine(AffineMatrix *) magick_attribute((deprecated)),
LiberateMemory(void **) magick_attribute((deprecated)),
LiberateSemaphoreInfo(SemaphoreInfo **) magick_attribute((deprecated)),
FormatString(char *,const char *,...)
magick_attribute((__format__ (__printf__,2,3)))
magick_attribute((deprecated)),
FormatStringList(char *,const char *,va_list)
magick_attribute((__format__ (__printf__,2,0)))
magick_attribute((deprecated)),
HSLTransform(const double,const double,const double,Quantum *,Quantum *,
Quantum *) magick_attribute((deprecated)),
InitializeMagick(const char *) magick_attribute((deprecated)),
MagickIncarnate(const char *) magick_attribute((deprecated)),
ReacquireMemory(void **,const size_t) magick_attribute((deprecated)),
ResetImageAttributeIterator(const Image *) magick_attribute((deprecated)),
SetCacheThreshold(const size_t) magick_attribute((deprecated)),
SetImage(Image *,const Quantum) magick_attribute((deprecated)),
Strip(char *) magick_attribute((deprecated)),
TemporaryFilename(char *) magick_attribute((deprecated)),
TransformHSL(const Quantum,const Quantum,const Quantum,double *,double *,
double *) magick_attribute((deprecated));
/*
Inline methods.
*/
static inline double MagickEpsilonReciprocal(const double x)
{
double
sign;
sign=x < 0.0 ? -1.0 : 1.0;
if ((sign*x) >= MagickEpsilon)
return(1.0/x);
return(sign/MagickEpsilon);
}
#endif
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

View file

@ -0,0 +1,39 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore methods to interactively display and edit an image.
*/
#ifndef _MAGICKCORE_DISPLAY_PRIVATE_H
#define _MAGICKCORE_DISPLAY_PRIVATE_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#if defined(MAGICKCORE_X11_DELEGATE)
#include "magick/xwindow-private.h"
extern MagickExport Image
*XDisplayImage(Display *,XResourceInfo *,char **,int,Image **,size_t *);
extern MagickExport MagickBooleanType XDisplayBackgroundImage(Display *,
XResourceInfo *,Image *);
#endif
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

16116
ImageMagick/magick/display.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,34 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore methods to interactively display and edit an image.
*/
#ifndef _MAGICKCORE_DISPLAY_H
#define _MAGICKCORE_DISPLAY_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
extern MagickExport MagickBooleanType
DisplayImages(const ImageInfo *,Image *),
RemoteDisplayCommand(const ImageInfo *,const char *,const char *,
ExceptionInfo *);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

3229
ImageMagick/magick/distort.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,85 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore image distortion methods.
*/
#ifndef _MAGICKCORE_DISTORT_H
#define _MAGICKCORE_DISTORT_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
/*
These two enum are linked, with common enumerated values. Both
DistortImages() and SparseColor() often share code to determine functional
coefficients for common methods.
Caution should be taken to ensure that only the common methods contain the
same enumerated value, while all others remain unique across both
enumerations.
*/
typedef enum
{
UndefinedDistortion,
AffineDistortion,
AffineProjectionDistortion,
ScaleRotateTranslateDistortion,
PerspectiveDistortion,
PerspectiveProjectionDistortion,
BilinearForwardDistortion,
BilinearDistortion = BilinearForwardDistortion,
BilinearReverseDistortion,
PolynomialDistortion,
ArcDistortion,
PolarDistortion,
DePolarDistortion,
Cylinder2PlaneDistortion,
Plane2CylinderDistortion,
BarrelDistortion,
BarrelInverseDistortion,
ShepardsDistortion,
ResizeDistortion,
SentinelDistortion
} DistortImageMethod;
typedef enum
{
UndefinedColorInterpolate = UndefinedDistortion,
BarycentricColorInterpolate = AffineDistortion,
BilinearColorInterpolate = BilinearReverseDistortion,
PolynomialColorInterpolate = PolynomialDistortion,
ShepardsColorInterpolate = ShepardsDistortion,
/*
Methods unique to SparseColor().
*/
VoronoiColorInterpolate = SentinelDistortion,
InverseColorInterpolate
} SparseColorMethod;
extern MagickExport Image
*AffineTransformImage(const Image *,const AffineMatrix *,ExceptionInfo *),
*DistortImage(const Image *,const DistortImageMethod,const size_t,
const double *,MagickBooleanType,ExceptionInfo *exception),
*DistortResizeImage(const Image *,const size_t,const size_t,ExceptionInfo *),
*RotateImage(const Image *,const double,ExceptionInfo *),
*SparseColorImage(const Image *,const ChannelType,const SparseColorMethod,
const size_t,const double *,ExceptionInfo *);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

View file

@ -0,0 +1,75 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore distributed cache private methods.
*/
#ifndef _MAGICKCORE_DISTRIBUTE_CACHE_PRIVATE_H
#define _MAGICKCORE_DISTRIBUTE_CACHE_PRIVATE_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#include "magick/geometry.h"
#include "magick/exception.h"
typedef struct _DistributeCacheInfo
{
int
file;
size_t
session_key;
char
hostname[MaxTextExtent];
int
port;
size_t
signature;
} DistributeCacheInfo;
extern MagickPrivate const char
*GetDistributeCacheHostname(const DistributeCacheInfo *);
extern MagickPrivate DistributeCacheInfo
*AcquireDistributeCacheInfo(ExceptionInfo *),
*DestroyDistributeCacheInfo(DistributeCacheInfo *);
extern MagickPrivate int
GetDistributeCacheFile(const DistributeCacheInfo *),
GetDistributeCachePort(const DistributeCacheInfo *);
extern MagickPrivate MagickBooleanType
OpenDistributePixelCache(DistributeCacheInfo *,Image *),
RelinquishDistributePixelCache(DistributeCacheInfo *);
extern MagickPrivate MagickOffsetType
ReadDistributePixelCacheIndexes(DistributeCacheInfo *,
const RectangleInfo *,const MagickSizeType,unsigned char *),
ReadDistributePixelCachePixels(DistributeCacheInfo *,const RectangleInfo *,
const MagickSizeType,unsigned char *),
WriteDistributePixelCacheIndexes(DistributeCacheInfo *,
const RectangleInfo *,const MagickSizeType,const unsigned char *),
WriteDistributePixelCachePixels(DistributeCacheInfo *,const RectangleInfo *,
const MagickSizeType,const unsigned char *);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,34 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore distributed cache methods.
*/
#ifndef _MAGICKCORE_DISTRIBUTE_CACHE_H
#define _MAGICKCORE_DISTRIBUTE_CACHE_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#include "magick/exception.h"
extern MagickExport void
DistributePixelCacheServer(const int,ExceptionInfo *);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

View file

@ -0,0 +1,79 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore private image drawing methods.
*/
#ifndef _MAGICKCORE_DRAW_PRIVATE_H
#define _MAGICKCORE_DRAW_PRIVATE_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#include "magick/cache.h"
#include "magick/image.h"
#include "magick/memory_.h"
static inline MagickBooleanType GetFillColor(const DrawInfo *draw_info,
const ssize_t x,const ssize_t y,PixelPacket *pixel)
{
Image
*pattern;
MagickBooleanType
status;
pattern=draw_info->fill_pattern;
if (pattern == (Image *) NULL)
{
*pixel=draw_info->fill;
return(MagickTrue);
}
status=GetOneVirtualMethodPixel(pattern,TileVirtualPixelMethod,
x+pattern->tile_offset.x,y+pattern->tile_offset.y,pixel,
&pattern->exception);
if (pattern->matte == MagickFalse)
pixel->opacity=OpaqueOpacity;
return(status);
}
static inline MagickBooleanType GetStrokeColor(const DrawInfo *draw_info,
const ssize_t x,const ssize_t y,PixelPacket *pixel)
{
Image
*pattern;
MagickBooleanType
status;
pattern=draw_info->stroke_pattern;
if (pattern == (Image *) NULL)
{
*pixel=draw_info->stroke;
return(MagickTrue);
}
status=GetOneVirtualMethodPixel(pattern,TileVirtualPixelMethod,
x+pattern->tile_offset.x,y+pattern->tile_offset.y,pixel,
&pattern->exception);
if (pattern->matte == MagickFalse)
pixel->opacity=OpaqueOpacity;
return(status);
}
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

6139
ImageMagick/magick/draw.c Normal file

File diff suppressed because it is too large Load diff

395
ImageMagick/magick/draw.h Normal file
View file

@ -0,0 +1,395 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore drawing methods.
*/
#ifndef _MAGICKCORE_DRAW_H
#define _MAGICKCORE_DRAW_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#include "magick/geometry.h"
#include "magick/image.h"
#include "magick/pixel.h"
#include "magick/type.h"
typedef enum
{
UndefinedAlign,
LeftAlign,
CenterAlign,
RightAlign
} AlignType;
typedef enum
{
UndefinedPathUnits,
UserSpace,
UserSpaceOnUse,
ObjectBoundingBox
} ClipPathUnits;
typedef enum
{
UndefinedDecoration,
NoDecoration,
UnderlineDecoration,
OverlineDecoration,
LineThroughDecoration
} DecorationType;
typedef enum
{
UndefinedDirection,
RightToLeftDirection,
LeftToRightDirection
} DirectionType;
typedef enum
{
UndefinedRule,
#undef EvenOddRule
EvenOddRule,
NonZeroRule
} FillRule;
typedef enum
{
UndefinedGradient,
LinearGradient,
RadialGradient
} GradientType;
typedef enum
{
UndefinedCap,
ButtCap,
RoundCap,
SquareCap
} LineCap;
typedef enum
{
UndefinedJoin,
MiterJoin,
RoundJoin,
BevelJoin
} LineJoin;
typedef enum
{
UndefinedMethod,
PointMethod,
ReplaceMethod,
FloodfillMethod,
FillToBorderMethod,
ResetMethod
} PaintMethod;
typedef enum
{
UndefinedPrimitive,
PointPrimitive,
LinePrimitive,
RectanglePrimitive,
RoundRectanglePrimitive,
ArcPrimitive,
EllipsePrimitive,
CirclePrimitive,
PolylinePrimitive,
PolygonPrimitive,
BezierPrimitive,
ColorPrimitive,
MattePrimitive,
TextPrimitive,
ImagePrimitive,
PathPrimitive
} PrimitiveType;
typedef enum
{
UndefinedReference,
GradientReference
} ReferenceType;
typedef enum
{
UndefinedSpread,
PadSpread,
ReflectSpread,
RepeatSpread
} SpreadMethod;
typedef struct _PointInfo
{
double
x,
y;
} PointInfo;
typedef struct _StopInfo
{
MagickPixelPacket
color;
MagickRealType
offset;
} StopInfo;
typedef struct _GradientInfo
{
GradientType
type;
RectangleInfo
bounding_box;
SegmentInfo
gradient_vector;
StopInfo
*stops;
size_t
number_stops;
SpreadMethod
spread;
MagickBooleanType
debug;
size_t
signature;
PointInfo
center;
MagickRealType
radius;
} GradientInfo;
typedef struct _ElementReference
{
char
*id;
ReferenceType
type;
GradientInfo
gradient;
size_t
signature;
struct _ElementReference
*previous,
*next;
} ElementReference;
typedef struct _DrawInfo
{
char
*primitive,
*geometry;
RectangleInfo
viewbox;
AffineMatrix
affine;
GravityType
gravity;
PixelPacket
fill,
stroke;
double
stroke_width;
GradientInfo
gradient;
Image
*fill_pattern,
*tile,
*stroke_pattern;
MagickBooleanType
stroke_antialias,
text_antialias;
FillRule
fill_rule;
LineCap
linecap;
LineJoin
linejoin;
size_t
miterlimit;
double
dash_offset;
DecorationType
decorate;
CompositeOperator
compose;
char
*text;
size_t
face;
char
*font,
*metrics,
*family;
StyleType
style;
StretchType
stretch;
size_t
weight;
char
*encoding;
double
pointsize;
char
*density;
AlignType
align;
PixelPacket
undercolor,
border_color;
char
*server_name;
double
*dash_pattern;
char
*clip_mask;
SegmentInfo
bounds;
ClipPathUnits
clip_units;
Quantum
opacity;
MagickBooleanType
render;
ElementReference
element_reference;
MagickBooleanType
debug;
size_t
signature;
double
kerning,
interword_spacing,
interline_spacing;
DirectionType
direction;
} DrawInfo;
typedef struct _PrimitiveInfo
{
PointInfo
point;
size_t
coordinates;
PrimitiveType
primitive;
PaintMethod
method;
char
*text;
} PrimitiveInfo;
typedef struct _TypeMetric
{
PointInfo
pixels_per_em;
double
ascent,
descent,
width,
height,
max_advance,
underline_position,
underline_thickness;
SegmentInfo
bounds;
PointInfo
origin;
} TypeMetric;
extern MagickExport DrawInfo
*AcquireDrawInfo(void),
*CloneDrawInfo(const ImageInfo *,const DrawInfo *),
*DestroyDrawInfo(DrawInfo *);
extern MagickExport MagickBooleanType
DrawAffineImage(Image *,const Image *,const AffineMatrix *),
DrawClipPath(Image *,const DrawInfo *,const char *),
DrawGradientImage(Image *,const DrawInfo *),
DrawImage(Image *,const DrawInfo *),
DrawPatternPath(Image *,const DrawInfo *,const char *,Image **),
DrawPrimitive(Image *,const DrawInfo *,const PrimitiveInfo *);
extern MagickExport void
GetAffineMatrix(AffineMatrix *),
GetDrawInfo(const ImageInfo *,DrawInfo *);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

4836
ImageMagick/magick/effect.c Normal file

File diff suppressed because it is too large Load diff

111
ImageMagick/magick/effect.h Normal file
View file

@ -0,0 +1,111 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore image effects methods.
*/
#ifndef _MAGICKCORE_EFFECT_H
#define _MAGICKCORE_EFFECT_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#include "magick/morphology.h"
typedef enum
{
UndefinedPreview,
RotatePreview,
ShearPreview,
RollPreview,
HuePreview,
SaturationPreview,
BrightnessPreview,
GammaPreview,
SpiffPreview,
DullPreview,
GrayscalePreview,
QuantizePreview,
DespecklePreview,
ReduceNoisePreview,
AddNoisePreview,
SharpenPreview,
BlurPreview,
ThresholdPreview,
EdgeDetectPreview,
SpreadPreview,
SolarizePreview,
ShadePreview,
RaisePreview,
SegmentPreview,
SwirlPreview,
ImplodePreview,
WavePreview,
OilPaintPreview,
CharcoalDrawingPreview,
JPEGPreview
} PreviewType;
extern MagickExport Image
*AdaptiveBlurImage(const Image *,const double,const double,ExceptionInfo *),
*AdaptiveBlurImageChannel(const Image *,const ChannelType,const double,
const double,ExceptionInfo *),
*AdaptiveSharpenImage(const Image *,const double,const double,
ExceptionInfo *),
*AdaptiveSharpenImageChannel(const Image *,const ChannelType,const double,
const double,ExceptionInfo *),
*BlurImage(const Image *,const double,const double,ExceptionInfo *),
*BlurImageChannel(const Image *,const ChannelType,const double,const double,
ExceptionInfo *),
*ConvolveImage(const Image *,const size_t,const double *,ExceptionInfo *),
*ConvolveImageChannel(const Image *,const ChannelType,const size_t,
const double *,ExceptionInfo *),
*DespeckleImage(const Image *,ExceptionInfo *),
*EdgeImage(const Image *,const double,ExceptionInfo *),
*EmbossImage(const Image *,const double,const double,ExceptionInfo *),
*FilterImage(const Image *,const KernelInfo *,ExceptionInfo *),
*FilterImageChannel(const Image *,const ChannelType,const KernelInfo *,
ExceptionInfo *),
*GaussianBlurImage(const Image *,const double,const double,ExceptionInfo *),
*GaussianBlurImageChannel(const Image *,const ChannelType,const double,
const double,ExceptionInfo *),
*MotionBlurImage(const Image *,const double,const double,const double,
ExceptionInfo *),
*MotionBlurImageChannel(const Image *,const ChannelType,const double,
const double,const double,ExceptionInfo *),
*PreviewImage(const Image *,const PreviewType,ExceptionInfo *),
*RadialBlurImage(const Image *,const double,ExceptionInfo *),
*RadialBlurImageChannel(const Image *,const ChannelType,const double,
ExceptionInfo *),
*SelectiveBlurImage(const Image *,const double,const double,const double,
ExceptionInfo *),
*SelectiveBlurImageChannel(const Image *,const ChannelType,const double,
const double,const double,ExceptionInfo *),
*ShadeImage(const Image *,const MagickBooleanType,const double,const double,
ExceptionInfo *),
*SharpenImage(const Image *,const double,const double,ExceptionInfo *),
*SharpenImageChannel(const Image *,const ChannelType,const double,
const double,ExceptionInfo *),
*SpreadImage(const Image *,const double,ExceptionInfo *),
*UnsharpMaskImage(const Image *,const double,const double,const double,
const double,ExceptionInfo *),
*UnsharpMaskImageChannel(const Image *,const ChannelType,const double,
const double,const double,const double,ExceptionInfo *);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

4061
ImageMagick/magick/enhance.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,73 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore image enhance methods.
*/
#ifndef _MAGICKCORE_ENHANCE_H
#define _MAGICKCORE_ENHANCE_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
extern MagickExport MagickBooleanType
AutoGammaImage(Image *),
AutoGammaImageChannel(Image *,const ChannelType),
AutoLevelImage(Image *),
AutoLevelImageChannel(Image *,const ChannelType),
BrightnessContrastImage(Image *,const double,const double),
BrightnessContrastImageChannel(Image *,const ChannelType,const double,
const double),
ClutImage(Image *,const Image *),
ClutImageChannel(Image *,const ChannelType,const Image *),
ColorDecisionListImage(Image *,const char *),
ContrastImage(Image *,const MagickBooleanType),
ContrastStretchImage(Image *,const char *),
ContrastStretchImageChannel(Image *,const ChannelType,const double,
const double),
EqualizeImage(Image *image),
EqualizeImageChannel(Image *image,const ChannelType),
GammaImage(Image *,const char *),
GammaImageChannel(Image *,const ChannelType,const double),
HaldClutImage(Image *,const Image *),
HaldClutImageChannel(Image *,const ChannelType,const Image *),
LevelImage(Image *,const char *),
LevelImageChannel(Image *,const ChannelType,const double,const double,
const double),
LevelizeImage(Image *,const double,const double,const double),
LevelizeImageChannel(Image *,const ChannelType,const double,const double,
const double),
LevelColorsImage(Image *,const MagickPixelPacket *,const MagickPixelPacket *,
const MagickBooleanType),
LevelColorsImageChannel(Image *,const ChannelType,const MagickPixelPacket *,
const MagickPixelPacket *,const MagickBooleanType),
LinearStretchImage(Image *,const double,const double),
ModulateImage(Image *,const char *),
NegateImage(Image *,const MagickBooleanType),
NegateImageChannel(Image *,const ChannelType,const MagickBooleanType),
NormalizeImage(Image *),
NormalizeImageChannel(Image *,const ChannelType),
SigmoidalContrastImage(Image *,const MagickBooleanType,const char *),
SigmoidalContrastImageChannel(Image *,const ChannelType,
const MagickBooleanType,const double,const double);
extern MagickExport Image
*EnhanceImage(const Image *,ExceptionInfo *);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

View file

@ -0,0 +1,96 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore exception private methods.
*/
#ifndef _MAGICKCORE_EXCEPTION_PRIVATE_H
#define _MAGICKCORE_EXCEPTION_PRIVATE_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#include "magick/log.h"
#include "magick/magick.h"
#include "magick/string_.h"
#define ThrowBinaryException(severity,tag,context) \
{ \
if (image != (Image *) NULL) \
(void) ThrowMagickException(&image->exception,GetMagickModule(),severity, \
tag == (const char *) NULL ? "unknown" : tag,"`%s'",context); \
return(MagickFalse); \
}
#define ThrowFatalException(severity,tag) \
{ \
char \
*message; \
\
ExceptionInfo \
exception; \
\
GetExceptionInfo(&exception); \
message=GetExceptionMessage(errno); \
(void) ThrowMagickException(&exception,GetMagickModule(),severity, \
tag == (const char *) NULL ? "unknown" : tag,"`%s'",message); \
message=DestroyString(message); \
CatchException(&exception); \
(void) DestroyExceptionInfo(&exception); \
MagickCoreTerminus(); \
_exit((int) (severity-FatalErrorException)+1); \
}
#define ThrowFileException(exception,severity,tag,context) \
{ \
char \
*message; \
\
message=GetExceptionMessage(errno); \
(void) ThrowMagickException(exception,GetMagickModule(),severity, \
tag == (const char *) NULL ? "unknown" : tag,"`%s': %s",context,message); \
message=DestroyString(message); \
}
#define ThrowImageException(severity,tag) \
{ \
(void) ThrowMagickException(exception,GetMagickModule(),severity, \
tag == (const char *) NULL ? "unknown" : tag,"`%s'",image->filename); \
return((Image *) NULL); \
}
#define ThrowReaderException(severity,tag) \
{ \
(void) ThrowMagickException(exception,GetMagickModule(),severity, \
tag == (const char *) NULL ? "unknown" : tag,"`%s'",image_info->filename); \
if ((image) != (Image *) NULL) \
{ \
(void) CloseBlob(image); \
image=DestroyImageList(image); \
} \
return((Image *) NULL); \
}
#define ThrowWriterException(severity,tag) \
{ \
(void) ThrowMagickException(&image->exception,GetMagickModule(),severity, \
tag == (const char *) NULL ? "unknown" : tag,"`%s'",image->filename); \
if (image_info->adjoin != MagickFalse) \
while (image->previous != (Image *) NULL) \
image=image->previous; \
(void) CloseBlob(image); \
return(MagickFalse); \
}
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,178 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore exception methods.
*/
#ifndef _MAGICKCORE_EXCEPTION_H
#define _MAGICKCORE_EXCEPTION_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#include <stdarg.h>
#include "magick/semaphore.h"
typedef enum
{
UndefinedException,
WarningException = 300,
ResourceLimitWarning = 300,
TypeWarning = 305,
OptionWarning = 310,
DelegateWarning = 315,
MissingDelegateWarning = 320,
CorruptImageWarning = 325,
FileOpenWarning = 330,
BlobWarning = 335,
StreamWarning = 340,
CacheWarning = 345,
CoderWarning = 350,
FilterWarning = 352,
ModuleWarning = 355,
DrawWarning = 360,
ImageWarning = 365,
WandWarning = 370,
RandomWarning = 375,
XServerWarning = 380,
MonitorWarning = 385,
RegistryWarning = 390,
ConfigureWarning = 395,
PolicyWarning = 399,
ErrorException = 400,
ResourceLimitError = 400,
TypeError = 405,
OptionError = 410,
DelegateError = 415,
MissingDelegateError = 420,
CorruptImageError = 425,
FileOpenError = 430,
BlobError = 435,
StreamError = 440,
CacheError = 445,
CoderError = 450,
FilterError = 452,
ModuleError = 455,
DrawError = 460,
ImageError = 465,
WandError = 470,
RandomError = 475,
XServerError = 480,
MonitorError = 485,
RegistryError = 490,
ConfigureError = 495,
PolicyError = 499,
FatalErrorException = 700,
ResourceLimitFatalError = 700,
TypeFatalError = 705,
OptionFatalError = 710,
DelegateFatalError = 715,
MissingDelegateFatalError = 720,
CorruptImageFatalError = 725,
FileOpenFatalError = 730,
BlobFatalError = 735,
StreamFatalError = 740,
CacheFatalError = 745,
CoderFatalError = 750,
FilterFatalError = 752,
ModuleFatalError = 755,
DrawFatalError = 760,
ImageFatalError = 765,
WandFatalError = 770,
RandomFatalError = 775,
XServerFatalError = 780,
MonitorFatalError = 785,
RegistryFatalError = 790,
ConfigureFatalError = 795,
PolicyFatalError = 799
} ExceptionType;
struct _ExceptionInfo
{
ExceptionType
severity;
int
error_number;
char
*reason,
*description;
void
*exceptions;
MagickBooleanType
relinquish;
SemaphoreInfo
*semaphore;
size_t
signature;
};
typedef void
(*ErrorHandler)(const ExceptionType,const char *,const char *);
typedef void
(*FatalErrorHandler)(const ExceptionType,const char *,const char *);
typedef void
(*WarningHandler)(const ExceptionType,const char *,const char *);
extern MagickExport char
*GetExceptionMessage(const int);
extern MagickExport const char
*GetLocaleExceptionMessage(const ExceptionType,const char *);
extern MagickExport ErrorHandler
SetErrorHandler(ErrorHandler);
extern MagickExport ExceptionInfo
*AcquireExceptionInfo(void),
*DestroyExceptionInfo(ExceptionInfo *);
extern MagickExport FatalErrorHandler
SetFatalErrorHandler(FatalErrorHandler);
extern MagickExport MagickBooleanType
ThrowException(ExceptionInfo *,const ExceptionType,const char *,
const char *),
ThrowMagickException(ExceptionInfo *,const char *,const char *,const size_t,
const ExceptionType,const char *,const char *,...)
magick_attribute((__format__ (__printf__,7,8))),
ThrowMagickExceptionList(ExceptionInfo *,const char *,const char *,
const size_t,const ExceptionType,const char *,const char *,va_list)
magick_attribute((__format__ (__printf__,7,0)));
extern MagickExport void
CatchException(ExceptionInfo *),
ClearMagickException(ExceptionInfo *),
GetExceptionInfo(ExceptionInfo *),
InheritException(ExceptionInfo *,const ExceptionInfo *),
MagickError(const ExceptionType,const char *,const char *),
MagickFatalError(const ExceptionType,const char *,const char *),
MagickWarning(const ExceptionType,const char *,const char *);
extern MagickExport WarningHandler
SetWarningHandler(WarningHandler);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

1244
ImageMagick/magick/feature.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,54 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore feature methods.
*/
#ifndef _MAGICKCORE_FEATURE_H
#define _MAGICKCORE_FEATURE_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
/*
Haralick texture features.
*/
typedef struct _ChannelFeatures
{
double
angular_second_moment[4],
contrast[4],
correlation[4],
variance_sum_of_squares[4],
inverse_difference_moment[4],
sum_average[4],
sum_variance[4],
sum_entropy[4],
entropy[4],
difference_variance[4],
difference_entropy[4],
measure_of_correlation_1[4],
measure_of_correlation_2[4],
maximum_correlation_coefficient[4];
} ChannelFeatures;
extern MagickExport ChannelFeatures
*GetImageChannelFeatures(const Image *,const size_t,ExceptionInfo *);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

1351
ImageMagick/magick/fourier.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,35 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore discrete Fourier transform (DFT) methods.
*/
#ifndef _MAGICKCORE_FFT_H
#define _MAGICKCORE_FFT_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
extern MagickExport Image
*ForwardFourierTransformImage(const Image *,const MagickBooleanType,
ExceptionInfo *),
*InverseFourierTransformImage(const Image *,const Image *,
const MagickBooleanType,ExceptionInfo *);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

View file

@ -0,0 +1,41 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore private image f/x methods.
*/
#ifndef _MAGICKCORE_FX_PRIVATE_H
#define _MAGICKCORE_FX_PRIVATE_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
typedef struct _FxInfo
FxInfo;
extern MagickExport FxInfo
*AcquireFxInfo(const Image *,const char *),
*DestroyFxInfo(FxInfo *);
extern MagickExport MagickBooleanType
FxEvaluateExpression(FxInfo *,MagickRealType *,ExceptionInfo *),
FxEvaluateChannelExpression(FxInfo *,const ChannelType,const ssize_t,
const ssize_t,MagickRealType *,ExceptionInfo *);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

5611
ImageMagick/magick/fx.c Normal file

File diff suppressed because it is too large Load diff

76
ImageMagick/magick/fx.h Normal file
View file

@ -0,0 +1,76 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore image f/x methods.
*/
#ifndef _MAGICKCORE_FX_H
#define _MAGICKCORE_FX_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#include "magick/draw.h"
typedef enum
{
UndefinedNoise,
UniformNoise,
GaussianNoise,
MultiplicativeGaussianNoise,
ImpulseNoise,
LaplacianNoise,
PoissonNoise,
RandomNoise
} NoiseType;
extern MagickExport Image
*AddNoiseImage(const Image *,const NoiseType,ExceptionInfo *),
*AddNoiseImageChannel(const Image *,const ChannelType,const NoiseType,
ExceptionInfo *),
*BlueShiftImage(const Image *,const double,ExceptionInfo *),
*CharcoalImage(const Image *,const double,const double,ExceptionInfo *),
*ColorizeImage(const Image *,const char *,const PixelPacket,ExceptionInfo *),
*ColorMatrixImage(const Image *,const KernelInfo *kernel,ExceptionInfo *),
*FxImage(const Image *,const char *,ExceptionInfo *),
*FxImageChannel(const Image *,const ChannelType,const char *,ExceptionInfo *),
*ImplodeImage(const Image *,const double,ExceptionInfo *),
*MorphImages(const Image *,const size_t,ExceptionInfo *),
*PolaroidImage(const Image *,const DrawInfo *,const double,ExceptionInfo *),
*SepiaToneImage(const Image *,const double,ExceptionInfo *),
*ShadowImage(const Image *,const double,const double,const ssize_t,
const ssize_t,ExceptionInfo *),
*SketchImage(const Image *,const double,const double,const double,
ExceptionInfo *),
*SteganoImage(const Image *,const Image *,ExceptionInfo *),
*StereoImage(const Image *,const Image *,ExceptionInfo *),
*StereoAnaglyphImage(const Image *,const Image *,const ssize_t,const ssize_t,
ExceptionInfo *),
*SwirlImage(const Image *,double,ExceptionInfo *),
*TintImage(const Image *,const char *,const PixelPacket,ExceptionInfo *),
*VignetteImage(const Image *,const double,const double,const ssize_t,
const ssize_t,ExceptionInfo *),
*WaveImage(const Image *,const double,const double,ExceptionInfo *);
extern MagickExport MagickBooleanType
PlasmaImage(Image *,const SegmentInfo *,size_t,size_t),
SolarizeImage(Image *,const double),
SolarizeImageChannel(Image *,const ChannelType,const double,ExceptionInfo *);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

991
ImageMagick/magick/gem.c Normal file
View file

@ -0,0 +1,991 @@
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% GGGG EEEEE M M %
% G E MM MM %
% G GG EEE M M M %
% G G E M M %
% GGGG EEEEE M M %
% %
% %
% Graphic Gems - Graphic Support Methods %
% %
% Software Design %
% John Cristy %
% August 1996 %
% %
% %
% Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization %
% dedicated to making software imaging solutions freely available. %
% %
% You may not use this file except in compliance with the License. You may %
% obtain a copy of the License at %
% %
% http://www.imagemagick.org/script/license.php %
% %
% Unless required by applicable law or agreed to in writing, software %
% distributed under the License is distributed on an "AS IS" BASIS, %
% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
% See the License for the specific language governing permissions and %
% limitations under the License. %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
%
*/
/*
Include declarations.
*/
#include "magick/studio.h"
#include "magick/color-private.h"
#include "magick/draw.h"
#include "magick/gem.h"
#include "magick/image.h"
#include "magick/image-private.h"
#include "magick/log.h"
#include "magick/memory_.h"
#include "magick/pixel-private.h"
#include "magick/quantum.h"
#include "magick/random_.h"
#include "magick/resize.h"
#include "magick/transform.h"
#include "magick/signature-private.h"
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% C o n v e r t H C L T o R G B %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ConvertHCLToRGB() transforms a (hue, chroma, luma) to a (red, green,
% blue) triple.
%
% The format of the ConvertHCLToRGBImage method is:
%
% void ConvertHCLToRGB(const double hue,const double chroma,
% const double luma,Quantum *red,Quantum *green,Quantum *blue)
%
% A description of each parameter follows:
%
% o hue, chroma, luma: A double value representing a
% component of the HCL color space.
%
% o red, green, blue: A pointer to a pixel component of type Quantum.
%
*/
MagickExport void ConvertHCLToRGB(const double hue,const double chroma,
const double luma,Quantum *red,Quantum *green,Quantum *blue)
{
double
b,
c,
g,
h,
m,
r,
x;
/*
Convert HCL to RGB colorspace.
*/
assert(red != (Quantum *) NULL);
assert(green != (Quantum *) NULL);
assert(blue != (Quantum *) NULL);
h=6.0*hue;
c=chroma;
x=c*(1.0-fabs(fmod(h,2.0)-1.0));
r=0.0;
g=0.0;
b=0.0;
if ((0.0 <= h) && (h < 1.0))
{
r=c;
g=x;
}
else
if ((1.0 <= h) && (h < 2.0))
{
r=x;
g=c;
}
else
if ((2.0 <= h) && (h < 3.0))
{
g=c;
b=x;
}
else
if ((3.0 <= h) && (h < 4.0))
{
g=x;
b=c;
}
else
if ((4.0 <= h) && (h < 5.0))
{
r=x;
b=c;
}
else
if ((5.0 <= h) && (h < 6.0))
{
r=c;
b=x;
}
m=luma-(0.298839f*r+0.586811f*g+0.114350f*b);
*red=ClampToQuantum(QuantumRange*(r+m));
*green=ClampToQuantum(QuantumRange*(g+m));
*blue=ClampToQuantum(QuantumRange*(b+m));
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% C o n v e r t H S B T o R G B %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ConvertHSBToRGB() transforms a (hue, saturation, brightness) to a (red,
% green, blue) triple.
%
% The format of the ConvertHSBToRGBImage method is:
%
% void ConvertHSBToRGB(const double hue,const double saturation,
% const double brightness,Quantum *red,Quantum *green,Quantum *blue)
%
% A description of each parameter follows:
%
% o hue, saturation, brightness: A double value representing a
% component of the HSB color space.
%
% o red, green, blue: A pointer to a pixel component of type Quantum.
%
*/
MagickExport void ConvertHSBToRGB(const double hue,const double saturation,
const double brightness,Quantum *red,Quantum *green,Quantum *blue)
{
double
f,
h,
p,
q,
t;
/*
Convert HSB to RGB colorspace.
*/
assert(red != (Quantum *) NULL);
assert(green != (Quantum *) NULL);
assert(blue != (Quantum *) NULL);
if (saturation == 0.0)
{
*red=ClampToQuantum(QuantumRange*brightness);
*green=(*red);
*blue=(*red);
return;
}
h=6.0*(hue-floor(hue));
f=h-floor((double) h);
p=brightness*(1.0-saturation);
q=brightness*(1.0-saturation*f);
t=brightness*(1.0-(saturation*(1.0-f)));
switch ((int) h)
{
case 0:
default:
{
*red=ClampToQuantum(QuantumRange*brightness);
*green=ClampToQuantum(QuantumRange*t);
*blue=ClampToQuantum(QuantumRange*p);
break;
}
case 1:
{
*red=ClampToQuantum(QuantumRange*q);
*green=ClampToQuantum(QuantumRange*brightness);
*blue=ClampToQuantum(QuantumRange*p);
break;
}
case 2:
{
*red=ClampToQuantum(QuantumRange*p);
*green=ClampToQuantum(QuantumRange*brightness);
*blue=ClampToQuantum(QuantumRange*t);
break;
}
case 3:
{
*red=ClampToQuantum(QuantumRange*p);
*green=ClampToQuantum(QuantumRange*q);
*blue=ClampToQuantum(QuantumRange*brightness);
break;
}
case 4:
{
*red=ClampToQuantum(QuantumRange*t);
*green=ClampToQuantum(QuantumRange*p);
*blue=ClampToQuantum(QuantumRange*brightness);
break;
}
case 5:
{
*red=ClampToQuantum(QuantumRange*brightness);
*green=ClampToQuantum(QuantumRange*p);
*blue=ClampToQuantum(QuantumRange*q);
break;
}
}
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% C o n v e r t H S L T o R G B %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ConvertHSLToRGB() transforms a (hue, saturation, lightness) to a (red,
% green, blue) triple.
%
% The format of the ConvertHSLToRGBImage method is:
%
% void ConvertHSLToRGB(const double hue,const double saturation,
% const double lightness,Quantum *red,Quantum *green,Quantum *blue)
%
% A description of each parameter follows:
%
% o hue, saturation, lightness: A double value representing a
% component of the HSL color space.
%
% o red, green, blue: A pointer to a pixel component of type Quantum.
%
*/
static inline double ConvertHueToRGB(double m1,double m2,double hue)
{
if (hue < 0.0)
hue+=1.0;
if (hue > 1.0)
hue-=1.0;
if ((6.0*hue) < 1.0)
return(m1+6.0*(m2-m1)*hue);
if ((2.0*hue) < 1.0)
return(m2);
if ((3.0*hue) < 2.0)
return(m1+6.0*(m2-m1)*(2.0/3.0-hue));
return(m1);
}
MagickExport void ConvertHSLToRGB(const double hue,const double saturation,
const double lightness,Quantum *red,Quantum *green,Quantum *blue)
{
double
b,
g,
r,
m1,
m2;
/*
Convert HSL to RGB colorspace.
*/
assert(red != (Quantum *) NULL);
assert(green != (Quantum *) NULL);
assert(blue != (Quantum *) NULL);
if (saturation == 0)
{
*red=ClampToQuantum(QuantumRange*lightness);
*green=(*red);
*blue=(*red);
return;
}
if (lightness < 0.5)
m2=lightness*(saturation+1.0);
else
m2=(lightness+saturation)-(lightness*saturation);
m1=2.0*lightness-m2;
r=ConvertHueToRGB(m1,m2,hue+1.0/3.0);
g=ConvertHueToRGB(m1,m2,hue);
b=ConvertHueToRGB(m1,m2,hue-1.0/3.0);
*red=ClampToQuantum(QuantumRange*r);
*green=ClampToQuantum(QuantumRange*g);
*blue=ClampToQuantum(QuantumRange*b);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% C o n v e r t H W B T o R G B %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ConvertHWBToRGB() transforms a (hue, whiteness, blackness) to a (red, green,
% blue) triple.
%
% The format of the ConvertHWBToRGBImage method is:
%
% void ConvertHWBToRGB(const double hue,const double whiteness,
% const double blackness,Quantum *red,Quantum *green,Quantum *blue)
%
% A description of each parameter follows:
%
% o hue, whiteness, blackness: A double value representing a
% component of the HWB color space.
%
% o red, green, blue: A pointer to a pixel component of type Quantum.
%
*/
MagickExport void ConvertHWBToRGB(const double hue,const double whiteness,
const double blackness,Quantum *red,Quantum *green,Quantum *blue)
{
double
b,
f,
g,
n,
r,
v;
register ssize_t
i;
/*
Convert HWB to RGB colorspace.
*/
assert(red != (Quantum *) NULL);
assert(green != (Quantum *) NULL);
assert(blue != (Quantum *) NULL);
v=1.0-blackness;
if (hue == -1.0)
{
*red=ClampToQuantum(QuantumRange*v);
*green=ClampToQuantum(QuantumRange*v);
*blue=ClampToQuantum(QuantumRange*v);
return;
}
i=(ssize_t) floor(6.0*hue);
f=6.0*hue-i;
if ((i & 0x01) != 0)
f=1.0-f;
n=whiteness+f*(v-whiteness); /* linear interpolation */
switch (i)
{
default:
case 6:
case 0: r=v; g=n; b=whiteness; break;
case 1: r=n; g=v; b=whiteness; break;
case 2: r=whiteness; g=v; b=n; break;
case 3: r=whiteness; g=n; b=v; break;
case 4: r=n; g=whiteness; b=v; break;
case 5: r=v; g=whiteness; b=n; break;
}
*red=ClampToQuantum(QuantumRange*r);
*green=ClampToQuantum(QuantumRange*g);
*blue=ClampToQuantum(QuantumRange*b);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% C o n v e r t R G B T o H C L %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ConvertRGBToHCL() transforms a (red, green, blue) to a (hue, chroma,
% luma) triple.
%
% The format of the ConvertRGBToHCL method is:
%
% void ConvertRGBToHCL(const Quantum red,const Quantum green,
% const Quantum blue,double *hue,double *chroma,double *luma)
%
% A description of each parameter follows:
%
% o red, green, blue: A Quantum value representing the red, green, and
% blue component of a pixel.
%
% o hue, chroma, luma: A pointer to a double value representing a
% component of the HCL color space.
%
*/
static inline double MagickMax(const double x,const double y)
{
if (x > y)
return(x);
return(y);
}
static inline double MagickMin(const double x,const double y)
{
if (x < y)
return(x);
return(y);
}
MagickExport void ConvertRGBToHCL(const Quantum red,const Quantum green,
const Quantum blue,double *hue,double *chroma,double *luma)
{
double
b,
c,
g,
h,
max,
r;
/*
Convert RGB to HCL colorspace.
*/
assert(hue != (double *) NULL);
assert(chroma != (double *) NULL);
assert(luma != (double *) NULL);
r=(double) red;
g=(double) green;
b=(double) blue;
max=MagickMax(r,MagickMax(g,b));
c=max-(double) MagickMin(r,MagickMin(g,b));
h=0.0;
if (c == 0.0)
h=0.0;
else
if (red == (Quantum) max)
h=fmod((g-b)/c+6.0,6.0);
else
if (green == (Quantum) max)
h=((b-r)/c)+2.0;
else
if (blue == (Quantum) max)
h=((r-g)/c)+4.0;
*hue=(h/6.0);
*chroma=QuantumScale*c;
*luma=QuantumScale*(0.298839f*r+0.586811f*g+0.114350f*b);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% C o n v e r t R G B T o H S B %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ConvertRGBToHSB() transforms a (red, green, blue) to a (hue, saturation,
% brightness) triple.
%
% The format of the ConvertRGBToHSB method is:
%
% void ConvertRGBToHSB(const Quantum red,const Quantum green,
% const Quantum blue,double *hue,double *saturation,double *brightness)
%
% A description of each parameter follows:
%
% o red, green, blue: A Quantum value representing the red, green, and
% blue component of a pixel..
%
% o hue, saturation, brightness: A pointer to a double value representing a
% component of the HSB color space.
%
*/
MagickExport void ConvertRGBToHSB(const Quantum red,const Quantum green,
const Quantum blue,double *hue,double *saturation,double *brightness)
{
double
b,
delta,
g,
max,
min,
r;
/*
Convert RGB to HSB colorspace.
*/
assert(hue != (double *) NULL);
assert(saturation != (double *) NULL);
assert(brightness != (double *) NULL);
*hue=0.0;
*saturation=0.0;
*brightness=0.0;
r=(double) red;
g=(double) green;
b=(double) blue;
min=r < g ? r : g;
if (b < min)
min=b;
max=r > g ? r : g;
if (b > max)
max=b;
if (max == 0.0)
return;
delta=max-min;
*saturation=delta/max;
*brightness=QuantumScale*max;
if (delta == 0.0)
return;
if (r == max)
*hue=(g-b)/delta;
else
if (g == max)
*hue=2.0+(b-r)/delta;
else
*hue=4.0+(r-g)/delta;
*hue/=6.0;
if (*hue < 0.0)
*hue+=1.0;
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% C o n v e r t R G B T o H S L %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ConvertRGBToHSL() transforms a (red, green, blue) to a (hue, saturation,
% lightness) triple.
%
% The format of the ConvertRGBToHSL method is:
%
% void ConvertRGBToHSL(const Quantum red,const Quantum green,
% const Quantum blue,double *hue,double *saturation,double *lightness)
%
% A description of each parameter follows:
%
% o red, green, blue: A Quantum value representing the red, green, and
% blue component of a pixel..
%
% o hue, saturation, lightness: A pointer to a double value representing a
% component of the HSL color space.
%
*/
MagickExport void ConvertRGBToHSL(const Quantum red,const Quantum green,
const Quantum blue,double *hue,double *saturation,double *lightness)
{
double
b,
delta,
g,
max,
min,
r;
/*
Convert RGB to HSL colorspace.
*/
assert(hue != (double *) NULL);
assert(saturation != (double *) NULL);
assert(lightness != (double *) NULL);
r=QuantumScale*red;
g=QuantumScale*green;
b=QuantumScale*blue;
max=MagickMax(r,MagickMax(g,b));
min=MagickMin(r,MagickMin(g,b));
*lightness=(double) ((min+max)/2.0);
delta=max-min;
if (delta == 0.0)
{
*hue=0.0;
*saturation=0.0;
return;
}
if (*lightness < 0.5)
*saturation=(double) (delta/(min+max));
else
*saturation=(double) (delta/(2.0-max-min));
if (r == max)
*hue=((((max-b)/6.0)+(delta/2.0))-(((max-g)/6.0)+(delta/2.0)))/delta;
else
if (g == max)
*hue=(1.0/3.0)+((((max-r)/6.0)+(delta/2.0))-(((max-b)/6.0)+(delta/2.0)))/
delta;
else
if (b == max)
*hue=(2.0/3.0)+((((max-g)/6.0)+(delta/2.0))-(((max-r)/6.0)+
(delta/2.0)))/delta;
if (*hue < 0.0)
*hue+=1.0;
if (*hue > 1.0)
*hue-=1.0;
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% C o n v e r t R G B T o H W B %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ConvertRGBToHWB() transforms a (red, green, blue) to a (hue, whiteness,
% blackness) triple.
%
% The format of the ConvertRGBToHWB method is:
%
% void ConvertRGBToHWB(const Quantum red,const Quantum green,
% const Quantum blue,double *hue,double *whiteness,double *blackness)
%
% A description of each parameter follows:
%
% o red, green, blue: A Quantum value representing the red, green, and
% blue component of a pixel.
%
% o hue, whiteness, blackness: A pointer to a double value representing a
% component of the HWB color space.
%
*/
MagickExport void ConvertRGBToHWB(const Quantum red,const Quantum green,
const Quantum blue,double *hue,double *whiteness,double *blackness)
{
double
b,
f,
g,
p,
r,
v,
w;
/*
Convert RGB to HWB colorspace.
*/
assert(hue != (double *) NULL);
assert(whiteness != (double *) NULL);
assert(blackness != (double *) NULL);
r=(double) red;
g=(double) green;
b=(double) blue;
w=MagickMin(r,MagickMin(g,b));
v=MagickMax(r,MagickMax(g,b));
*blackness=1.0-QuantumScale*v;
*whiteness=QuantumScale*w;
if (v == w)
{
*hue=(-1.0);
return;
}
f=(r == w) ? g-b : ((g == w) ? b-r : r-g);
p=(r == w) ? 3.0 : ((g == w) ? 5.0 : 1.0);
*hue=(p-f/(v-1.0*w))/6.0;
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% E x p a n d A f f i n e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ExpandAffine() computes the affine's expansion factor, i.e. the square root
% of the factor by which the affine transform affects area. In an affine
% transform composed of scaling, rotation, shearing, and translation, returns
% the amount of scaling.
%
% The format of the ExpandAffine method is:
%
% double ExpandAffine(const AffineMatrix *affine)
%
% A description of each parameter follows:
%
% o expansion: Method ExpandAffine returns the affine's expansion factor.
%
% o affine: A pointer the affine transform of type AffineMatrix.
%
*/
MagickExport double ExpandAffine(const AffineMatrix *affine)
{
assert(affine != (const AffineMatrix *) NULL);
return(sqrt(fabs(affine->sx*affine->sy-affine->rx*affine->ry)));
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% G e n e r a t e D i f f e r e n t i a l N o i s e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% GenerateDifferentialNoise() generates differentual noise.
%
% The format of the GenerateDifferentialNoise method is:
%
% double GenerateDifferentialNoise(RandomInfo *random_info,
% const Quantum pixel,const NoiseType noise_type,
% const MagickRealType attenuate)
%
% A description of each parameter follows:
%
% o random_info: the random info.
%
% o pixel: noise is relative to this pixel value.
%
% o noise_type: the type of noise.
%
% o attenuate: attenuate the noise.
%
*/
MagickExport double GenerateDifferentialNoise(RandomInfo *random_info,
const Quantum pixel,const NoiseType noise_type,const MagickRealType attenuate)
{
#define SigmaUniform (attenuate*0.015625)
#define SigmaGaussian (attenuate*0.015625)
#define SigmaImpulse (attenuate*0.1)
#define SigmaLaplacian (attenuate*0.0390625)
#define SigmaMultiplicativeGaussian (attenuate*0.5)
#define SigmaPoisson (attenuate*12.5)
#define SigmaRandom (attenuate)
#define TauGaussian (attenuate*0.078125)
double
alpha,
beta,
noise,
sigma;
alpha=GetPseudoRandomValue(random_info);
switch (noise_type)
{
case UniformNoise:
default:
{
noise=(double) (pixel+QuantumRange*SigmaUniform*(alpha-0.5));
break;
}
case GaussianNoise:
{
double
gamma,
tau;
if (alpha == 0.0)
alpha=1.0;
beta=GetPseudoRandomValue(random_info);
gamma=sqrt(-2.0*log(alpha));
sigma=gamma*cos((double) (2.0*MagickPI*beta));
tau=gamma*sin((double) (2.0*MagickPI*beta));
noise=(double) (pixel+sqrt((double) pixel)*SigmaGaussian*sigma+
QuantumRange*TauGaussian*tau);
break;
}
case ImpulseNoise:
{
if (alpha < (SigmaImpulse/2.0))
noise=0.0;
else
if (alpha >= (1.0-(SigmaImpulse/2.0)))
noise=(double) QuantumRange;
else
noise=(double) pixel;
break;
}
case LaplacianNoise:
{
if (alpha <= 0.5)
{
if (alpha <= MagickEpsilon)
noise=(double) (pixel-QuantumRange);
else
noise=(double) (pixel+QuantumRange*SigmaLaplacian*
log(2.0*alpha)+0.5);
break;
}
beta=1.0-alpha;
if (beta <= (0.5*MagickEpsilon))
noise=(double) (pixel+QuantumRange);
else
noise=(double) (pixel-QuantumRange*SigmaLaplacian*log(2.0*beta)+0.5);
break;
}
case MultiplicativeGaussianNoise:
{
sigma=1.0;
if (alpha > MagickEpsilon)
sigma=sqrt(-2.0*log(alpha));
beta=GetPseudoRandomValue(random_info);
noise=(double) (pixel+pixel*SigmaMultiplicativeGaussian*sigma*
cos((double) (2.0*MagickPI*beta))/2.0);
break;
}
case PoissonNoise:
{
double
poisson;
register ssize_t
i;
poisson=exp(-SigmaPoisson*QuantumScale*pixel);
for (i=0; alpha > poisson; i++)
{
beta=GetPseudoRandomValue(random_info);
alpha*=beta;
}
noise=(double) (QuantumRange*i/SigmaPoisson);
break;
}
case RandomNoise:
{
noise=(double) (QuantumRange*SigmaRandom*alpha);
break;
}
}
return(noise);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% G e t O p t i m a l K e r n e l W i d t h %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% GetOptimalKernelWidth() computes the optimal kernel radius for a convolution
% filter. Start with the minimum value of 3 pixels and walk out until we drop
% below the threshold of one pixel numerical accuracy.
%
% The format of the GetOptimalKernelWidth method is:
%
% size_t GetOptimalKernelWidth(const double radius,const double sigma)
%
% A description of each parameter follows:
%
% o radius: the radius of the Gaussian, in pixels, not counting the center
% pixel.
%
% o sigma: the standard deviation of the Gaussian, in pixels.
%
*/
MagickExport size_t GetOptimalKernelWidth1D(const double radius,
const double sigma)
{
double
alpha,
beta,
gamma,
normalize,
value;
register ssize_t
i;
size_t
width;
ssize_t
j;
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
if (radius > MagickEpsilon)
return((size_t) (2.0*ceil(radius)+1.0));
gamma=fabs(sigma);
if (gamma <= MagickEpsilon)
return(3UL);
alpha=PerceptibleReciprocal(2.0*gamma*gamma);
beta=(double) PerceptibleReciprocal(MagickSQ2PI*gamma);
for (width=5; ; )
{
normalize=0.0;
j=(ssize_t) width/2;
for (i=(-j); i <= j; i++)
normalize+=exp(-((double) (i*i))*alpha)*beta;
value=exp(-((double) (j*j))*alpha)*beta/normalize;
if ((value < QuantumScale) || (value < MagickEpsilon))
break;
width+=2;
}
return((size_t) (width-2));
}
MagickExport size_t GetOptimalKernelWidth2D(const double radius,
const double sigma)
{
double
alpha,
beta,
gamma,
normalize,
value;
size_t
width;
ssize_t
j,
u,
v;
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
if (radius > MagickEpsilon)
return((size_t) (2.0*ceil(radius)+1.0));
gamma=fabs(sigma);
if (gamma <= MagickEpsilon)
return(3UL);
alpha=PerceptibleReciprocal(2.0*gamma*gamma);
beta=(double) PerceptibleReciprocal(Magick2PI*gamma*gamma);
for (width=5; ; )
{
normalize=0.0;
j=(ssize_t) width/2;
for (v=(-j); v <= j; v++)
for (u=(-j); u <= j; u++)
normalize+=exp(-((double) (u*u+v*v))*alpha)*beta;
value=exp(-((double) (j*j))*alpha)*beta/normalize;
if ((value < QuantumScale) || (value < MagickEpsilon))
break;
width+=2;
}
return((size_t) (width-2));
}
MagickExport size_t GetOptimalKernelWidth(const double radius,
const double sigma)
{
return(GetOptimalKernelWidth1D(radius,sigma));
}

60
ImageMagick/magick/gem.h Normal file
View file

@ -0,0 +1,60 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore private graphic gems methods.
*/
#ifndef _MAGICKCORE_GEM_PRIVATE_H
#define _MAGICKCORE_GEM_PRIVATE_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#include "magick/fx.h"
#include "magick/random_.h"
extern MagickExport double
ExpandAffine(const AffineMatrix *),
GenerateDifferentialNoise(RandomInfo *,const Quantum,const NoiseType,
const MagickRealType);
extern MagickExport size_t
GetOptimalKernelWidth(const double,const double),
GetOptimalKernelWidth1D(const double,const double),
GetOptimalKernelWidth2D(const double,const double);
extern MagickExport void
ConvertHCLToRGB(const double,const double,const double,Quantum *,Quantum *,
Quantum *),
ConvertHSBToRGB(const double,const double,const double,Quantum *,Quantum *,
Quantum *),
ConvertHSLToRGB(const double,const double,const double,Quantum *,Quantum *,
Quantum *),
ConvertHWBToRGB(const double,const double,const double,Quantum *,Quantum *,
Quantum *),
ConvertRGBToHCL(const Quantum,const Quantum,const Quantum,double *,double *,
double *),
ConvertRGBToHSB(const Quantum,const Quantum,const Quantum,double *,double *,
double *),
ConvertRGBToHSL(const Quantum,const Quantum,const Quantum,double *,double *,
double *),
ConvertRGBToHWB(const Quantum,const Quantum,const Quantum,double *,double *,
double *);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,161 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore image geometry methods.
*/
#ifndef _MAGICKCORE_GEOMETRY_H
#define _MAGICKCORE_GEOMETRY_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
typedef enum
{
#undef NoValue
NoValue = 0x0000,
#undef XValue
XValue = 0x0001,
XiValue = 0x0001,
#undef YValue
YValue = 0x0002,
PsiValue = 0x0002,
#undef WidthValue
WidthValue = 0x0004,
RhoValue = 0x0004,
#undef HeightValue
HeightValue = 0x0008,
SigmaValue = 0x0008,
ChiValue = 0x0010,
XiNegative = 0x0020,
#undef XNegative
XNegative = 0x0020,
PsiNegative = 0x0040,
#undef YNegative
YNegative = 0x0040,
ChiNegative = 0x0080,
PercentValue = 0x1000, /* '%' percentage of something */
AspectValue = 0x2000, /* '!' resize no-aspect - special use flag */
NormalizeValue = 0x2000, /* '!' ScaleKernelValue() in morphology.c */
LessValue = 0x4000, /* '<' resize smaller - special use flag */
GreaterValue = 0x8000, /* '>' resize larger - spacial use flag */
MinimumValue = 0x10000, /* '^' special handling needed */
CorrelateNormalizeValue = 0x10000, /* '^' see ScaleKernelValue() */
AreaValue = 0x20000, /* '@' resize to area - special use flag */
DecimalValue = 0x40000, /* '.' floating point numbers found */
SeparatorValue = 0x80000, /* 'x' separator found */
#undef AllValues
AllValues = 0x7fffffff
} GeometryFlags;
#if defined(ForgetGravity)
#undef ForgetGravity
#undef NorthWestGravity
#undef NorthGravity
#undef NorthEastGravity
#undef WestGravity
#undef CenterGravity
#undef EastGravity
#undef SouthWestGravity
#undef SouthGravity
#undef SouthEastGravity
#undef StaticGravity
#endif
typedef enum
{
UndefinedGravity,
ForgetGravity = 0,
NorthWestGravity = 1,
NorthGravity = 2,
NorthEastGravity = 3,
WestGravity = 4,
CenterGravity = 5,
EastGravity = 6,
SouthWestGravity = 7,
SouthGravity = 8,
SouthEastGravity = 9,
StaticGravity = 10
} GravityType;
typedef struct _AffineMatrix
{
double
sx,
rx,
ry,
sy,
tx,
ty;
} AffineMatrix;
typedef struct _GeometryInfo
{
double
rho,
sigma,
xi,
psi,
chi;
} GeometryInfo;
typedef struct _OffsetInfo
{
ssize_t
x,
y;
} OffsetInfo;
typedef struct _RectangleInfo
{
size_t
width,
height;
ssize_t
x,
y;
} RectangleInfo;
extern MagickExport char
*GetPageGeometry(const char *);
extern MagickExport MagickBooleanType
IsGeometry(const char *),
IsSceneGeometry(const char *,const MagickBooleanType);
extern MagickExport MagickStatusType
GetGeometry(const char *,ssize_t *,ssize_t *,size_t *,size_t *),
ParseAbsoluteGeometry(const char *,RectangleInfo *),
ParseAffineGeometry(const char *,AffineMatrix *,ExceptionInfo *),
ParseGeometry(const char *,GeometryInfo *),
ParseGravityGeometry(const Image *,const char *,RectangleInfo *,
ExceptionInfo *),
ParseMetaGeometry(const char *,ssize_t *,ssize_t *,size_t *,size_t *),
ParsePageGeometry(const Image *,const char *,RectangleInfo *,ExceptionInfo *),
ParseRegionGeometry(const Image *,const char *,RectangleInfo *,
ExceptionInfo *);
extern MagickExport void
GravityAdjustGeometry(const size_t,const size_t,
const GravityType,RectangleInfo *),
SetGeometry(const Image *,RectangleInfo *),
SetGeometryInfo(GeometryInfo *);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

1982
ImageMagick/magick/hashmap.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,83 @@
/*
Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MagickCore hash methods.
*/
#ifndef _MAGICKCORE_HASHMAP_H
#define _MAGICKCORE_HASHMAP_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#define SmallHashmapSize 17
#define MediumHashmapSize 509
#define LargeHashmapSize 8191
#define HugeHashmapSize 131071
typedef struct _HashmapInfo
HashmapInfo;
typedef struct _LinkedListInfo
LinkedListInfo;
extern MagickExport HashmapInfo
*DestroyHashmap(HashmapInfo *),
*NewHashmap(const size_t,size_t (*)(const void *),MagickBooleanType (*)
(const void *,const void *),void *(*)(void *),void *(*)(void *));
extern MagickExport LinkedListInfo
*DestroyLinkedList(LinkedListInfo *,void *(*)(void *)),
*NewLinkedList(const size_t);
extern MagickExport MagickBooleanType
AppendValueToLinkedList(LinkedListInfo *,const void *),
CompareHashmapString(const void *,const void *),
CompareHashmapStringInfo(const void *,const void *),
InsertValueInLinkedList(LinkedListInfo *,const size_t,const void *),
InsertValueInSortedLinkedList(LinkedListInfo *,
int (*)(const void *,const void *),void **,const void *),
IsHashmapEmpty(const HashmapInfo *),
IsLinkedListEmpty(const LinkedListInfo *),
LinkedListToArray(LinkedListInfo *,void **),
PutEntryInHashmap(HashmapInfo *,const void *,const void *);
extern MagickExport size_t
GetNumberOfElementsInLinkedList(const LinkedListInfo *),
GetNumberOfEntriesInHashmap(const HashmapInfo *),
HashPointerType(const void *),
HashStringType(const void *),
HashStringInfoType(const void *);
extern MagickExport void
ClearLinkedList(LinkedListInfo *,void *(*)(void *)),
*GetLastValueInLinkedList(LinkedListInfo *),
*GetNextKeyInHashmap(HashmapInfo *),
*GetNextValueInHashmap(HashmapInfo *),
*GetNextValueInLinkedList(LinkedListInfo *),
*GetValueFromHashmap(HashmapInfo *,const void *),
*GetValueFromLinkedList(LinkedListInfo *,const size_t),
*RemoveElementByValueFromLinkedList(LinkedListInfo *,const void *),
*RemoveElementFromLinkedList(LinkedListInfo *,const size_t),
*RemoveEntryFromHashmap(HashmapInfo *,const void *),
*RemoveLastElementFromLinkedList(LinkedListInfo *),
ResetHashmapIterator(HashmapInfo *),
ResetLinkedListIterator(LinkedListInfo *);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif

Some files were not shown because too many files have changed in this diff Show more