Skip to content

Commit

Permalink
add getter/setter for the filter type
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristy committed Nov 30, 2022
1 parent 5bb3d45 commit 44dc2fb
Show file tree
Hide file tree
Showing 4 changed files with 168 additions and 0 deletions.
79 changes: 79 additions & 0 deletions MagickWand/magick-image.c
Expand Up @@ -5074,6 +5074,43 @@ WandExport char *MagickGetImageFilename(MagickWand *wand)
% %
% %
% %
% M a g i c k G e t I m a g e F i l t e r %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% MagickGetImageFilter() gets the image filter.
%
% The format of the MagickGetImageFilter method is:
%
% FilterType MagickGetImageFilter(MagickWand *wand)
%
% A description of each parameter follows:
%
% o wand: the magick wand.
%
*/
WandExport FilterType MagickGetImageFilter(MagickWand *wand)
{
assert(wand != (MagickWand *) NULL);
assert(wand->signature == MagickWandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
if (wand->images == (Image *) NULL)
{
(void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
"ContainsNoImages","`%s'",wand->name);
return(UndefinedFilter);
}
return(wand->images->filter);
}

/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% M a g i c k G e t I m a g e F o r m a t %
% %
% %
Expand Down Expand Up @@ -10465,6 +10502,48 @@ WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
% %
% %
% %
% M a g i c k S e t I m a g e G r a v i t y %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% MagickSetImageFilter() sets the image filter type.
%
% The format of the MagickSetImageFilter method is:
%
% MagickBooleanType MagickSetImageFilter(MagickWand *wand,
% const FilterType filter)
%
% A description of each parameter follows:
%
% o wand: the magick wand.
%
% o filter: Bartlett, Blackman, Bohman, Box, Catrom, Cosine, Cubic,
% CubicSpline, Gaussian, Hamming, Hann, Hermite, Jinc, Kaiser, Lagrange,
% Lanczos, Lanczos2, Lanczos2Sharp, LanczosRadius, LanczosSharp, Mitchell,
% Parzen, Point, Quadratic, Robidoux, RobidouxSharp, Sinc, SincFast,
% Spline, Triangle, Undefined, Welch.
%
*/
WandExport MagickBooleanType MagickSetImageFilter(MagickWand *wand,
const FilterType filter)
{
assert(wand != (MagickWand *) NULL);
assert(wand->signature == MagickWandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
if (wand->images == (Image *) NULL)
ThrowWandException(WandError,"ContainsNoImages",wand->name);
wand->images->filter=filter;
return(MagickTrue);
}

/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% M a g i c k S e t I m a g e F o r m a t %
% %
% %
Expand Down
4 changes: 4 additions & 0 deletions MagickWand/magick-image.h
Expand Up @@ -60,6 +60,9 @@ extern WandExport double
extern WandExport EndianType
MagickGetImageEndian(MagickWand *);

extern WandExport FilterType
MagickGetImageFilter(MagickWand *);

extern WandExport GravityType
MagickGetImageGravity(MagickWand *);

Expand Down Expand Up @@ -280,6 +283,7 @@ extern WandExport MagickBooleanType
MagickSetImageEndian(MagickWand *,const EndianType),
MagickSetImageExtent(MagickWand *,const size_t,const size_t),
MagickSetImageFilename(MagickWand *,const char *),
MagickSetImageFilter(MagickWand *,const FilterType),
MagickSetImageFormat(MagickWand *,const char *),
MagickSetImageFuzz(MagickWand *,const double),
MagickSetImageGamma(MagickWand *,const double),
Expand Down
81 changes: 81 additions & 0 deletions MagickWand/magick-property.c
Expand Up @@ -455,6 +455,47 @@ WandExport char *MagickGetFormat(MagickWand *wand)
% %
% %
% %
% M a g i c k G e t F i l t e r %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% MagickGetFilter() gets the wand filter.
%
% The format of the MagickGetFilter method is:
%
% FilterType MagickGetFilter(MagickWand *wand)
%
% A description of each parameter follows:
%
% o wand: the magick wand.
%
*/
WandExport FilterType MagickGetFilter(MagickWand *wand)
{
const char
*option;

FilterType
type;

assert(wand != (MagickWand *) NULL);
assert(wand->signature == MagickWandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
option=GetImageOption(wand->image_info,"filter");
if (option == (const char *) NULL)
return(UndefinedFilter);
type=(FilterType) ParseCommandOption(MagickFilterOptions,MagickFalse,option);
return(type);
}

/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% M a g i c k G e t G r a v i t y %
% %
% %
Expand Down Expand Up @@ -2170,6 +2211,46 @@ WandExport MagickBooleanType MagickSetFormat(MagickWand *wand,
% %
% %
% %
% M a g i c k S e t F i l t e r %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% MagickSetFilter() sets the filter type.
%
% The format of the MagickSetFilter type is:
%
% MagickBooleanType MagickSetFilter(MagickWand *wand,
% const FilterType type)
%
% A description of each parameter follows:
%
% o wand: the magick wand.
%
% o type: the filter type.
%
*/
WandExport MagickBooleanType MagickSetFilter(MagickWand *wand,
const FilterType type)
{
MagickBooleanType
status;

assert(wand != (MagickWand *) NULL);
assert(wand->signature == MagickWandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
status=SetImageOption(wand->image_info,"filter",CommandOptionToMnemonic(
MagickFilterOptions,(ssize_t) type));
return(status);
}

/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% M a g i c k S e t G r a v i t y %
% %
% %
Expand Down
4 changes: 4 additions & 0 deletions MagickWand/magick-property.h
Expand Up @@ -61,6 +61,9 @@ extern WandExport double
*MagickQueryMultilineFontMetrics(MagickWand *,const DrawingWand *,
const char *);

extern WandExport FilterType
MagickGetFilter(MagickWand *);

extern WandExport GravityType
MagickGetGravity(MagickWand *);

Expand Down Expand Up @@ -94,6 +97,7 @@ extern WandExport MagickBooleanType
MagickSetDepth(MagickWand *,const size_t),
MagickSetExtract(MagickWand *,const char *),
MagickSetFilename(MagickWand *,const char *),
MagickSetFilter(MagickWand *,const FilterType),
MagickSetFormat(MagickWand *,const char *),
MagickSetFont(MagickWand *,const char *),
MagickSetGravity(MagickWand *,const GravityType),
Expand Down

0 comments on commit 44dc2fb

Please sign in to comment.