MagickCore 6.9.12
fx.c File Reference
#include "magick/studio.h"
#include "magick/accelerate-private.h"
#include "magick/annotate.h"
#include "magick/artifact.h"
#include "magick/attribute.h"
#include "magick/cache.h"
#include "magick/cache-view.h"
#include "magick/channel.h"
#include "magick/color.h"
#include "magick/color-private.h"
#include "magick/colorspace.h"
#include "magick/colorspace-private.h"
#include "magick/composite.h"
#include "magick/decorate.h"
#include "magick/distort.h"
#include "magick/draw.h"
#include "magick/effect.h"
#include "magick/enhance.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/layer.h"
#include "magick/list.h"
#include "magick/log.h"
#include "magick/image.h"
#include "magick/image-private.h"
#include "magick/magick.h"
#include "magick/memory_.h"
#include "magick/memory-private.h"
#include "magick/monitor.h"
#include "magick/monitor-private.h"
#include "magick/opencl-private.h"
#include "magick/option.h"
#include "magick/pixel-accessor.h"
#include "magick/pixel-private.h"
#include "magick/property.h"
#include "magick/quantum.h"
#include "magick/quantum-private.h"
#include "magick/random_.h"
#include "magick/random-private.h"
#include "magick/resample.h"
#include "magick/resample-private.h"
#include "magick/resize.h"
#include "magick/resource_.h"
#include "magick/splay-tree.h"
#include "magick/statistic.h"
#include "magick/string_.h"
#include "magick/string-private.h"
#include "magick/thread-private.h"
#include "magick/threshold.h"
#include "magick/token.h"
#include "magick/transform.h"
#include "magick/utility.h"
Include dependency graph for fx.c:

Go to the source code of this file.

Data Structures

struct  _FxInfo
 

Macros

#define FxMaxFunctionDepth   200
 
#define FxMaxParenthesisDepth   58
 
#define FxMaxSubexpressionDepth   200
 
#define FxReturn(value)
 
#define FxParseConditional(subexpression, sentinal, p, q)
 
#define FxImageTag   "Fx/Image"
 

Enumerations

enum  FxOperator {
  BitwiseAndAssignmentOperator = 0xd9U , BitwiseOrAssignmentOperator , LeftShiftAssignmentOperator , RightShiftAssignmentOperator ,
  PowerAssignmentOperator , ModuloAssignmentOperator , PlusAssignmentOperator , SubtractAssignmentOperator ,
  MultiplyAssignmentOperator , DivideAssignmentOperator , IncrementAssignmentOperator , DecrementAssignmentOperator ,
  LeftShiftOperator , RightShiftOperator , LessThanEqualOperator , GreaterThanEqualOperator ,
  EqualOperator , NotEqualOperator , LogicalAndOperator , LogicalOrOperator ,
  ExponentialNotation
}
 

Functions

MagickExport FxInfoAcquireFxInfo (const Image *images, const char *expression)
 
MagickExport FxInfoDestroyFxInfo (FxInfo *fx_info)
 
static const double * GetFxSymbolValue (FxInfo *fx_info, const char *symbol)
 
static MagickBooleanType SetFxSymbolValue (FxInfo *magick_restrict fx_info, const char *magick_restrict symbol, const double value)
 
static double FxChannelStatistics (FxInfo *fx_info, const Image *image, ChannelType channel, const char *symbol, ExceptionInfo *exception)
 
static double FxEvaluateSubexpression (FxInfo *, const ChannelType, const ssize_t, const ssize_t, const char *, const size_t, double *, ExceptionInfo *)
 
static MagickBooleanType IsFxFunction (const char *expression, const char *name, const size_t length)
 
static double FxGCD (const double alpha, const double beta, const size_t depth)
 
static const char * FxSubexpression (const char *expression, ExceptionInfo *exception)
 
static double FxGetSymbol (FxInfo *fx_info, const ChannelType channel, const ssize_t x, const ssize_t y, const char *expression, const size_t depth, ExceptionInfo *exception)
 
static const char * FxOperatorPrecedence (const char *expression, ExceptionInfo *exception)
 
MagickExport MagickBooleanType FxEvaluateExpression (FxInfo *fx_info, double *alpha, ExceptionInfo *exception)
 
MagickExport MagickBooleanType FxPreprocessExpression (FxInfo *fx_info, double *alpha, ExceptionInfo *exception)
 
MagickExport MagickBooleanType FxEvaluateChannelExpression (FxInfo *fx_info, const ChannelType channel, const ssize_t x, const ssize_t y, double *alpha, ExceptionInfo *exception)
 
static FxInfo ** DestroyFxTLS (FxInfo **fx_info)
 
static FxInfo ** AcquireFxTLS (const Image *image, const char *expression, ExceptionInfo *exception)
 
MagickExport ImageFxImage (const Image *image, const char *expression, ExceptionInfo *exception)
 
MagickExport ImageFxImageChannel (const Image *image, const ChannelType channel, const char *expression, ExceptionInfo *exception)
 

Macro Definition Documentation

◆ FxImageTag

#define FxImageTag   "Fx/Image"

◆ FxMaxFunctionDepth

#define FxMaxFunctionDepth   200

◆ FxMaxParenthesisDepth

#define FxMaxParenthesisDepth   58

◆ FxMaxSubexpressionDepth

#define FxMaxSubexpressionDepth   200

◆ FxParseConditional

#define FxParseConditional (   subexpression,
  sentinal,
  p,
 
)
Value:
{ \
p=subexpression; \
for (q=(char *) p; (*q != (sentinal)) && (*q != '\0'); q++) \
if (*q == '(') \
{ \
for (q++; (*q != ')') && (*q != '\0'); q++); \
if (*q == '\0') \
break; \
} \
if (*q == '\0') \
{ \
(void) ThrowMagickException(exception,GetMagickModule(), \
OptionError,"UnableToParseExpression","`%s'",subexpression); \
FxReturn(0.0); \
} \
if (strlen(q) == 1) \
*(q+1)='\0'; \
*q='\0'; \
}
MagickExport MagickBooleanType ThrowMagickException(ExceptionInfo *exception, const char *module, const char *function, const size_t line, const ExceptionType severity, const char *tag, const char *format,...)
Definition: exception.c:1149
@ OptionError
Definition: exception.h:57
#define GetMagickModule()
Definition: log.h:29

◆ FxReturn

#define FxReturn (   value)
Value:
{ \
subexpression=DestroyString(subexpression); \
return(value); \
}
MagickExport char * DestroyString(char *string)
Definition: string.c:821

Enumeration Type Documentation

◆ FxOperator

enum FxOperator
Enumerator
BitwiseAndAssignmentOperator 
BitwiseOrAssignmentOperator 
LeftShiftAssignmentOperator 
RightShiftAssignmentOperator 
PowerAssignmentOperator 
ModuloAssignmentOperator 
PlusAssignmentOperator 
SubtractAssignmentOperator 
MultiplyAssignmentOperator 
DivideAssignmentOperator 
IncrementAssignmentOperator 
DecrementAssignmentOperator 
LeftShiftOperator 
RightShiftOperator 
LessThanEqualOperator 
GreaterThanEqualOperator 
EqualOperator 
NotEqualOperator 
LogicalAndOperator 
LogicalOrOperator 
ExponentialNotation 

Definition at line 103 of file fx.c.

Function Documentation

◆ AcquireFxInfo()

◆ AcquireFxTLS()

◆ DestroyFxInfo()

◆ DestroyFxTLS()

static FxInfo ** DestroyFxTLS ( FxInfo **  fx_info)
static

◆ FxChannelStatistics()

static double FxChannelStatistics ( FxInfo fx_info,
const Image image,
ChannelType  channel,
const char *  symbol,
ExceptionInfo exception 
)
static

◆ FxEvaluateChannelExpression()

MagickExport MagickBooleanType FxEvaluateChannelExpression ( FxInfo fx_info,
const ChannelType  channel,
const ssize_t  x,
const ssize_t  y,
double *  alpha,
ExceptionInfo exception 
)

◆ FxEvaluateExpression()

MagickExport MagickBooleanType FxEvaluateExpression ( FxInfo fx_info,
double *  alpha,
ExceptionInfo exception 
)

Definition at line 2653 of file fx.c.

References FxEvaluateChannelExpression(), and GrayChannel.

◆ FxEvaluateSubexpression()

static double FxEvaluateSubexpression ( FxInfo fx_info,
const ChannelType  channel,
const ssize_t  x,
const ssize_t  y,
const char *  expression,
const size_t  depth,
double *  beta,
ExceptionInfo exception 
)
static

Definition at line 1418 of file fx.c.

References AcquireString(), AlphaChannel, BitwiseAndAssignmentOperator, BitwiseOrAssignmentOperator, BlackChannel, BlueChannel, ClearMagickException(), CMYKColorspace, _Image::colorspace, CopyMagickString(), CyanChannel, DecrementAssignmentOperator, DivideAssignmentOperator, EqualOperator, ErrorException, ExponentialNotation, _FxInfo::file, _Image::filename, FormatLocaleFile(), FxEvaluateSubexpression(), FxGCD(), FxGetSymbol(), FxMaxParenthesisDepth, FxMaxSubexpressionDepth, FxOperatorPrecedence(), FxParseConditional, FxReturn, GetMagickModule, GetMagickPrecision(), GetPseudoRandomValue(), GRAYColorspace, GreaterThanEqualOperator, GreenChannel, _FxInfo::images, IncrementAssignmentOperator, InterpretSiPrefixValue(), IsFxFunction(), IsNaN, LeftShiftAssignmentOperator, LeftShiftOperator, LessThanEqualOperator, LocaleCompare(), LocaleNCompare(), LogicalAndOperator, LogicalOrOperator, MagentaChannel, MagickEpsilon, MagickFalse, MagickPathExtent, MagickPHI, MagickPI, MaxTextExtent, ModuloAssignmentOperator, MultiplyAssignmentOperator, NotEqualOperator, OptionError, PerceptibleReciprocal(), PlusAssignmentOperator, PowerAssignmentOperator, QuantumRange, QuantumScale, _FxInfo::random_info, RedChannel, RightShiftAssignmentOperator, RightShiftOperator, SetFxSymbolValue(), _ExceptionInfo::severity, SubtractAssignmentOperator, ThrowMagickException(), and YellowChannel.

Referenced by FxEvaluateChannelExpression(), FxEvaluateSubexpression(), and FxGetSymbol().

◆ FxGCD()

static double FxGCD ( const double  alpha,
const double  beta,
const size_t  depth 
)
inlinestatic

Definition at line 503 of file fx.c.

References FxGCD(), and FxMaxFunctionDepth.

Referenced by FxEvaluateSubexpression(), and FxGCD().

◆ FxGetSymbol()

static double FxGetSymbol ( FxInfo fx_info,
const ChannelType  channel,
const ssize_t  x,
const ssize_t  y,
const char *  expression,
const size_t  depth,
ExceptionInfo exception 
)
static

Definition at line 542 of file fx.c.

References AcquireString(), AddValueToSplayTree(), BlackChannel, _MagickPixelPacket::blue, BlueChannel, _GeometryInfo::chi, ChiValue, ClampToQuantum(), CloneMagickPixelPacket(), CMYKColorspace, _FxInfo::colors, _Image::colorspace, _Image::columns, ConstantString(), ConvertRGBToHSL(), CopyMagickString(), CyanChannel, DefaultChannels, DestroyString(), _FxInfo::exception, _Image::extent, _Image::filename, FxChannelStatistics(), FxEvaluateSubexpression(), GetBlobSize(), GetFxSymbolValue(), GetImageArtifact(), GetImageChannelDepth(), GetImageFromList(), GetImageIndexInList(), GetImageListLength(), GetMagickModule, GetMagickPixelIntensity(), GetMagickPixelPacket(), GetPixelAlpha, GetValueFromSplayTree(), _MagickPixelPacket::green, GreenChannel, _RectangleInfo::height, ImageError, _FxInfo::images, _MagickPixelPacket::index, IndexChannel, _Image::interpolate, InterpolateMagickPixelPacket(), IsFxFunction(), LocaleCompare(), LocaleNCompare(), MagentaChannel, MagickFalse, _MagickPixelPacket::matte, MaxTextExtent, _MagickPixelPacket::opacity, OpacityChannel, OptionError, _Image::page, ParseGeometry(), PerceptibleReciprocal(), _GeometryInfo::psi, PsiValue, _Image::quality, QuantumScale, QueryMagickColor(), _MagickPixelPacket::red, RedChannel, _GeometryInfo::rho, RhoValue, _Image::rows, SetFxSymbolValue(), _GeometryInfo::sigma, SigmaValue, StringToDouble(), StripString(), ThrowMagickException(), _FxInfo::view, _RectangleInfo::width, _PointInfo::x, _RectangleInfo::x, _Image::x_resolution, _GeometryInfo::xi, XiValue, _PointInfo::y, _RectangleInfo::y, _Image::y_resolution, and YellowChannel.

Referenced by FxEvaluateSubexpression().

◆ FxImage()

MagickExport Image * FxImage ( const Image image,
const char *  expression,
ExceptionInfo exception 
)

Definition at line 2786 of file fx.c.

References FxImageChannel(), and GrayChannel.

◆ FxImageChannel()

◆ FxOperatorPrecedence()

◆ FxPreprocessExpression()

MagickExport MagickBooleanType FxPreprocessExpression ( FxInfo fx_info,
double *  alpha,
ExceptionInfo exception 
)

Definition at line 2663 of file fx.c.

References _FxInfo::file, FxEvaluateChannelExpression(), and GrayChannel.

Referenced by AcquireFxTLS().

◆ FxSubexpression()

static const char * FxSubexpression ( const char *  expression,
ExceptionInfo exception 
)
inlinestatic

Definition at line 515 of file fx.c.

References GetMagickModule, OptionError, and ThrowMagickException().

Referenced by FxOperatorPrecedence().

◆ GetFxSymbolValue()

static const double * GetFxSymbolValue ( FxInfo fx_info,
const char *  symbol 
)
inlinestatic

Definition at line 345 of file fx.c.

References GetValueFromSplayTree(), and _FxInfo::symbols.

Referenced by FxChannelStatistics(), and FxGetSymbol().

◆ IsFxFunction()

static MagickBooleanType IsFxFunction ( const char *  expression,
const char *  name,
const size_t  length 
)
inlinestatic

Definition at line 484 of file fx.c.

References LocaleNCompare(), MagickFalse, and MagickTrue.

Referenced by FxEvaluateSubexpression(), FxGetSymbol(), and FxOperatorPrecedence().

◆ SetFxSymbolValue()

static MagickBooleanType SetFxSymbolValue ( FxInfo *magick_restrict  fx_info,
const char *magick_restrict  symbol,
const double  value 
)
inlinestatic