Options.cpp
Go to the documentation of this file.
// This may look like C code, but it is really -*- C++ -*-
//
// Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002, 2003
//
// Copyright @ 2014 ImageMagick Studio LLC, a non-profit organization
// dedicated to making software imaging solutions freely available.
//
// Implementation of Options
//
// A wrapper around DrawInfo, ImageInfo, and QuantizeInfo
//
#define MAGICKCORE_IMPLEMENTATION 1
#define MAGICK_PLUSPLUS_IMPLEMENTATION 1
#include "Magick++/Include.h"
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include "Magick++/Options.h"
#include "Magick++/Functions.h"
#include "Magick++/Exception.h"
#define MagickPI 3.14159265358979323846264338327950288419716939937510
#define DegreesToRadians(x) (MagickPI*(x)/180.0)
Magick::Options::Options(void)
: _imageInfo(static_cast<ImageInfo*>(AcquireMagickMemory(
sizeof(ImageInfo)))),
_quantizeInfo(static_cast<QuantizeInfo*>(AcquireMagickMemory(
sizeof(QuantizeInfo)))),
_drawInfo(static_cast<DrawInfo*>(AcquireMagickMemory(sizeof(DrawInfo)))),
_quiet(false)
{
// Initialize image info with defaults
GetImageInfo(_imageInfo);
// Initialize quantization info
GetQuantizeInfo(_quantizeInfo);
// Initialize drawing info
GetDrawInfo(_imageInfo,_drawInfo);
}
Magick::Options::Options(const Options& options_)
: _imageInfo(CloneImageInfo(options_._imageInfo)),
_quantizeInfo(CloneQuantizeInfo(options_._quantizeInfo)),
_drawInfo(CloneDrawInfo(_imageInfo,options_._drawInfo)),
_quiet(options_._quiet)
{
}
Magick::Options::~Options()
{
// Destroy image info
_imageInfo=DestroyImageInfo(_imageInfo);
// Destroy quantization info
_quantizeInfo=DestroyQuantizeInfo(_quantizeInfo);
// Destroy drawing info
_drawInfo=DestroyDrawInfo(_drawInfo);
}
void Magick::Options::adjoin(const bool flag_)
{
_imageInfo->adjoin=static_cast<MagickBooleanType>(
flag_ ? MagickTrue : MagickFalse);
}
bool Magick::Options::adjoin(void) const
{
return(static_cast<bool>(_imageInfo->adjoin));
}
void Magick::Options::matteColor(const Color &matteColor_)
{
_imageInfo->matte_color=matteColor_;
}
Magick::Color Magick::Options::matteColor(void) const
{
return(Magick::Color(_imageInfo->matte_color));
}
void Magick::Options::backgroundColor(const Color &color_)
{
_imageInfo->background_color=color_;
}
Magick::Color Magick::Options::backgroundColor(void) const
{
return(Color(_imageInfo->background_color));
}
void Magick::Options::backgroundTexture(const std::string &backgroundTexture_)
{
if (backgroundTexture_.length() == 0)
_imageInfo->texture=(char *) RelinquishMagickMemory(_imageInfo->texture);
else
Magick::CloneString(&_imageInfo->texture,backgroundTexture_);
}
std::string Magick::Options::backgroundTexture(void) const
{
if (_imageInfo->texture)
return(std::string(_imageInfo->texture));
else
return(std::string());
}
void Magick::Options::borderColor(const Color &color_)
{
_imageInfo->border_color=color_;
_drawInfo->border_color=color_;
}
Magick::Color Magick::Options::borderColor(void) const
{
return(Color(_imageInfo->border_color));
}
void Magick::Options::boxColor(const Color &boxColor_)
{
_drawInfo->undercolor=boxColor_;
}
Magick::Color Magick::Options::boxColor(void) const
{
return(Color(_drawInfo->undercolor));
}
void Magick::Options::colorspaceType(const ColorspaceType colorspace_)
{
_imageInfo->colorspace=colorspace_;
}
Magick::ColorspaceType Magick::Options::colorspaceType(void) const
{
return(static_cast<Magick::ColorspaceType>(_imageInfo->colorspace));
}
void Magick::Options::compressType(const CompressionType compressType_)
{
_imageInfo->compression=compressType_;
}
Magick::CompressionType Magick::Options::compressType(void) const
{
return(static_cast<Magick::CompressionType>(_imageInfo->compression));
}
void Magick::Options::colorFuzz(const double fuzz_)
{
_imageInfo->fuzz=fuzz_;
}
double Magick::Options::colorFuzz(void) const
{
return(_imageInfo->fuzz);
}
void Magick::Options::debug(const bool flag_)
{
if (flag_)
SetLogEventMask("All");
else
SetLogEventMask("None");
}
bool Magick::Options::debug(void) const
{
if (IsEventLogging())
return(true);
return(false);
}
void Magick::Options::density(const Point &density_)
{
if (!density_.isValid())
_imageInfo->density=(char *) RelinquishMagickMemory(_imageInfo->density);
else
CloneString(&_imageInfo->density,density_);
}
Magick::Point Magick::Options::density(void) const
{
if (_imageInfo->density)
return(Point(_imageInfo->density));
return(Point());
}
void Magick::Options::depth(const size_t depth_)
{
_imageInfo->depth=depth_;
}
size_t Magick::Options::depth(void) const
{
return(_imageInfo->depth);
}
void Magick::Options::endian(const Magick::EndianType endian_)
{
_imageInfo->endian=endian_;
}
Magick::EndianType Magick::Options::endian(void) const
{
return(_imageInfo->endian);
}
void Magick::Options::file(FILE *file_)
{
SetImageInfoFile(_imageInfo,file_);
}
FILE *Magick::Options::file(void) const
{
return(GetImageInfoFile(_imageInfo));
}
void Magick::Options::fileName(const std::string &fileName_)
{
ssize_t
max_length;
max_length=sizeof(_imageInfo->filename)-1;
fileName_.copy(_imageInfo->filename,max_length);
if ((ssize_t) fileName_.length() > max_length)
_imageInfo->filename[max_length]=0;
else
_imageInfo->filename[fileName_.length()]=0;
}
std::string Magick::Options::fileName(void) const
{
return(std::string(_imageInfo->filename));
}
void Magick::Options::fillColor(const Color &fillColor_)
{
_drawInfo->fill=fillColor_;
if (fillColor_ == Color())
fillPattern((const MagickCore::Image*) NULL);
setOption("fill",fillColor_);
}
Magick::Color Magick::Options::fillColor(void) const
{
return(_drawInfo->fill);
}
void Magick::Options::fillPattern(const MagickCore::Image *fillPattern_)
{
if (_drawInfo->fill_pattern)
_drawInfo->fill_pattern=DestroyImageList(_drawInfo->fill_pattern);
if (fillPattern_)
{
GetPPException;
_drawInfo->fill_pattern=CloneImage(const_cast<MagickCore::Image*>(
fillPattern_),0,0,static_cast<MagickBooleanType>(MagickTrue),
exceptionInfo);
ThrowPPException(_quiet);
}
}
const MagickCore::Image *Magick::Options::fillPattern(void) const
{
return(_drawInfo->fill_pattern);
}
void Magick::Options::fillRule(const FillRule &fillRule_)
{
_drawInfo->fill_rule=fillRule_;
}
Magick::FillRule Magick::Options::fillRule(void) const
{
return(_drawInfo->fill_rule);
}
void Magick::Options::font(const std::string &font_)
{
if (font_.length() == 0)
{
_imageInfo->font=(char *) RelinquishMagickMemory(_imageInfo->font);
_drawInfo->font=(char *) RelinquishMagickMemory(_drawInfo->font);
}
else
{
Magick::CloneString(&_imageInfo->font,font_);
Magick::CloneString(&_drawInfo->font,font_);
}
}
std::string Magick::Options::font(void) const
{
if (_imageInfo->font)
return(std::string(_imageInfo->font));
return(std::string());
}
void Magick::Options::fontFamily(const std::string &family_)
{
if (family_.length() == 0)
{
_drawInfo->family=(char *) RelinquishMagickMemory(_drawInfo->font);
DestroyString(RemoveImageOption(imageInfo(),"family"));
}
else
{
Magick::CloneString(&_drawInfo->family,family_);
(void) SetImageOption(imageInfo(),"family",family_.c_str());
}
}
std::string Magick::Options::fontFamily(void) const
{
if (_drawInfo->family)
return(std::string(_drawInfo->family));
return(std::string());
}
void Magick::Options::fontPointsize(const double pointSize_)
{
_imageInfo->pointsize=pointSize_;
_drawInfo->pointsize=pointSize_;
}
double Magick::Options::fontPointsize(void) const
{
return(_imageInfo->pointsize);
}
void Magick::Options::fontStyle(const StyleType style_)
{
_drawInfo->style=style_;
(void) SetImageOption(_imageInfo,"style",CommandOptionToMnemonic(
MagickStyleOptions,(ssize_t) style_));
}
Magick::StyleType Magick::Options::fontStyle(void) const
{
return(_drawInfo->style);
}
void Magick::Options::fontWeight(const size_t weight_)
{
_drawInfo->weight=weight_;
setOption("weight",(double) weight_);
}
size_t Magick::Options::fontWeight(void) const
{
return(_drawInfo->weight);
}
std::string Magick::Options::format(void) const
{
const MagickInfo
*magick_info=0;
GetPPException;
if (*_imageInfo->magick != '\0' )
magick_info = GetMagickInfo(_imageInfo->magick,exceptionInfo);
ThrowPPException(_quiet);
if ((magick_info != 0) && (*magick_info->description != '\0'))
return(std::string( magick_info->description));
return(std::string());
}
void Magick::Options::interlaceType(const InterlaceType interlace_)
{
_imageInfo->interlace=interlace_;
}
Magick::InterlaceType Magick::Options::interlaceType(void) const
{
return(static_cast<Magick::InterlaceType>(_imageInfo->interlace));
}
void Magick::Options::magick(const std::string &magick_)
{
if (magick_.empty())
{
_imageInfo->magick[0] = '\0';
return;
}
FormatLocaleString(_imageInfo->filename,MagickPathExtent,"%.1024s:",
magick_.c_str());
GetPPException;
SetImageInfo(_imageInfo,1,exceptionInfo);
ThrowPPException(_quiet);
if ( _imageInfo->magick[0] == '\0' )
throwExceptionExplicit(MagickCore::OptionError,"Unrecognized image format",
magick_.c_str());
}
std::string Magick::Options::magick(void) const
{
if ( _imageInfo->magick[0] != '\0' )
return(std::string(_imageInfo->magick));
return(std::string());
}
void Magick::Options::monochrome(const bool monochromeFlag_)
{
_imageInfo->monochrome=(MagickBooleanType) monochromeFlag_;
}
bool Magick::Options::monochrome(void) const
{
return(static_cast<bool>(_imageInfo->monochrome));
}
void Magick::Options::page(const Geometry &pageSize_)
{
if (!pageSize_.isValid())
_imageInfo->page=(char *) RelinquishMagickMemory(_imageInfo->page);
else
Magick::CloneString(&_imageInfo->page,pageSize_);
}
Magick::Geometry Magick::Options::page(void) const
{
if (_imageInfo->page)
return(Geometry(_imageInfo->page));
return(Geometry());
}
void Magick::Options::quality(const size_t quality_)
{
_imageInfo->quality=quality_;
}
size_t Magick::Options::quality(void) const
{
return(_imageInfo->quality);
}
void Magick::Options::quantizeColors(const size_t colors_)
{
_quantizeInfo->number_colors=colors_;
}
size_t Magick::Options::quantizeColors(void) const
{
return(_quantizeInfo->number_colors);
}
void Magick::Options::quantizeColorSpace(const ColorspaceType colorSpace_)
{
_quantizeInfo->colorspace=colorSpace_;
}
Magick::ColorspaceType Magick::Options::quantizeColorSpace(void) const
{
return(static_cast<Magick::ColorspaceType>(_quantizeInfo->colorspace));
}
void Magick::Options::quantizeDither(const bool ditherFlag_)
{
_imageInfo->dither=(MagickBooleanType) ditherFlag_;
_quantizeInfo->dither_method=ditherFlag_ ? RiemersmaDitherMethod :
NoDitherMethod;
}
bool Magick::Options::quantizeDither(void) const
{
return(static_cast<bool>(_imageInfo->dither));
}
void Magick::Options::quantizeDitherMethod(const DitherMethod ditherMethod_)
{
_quantizeInfo->dither_method=ditherMethod_;
}
MagickCore::DitherMethod Magick::Options::quantizeDitherMethod(void) const
{
return(_quantizeInfo->dither_method);
}
void Magick::Options::quantizeTreeDepth(const size_t treeDepth_)
{
_quantizeInfo->tree_depth=treeDepth_;
}
size_t Magick::Options::quantizeTreeDepth(void) const
{
return(_quantizeInfo->tree_depth);
}
void Magick::Options::quiet(const bool quiet_)
{
_quiet=quiet_;
}
bool Magick::Options::quiet(void) const
{
return(_quiet);
}
void Magick::Options::resolutionUnits(const ResolutionType resolutionUnits_)
{
_imageInfo->units=resolutionUnits_;
}
Magick::ResolutionType Magick::Options::resolutionUnits(void) const
{
return(_imageInfo->units);
}
void Magick::Options::samplingFactor(const std::string &samplingFactor_)
{
if (samplingFactor_.length() == 0)
_imageInfo->sampling_factor=(char *) RelinquishMagickMemory(
_imageInfo->sampling_factor);
else
Magick::CloneString(&_imageInfo->sampling_factor,samplingFactor_);
}
std::string Magick::Options::samplingFactor(void) const
{
if (_imageInfo->sampling_factor)
return(std::string(_imageInfo->sampling_factor));
return(std::string());
}
void Magick::Options::size(const Geometry &geometry_)
{
_imageInfo->size=(char *) RelinquishMagickMemory(_imageInfo->size);
if (geometry_.isValid())
Magick::CloneString(&_imageInfo->size,geometry_);
}
Magick::Geometry Magick::Options::size(void) const
{
if (_imageInfo->size)
return(Geometry(_imageInfo->size));
return(Geometry());
}
void Magick::Options::strokeAntiAlias(const bool flag_)
{
flag_ ? _drawInfo->stroke_antialias=MagickTrue :
_drawInfo->stroke_antialias=MagickFalse;
}
bool Magick::Options::strokeAntiAlias(void) const
{
return(_drawInfo->stroke_antialias != 0 ? true : false);
}
void Magick::Options::strokeColor(const Color &strokeColor_)
{
_drawInfo->stroke=strokeColor_;
if (strokeColor_ == Color())
strokePattern((const MagickCore::Image*) NULL);
setOption("stroke",strokeColor_);
}
Magick::Color Magick::Options::strokeColor(void) const
{
return(_drawInfo->stroke);
}
void Magick::Options::strokeDashArray(const double *strokeDashArray_)
{
_drawInfo->dash_pattern=(double *) RelinquishMagickMemory(
_drawInfo->dash_pattern);
if(strokeDashArray_)
{
size_t
x;
// Count elements in dash array
for (x=0; strokeDashArray_[x]; x++) ;
// Allocate elements
_drawInfo->dash_pattern=static_cast<double*>(AcquireMagickMemory((x+1)*
sizeof(double)));
if (!_drawInfo->dash_pattern)
throwExceptionExplicit(MagickCore::ResourceLimitError,
"Unable to allocate dash-pattern memory");
// Copy elements
memcpy(_drawInfo->dash_pattern,strokeDashArray_,(x+1)*sizeof(double));
_drawInfo->dash_pattern[x]=0.0;
}
}
const double *Magick::Options::strokeDashArray(void) const
{
return(_drawInfo->dash_pattern);
}
void Magick::Options::strokeDashOffset(const double strokeDashOffset_)
{
_drawInfo->dash_offset=strokeDashOffset_;
}
double Magick::Options::strokeDashOffset(void) const
{
return(_drawInfo->dash_offset);
}
void Magick::Options::strokeLineCap(const LineCap lineCap_)
{
_drawInfo->linecap=lineCap_;
}
Magick::LineCap Magick::Options::strokeLineCap(void) const
{
return(_drawInfo->linecap);
}
void Magick::Options::strokeLineJoin(const LineJoin lineJoin_)
{
_drawInfo->linejoin=lineJoin_;
}
Magick::LineJoin Magick::Options::strokeLineJoin(void) const
{
return(_drawInfo->linejoin);
}
void Magick::Options::strokeMiterLimit(const size_t miterLimit_)
{
_drawInfo->miterlimit=miterLimit_;
}
size_t Magick::Options::strokeMiterLimit(void) const
{
return(_drawInfo->miterlimit);
}
void Magick::Options::strokePattern(const MagickCore::Image *strokePattern_)
{
if (_drawInfo->stroke_pattern)
_drawInfo->stroke_pattern=DestroyImageList(_drawInfo->stroke_pattern);
if (strokePattern_)
{
GetPPException;
_drawInfo->stroke_pattern=CloneImage(const_cast<MagickCore::Image*>(
strokePattern_),0,0,MagickTrue,exceptionInfo);
ThrowPPException(_quiet);
}
}
const MagickCore::Image *Magick::Options::strokePattern(void) const
{
return(_drawInfo->stroke_pattern);
}
void Magick::Options::strokeWidth(const double strokeWidth_)
{
_drawInfo->stroke_width=strokeWidth_;
setOption("strokewidth",strokeWidth_);
}
double Magick::Options::strokeWidth(void) const
{
return(_drawInfo->stroke_width);
}
void Magick::Options::subImage(const size_t subImage_)
{
_imageInfo->scene=subImage_;
}
size_t Magick::Options::subImage(void) const
{
return(_imageInfo->scene);
}
void Magick::Options::subRange(const size_t subRange_)
{
_imageInfo->number_scenes=subRange_;
}
size_t Magick::Options::subRange(void) const
{
return(_imageInfo->number_scenes);
}
void Magick::Options::textAntiAlias(const bool flag_)
{
_drawInfo->text_antialias=static_cast<MagickBooleanType>(
flag_ ? MagickTrue : MagickFalse);
}
bool Magick::Options::textAntiAlias(void) const
{
return(static_cast<bool>(_drawInfo->text_antialias));
}
void Magick::Options::textDirection(const DirectionType direction_)
{
_drawInfo->direction=direction_;
(void) SetImageOption(_imageInfo,"direction",CommandOptionToMnemonic(
MagickDirectionOptions,(ssize_t) direction_));
}
Magick::DirectionType Magick::Options::textDirection() const
{
return(_drawInfo->direction);
}
void Magick::Options::textEncoding(const std::string &encoding_)
{
CloneString(&_drawInfo->encoding,encoding_.c_str());
(void) SetImageOption(imageInfo(),"encoding",encoding_.c_str());
}
std::string Magick::Options::textEncoding(void) const
{
if (_drawInfo->encoding && *_drawInfo->encoding)
return(std::string(_drawInfo->encoding));
return(std::string());
}
void Magick::Options::textGravity(const GravityType gravity_)
{
_drawInfo->gravity=gravity_;
(void) SetImageOption(_imageInfo,"gravity",CommandOptionToMnemonic(
MagickGravityOptions,(ssize_t) gravity_));
}
Magick::GravityType Magick::Options::textGravity() const
{
return(_drawInfo->gravity);
}
void Magick::Options::textInterlineSpacing(const double spacing_)
{
_drawInfo->interline_spacing=spacing_;
setOption("interline-spacing",spacing_);
}
double Magick::Options::textInterlineSpacing(void) const
{
return(_drawInfo->interline_spacing);
}
void Magick::Options::textInterwordSpacing(const double spacing_)
{
_drawInfo->interword_spacing=spacing_;
setOption("interword-spacing",spacing_);
}
double Magick::Options::textInterwordSpacing(void) const
{
return(_drawInfo->interword_spacing);
}
void Magick::Options::textKerning(const double kerning_)
{
_drawInfo->kerning=kerning_;
setOption("kerning",kerning_);
}
double Magick::Options::textKerning(void) const
{
return(_drawInfo->kerning);
}
void Magick::Options::textUnderColor(const Color &undercolor_)
{
_drawInfo->undercolor=undercolor_;
setOption("undercolor",undercolor_);
}
Magick::Color Magick::Options::textUnderColor(void) const
{
return(_drawInfo->undercolor);
}
void Magick::Options::transformOrigin(const double tx_,const double ty_)
{
AffineMatrix
affine,
current=_drawInfo->affine;
affine.sx=1.0;
affine.rx=0.0;
affine.ry=0.0;
affine.sy=1.0;
affine.tx=tx_;
affine.ty=ty_;
_drawInfo->affine.sx=current.sx*affine.sx+current.ry*affine.rx;
_drawInfo->affine.rx=current.rx*affine.sx+current.sy*affine.rx;
_drawInfo->affine.ry=current.sx*affine.ry+current.ry*affine.sy;
_drawInfo->affine.sy=current.rx*affine.ry+current.sy*affine.sy;
_drawInfo->affine.tx=current.sx*affine.tx+current.ry*affine.ty+current.tx;
_drawInfo->affine.ty=current.rx*affine.tx+current.sy*affine.ty+current.ty;
}
void Magick::Options::transformReset(void)
{
_drawInfo->affine.sx=1.0;
_drawInfo->affine.rx=0.0;
_drawInfo->affine.ry=0.0;
_drawInfo->affine.sy=1.0;
_drawInfo->affine.tx=0.0;
_drawInfo->affine.ty=0.0;
}
void Magick::Options::transformRotation(const double angle_)
{
AffineMatrix
affine,
current=_drawInfo->affine;
affine.sx=cos(DegreesToRadians(fmod(angle_,360.0)));
affine.rx=(-sin(DegreesToRadians(fmod(angle_,360.0))));
affine.ry=sin(DegreesToRadians(fmod(angle_,360.0)));
affine.sy=cos(DegreesToRadians(fmod(angle_,360.0)));
affine.tx=0.0;
affine.ty=0.0;
_drawInfo->affine.sx=current.sx*affine.sx+current.ry*affine.rx;
_drawInfo->affine.rx=current.rx*affine.sx+current.sy*affine.rx;
_drawInfo->affine.ry=current.sx*affine.ry+current.ry*affine.sy;
_drawInfo->affine.sy=current.rx*affine.ry+current.sy*affine.sy;
_drawInfo->affine.tx=current.sx*affine.tx+current.ry*affine.ty+current.tx;
_drawInfo->affine.ty=current.rx*affine.tx+current.sy*affine.ty+current.ty;
}
void Magick::Options::transformScale(const double sx_,const double sy_)
{
AffineMatrix
affine,
current=_drawInfo->affine;
affine.sx=sx_;
affine.rx=0.0;
affine.ry=0.0;
affine.sy=sy_;
affine.tx=0.0;
affine.ty=0.0;
_drawInfo->affine.sx=current.sx*affine.sx+current.ry*affine.rx;
_drawInfo->affine.rx=current.rx*affine.sx+current.sy*affine.rx;
_drawInfo->affine.ry=current.sx*affine.ry+current.ry*affine.sy;
_drawInfo->affine.sy=current.rx*affine.ry+current.sy*affine.sy;
_drawInfo->affine.tx=current.sx*affine.tx+current.ry*affine.ty+current.tx;
_drawInfo->affine.ty=current.rx*affine.tx+current.sy*affine.ty+current.ty;
}
void Magick::Options::transformSkewX(const double skewx_)
{
AffineMatrix
affine,
current=_drawInfo->affine;
affine.sx=1.0;
affine.rx=0.0;
affine.ry=tan(DegreesToRadians(fmod(skewx_,360.0)));
affine.sy=1.0;
affine.tx=0.0;
affine.ty=0.0;
_drawInfo->affine.sx=current.sx*affine.sx+current.ry*affine.rx;
_drawInfo->affine.rx=current.rx*affine.sx+current.sy*affine.rx;
_drawInfo->affine.ry=current.sx*affine.ry+current.ry*affine.sy;
_drawInfo->affine.sy=current.rx*affine.ry+current.sy*affine.sy;
_drawInfo->affine.tx=current.sx*affine.tx+current.ry*affine.ty+current.tx;
_drawInfo->affine.ty=current.rx*affine.tx+current.sy*affine.ty+current.ty;
}
void Magick::Options::transformSkewY(const double skewy_)
{
AffineMatrix
affine,
current=_drawInfo->affine;
affine.sx=1.0;
affine.rx=tan(DegreesToRadians(fmod(skewy_,360.0)));
affine.ry=0.0;
affine.sy=1.0;
affine.tx=0.0;
affine.ty=0.0;
_drawInfo->affine.sx=current.sx*affine.sx+current.ry*affine.rx;
_drawInfo->affine.rx=current.rx*affine.sx+current.sy*affine.rx;
_drawInfo->affine.ry=current.sx*affine.ry+current.ry*affine.sy;
_drawInfo->affine.sy=current.rx*affine.ry+current.sy*affine.sy;
_drawInfo->affine.tx=current.sx*affine.tx+current.ry*affine.ty+current.tx;
_drawInfo->affine.ty=current.rx*affine.tx+current.sy*affine.ty+current.ty;
}
void Magick::Options::type(const ImageType type_)
{
_imageInfo->type=type_;
}
Magick::ImageType Magick::Options::type(void) const
{
return(_imageInfo->type);
}
void Magick::Options::verbose(const bool verboseFlag_)
{
_imageInfo->verbose=(MagickBooleanType) verboseFlag_;
}
bool Magick::Options::verbose(void) const
{
return(static_cast<bool>(_imageInfo->verbose));
}
void Magick::Options::x11Display(const std::string &display_)
{
if (display_.length() == 0)
_imageInfo->server_name=(char *) RelinquishMagickMemory(
_imageInfo->server_name);
else
Magick::CloneString(&_imageInfo->server_name,display_);
}
std::string Magick::Options::x11Display(void) const
{
if (_imageInfo->server_name)
return(std::string( _imageInfo->server_name));
return(std::string());
}
MagickCore::DrawInfo *Magick::Options::drawInfo(void)
{
return(_drawInfo);
}
MagickCore::ImageInfo *Magick::Options::imageInfo(void)
{
return(_imageInfo);
}
MagickCore::QuantizeInfo *Magick::Options::quantizeInfo(void)
{
return(_quantizeInfo);
}
Magick::Options::Options(const MagickCore::ImageInfo* imageInfo_,
const MagickCore::QuantizeInfo* quantizeInfo_,
const MagickCore::DrawInfo* drawInfo_)
: _imageInfo((MagickCore::ImageInfo* ) NULL),
_quantizeInfo((MagickCore::QuantizeInfo* ) NULL),
_drawInfo((MagickCore::DrawInfo* ) NULL),
_quiet(false)
{
_imageInfo=CloneImageInfo(imageInfo_);
_quantizeInfo=CloneQuantizeInfo(quantizeInfo_);
_drawInfo=CloneDrawInfo(imageInfo_,drawInfo_);
}
void Magick::Options::setOption(const char *name,const Color &value_)
{
std::string
option;
option=value_;
(void) SetImageOption(imageInfo(),name,option.c_str());
}
void Magick::Options::setOption(const char *name,const double value_)
{
char
option[MagickPathExtent];
(void) FormatLocaleString(option,MagickPathExtent,"%.20g",value_);
(void) SetImageOption(_imageInfo,name,option);
}
Magick::Color
class MagickPPExport Color
Definition: Color.h:18
Magick::Options::fontWeight
size_t fontWeight(void) const
Definition: Options.cpp:360
Magick::Options::strokeDashOffset
double strokeDashOffset(void) const
Definition: Options.cpp:615
Magick::Options::textKerning
double textKerning(void) const
Definition: Options.cpp:777
Functions.h
Magick::Options::endian
EndianType endian(void) const
Definition: Options.cpp:211
Magick::Options::borderColor
Color borderColor(void) const
Definition: Options.cpp:120
DegreesToRadians
#define DegreesToRadians(x)
Definition: Options.cpp:27
Magick::Options::quantizeInfo
MagickCore::QuantizeInfo * quantizeInfo(void)
Definition: Options.cpp:955
Magick::Options::quality
size_t quality(void) const
Definition: Options.cpp:448
Magick::Options::font
std::string font(void) const
Definition: Options.cpp:301
Magick::Options::page
Geometry page(void) const
Definition: Options.cpp:435
Magick::Point
Definition: Geometry.h:208
Magick::Options
Definition: Options.h:30
Magick::Options::quantizeDither
bool quantizeDither(void) const
Definition: Options.cpp:480
Magick::Options::imageInfo
MagickCore::ImageInfo * imageInfo(void)
Definition: Options.cpp:950
Magick::Point::isValid
bool isValid() const
Definition: Geometry.cpp:698
Magick::Options::density
Point density(void) const
Definition: Options.cpp:188
Magick::Options::transformReset
void transformReset(void)
Definition: Options.cpp:814
Magick::Options::transformRotation
void transformRotation(const double angle_)
Definition: Options.cpp:824
Magick::Options::colorFuzz
double colorFuzz(void) const
Definition: Options.cpp:160
Magick::Options::textDirection
DirectionType textDirection() const
Definition: Options.cpp:718
Magick::Options::subRange
size_t subRange(void) const
Definition: Options.cpp:695
Magick::Options::strokeMiterLimit
size_t strokeMiterLimit(void) const
Definition: Options.cpp:645
Magick::Options::fileName
std::string fileName(void) const
Definition: Options.cpp:239
Magick::Options::backgroundColor
Color backgroundColor(void) const
Definition: Options.cpp:93
Magick::Options::fontFamily
std::string fontFamily(void) const
Definition: Options.cpp:323
Magick::Options::format
std::string format(void) const
Definition: Options.cpp:365
Magick::Options::adjoin
bool adjoin(void) const
Definition: Options.cpp:73
Magick::Options::textEncoding
std::string textEncoding(void) const
Definition: Options.cpp:729
Magick::Options::transformScale
void transformScale(const double sx_, const double sy_)
Definition: Options.cpp:845
Magick::Options::fillPattern
const MagickCore::Image * fillPattern(void) const
Definition: Options.cpp:272
Magick::Options::strokeColor
Color strokeColor(void) const
Definition: Options.cpp:577
Magick::Options::quiet
bool quiet(void) const
Definition: Options.cpp:510
Magick::Geometry
class MagickPPExport Geometry
Definition: Geometry.h:21
Magick::Options::strokeDashArray
const double * strokeDashArray(void) const
Definition: Options.cpp:605
Magick::Options::subImage
size_t subImage(void) const
Definition: Options.cpp:685
Magick::Options::matteColor
Color matteColor(void) const
Definition: Options.cpp:83
Magick::Options::fillColor
Color fillColor(void) const
Definition: Options.cpp:252
Magick::Options::quantizeTreeDepth
size_t quantizeTreeDepth(void) const
Definition: Options.cpp:500
Magick::Options::colorspaceType
ColorspaceType colorspaceType(void) const
Definition: Options.cpp:140
Magick::Color
Definition: Color.h:36
Magick::Options::quantizeColors
size_t quantizeColors(void) const
Definition: Options.cpp:458
Magick::Options::fillRule
FillRule fillRule(void) const
Definition: Options.cpp:282
Magick::Options::strokeLineCap
LineCap strokeLineCap(void) const
Definition: Options.cpp:625
Magick::throwExceptionExplicit
MagickPPExport void throwExceptionExplicit(const MagickCore::ExceptionType severity_, const char *reason_, const char *description_=(char *) NULL)
Definition: Exception.cpp:808
Magick::Geometry
Definition: Geometry.h:37
Magick::Options::~Options
~Options()
Definition: Options.cpp:55
Magick::Options::magick
std::string magick(void) const
Definition: Options.cpp:409
Magick::Options::textInterlineSpacing
double textInterlineSpacing(void) const
Definition: Options.cpp:755
Magick::Options::strokeAntiAlias
bool strokeAntiAlias(void) const
Definition: Options.cpp:564
Magick::Options::compressType
CompressionType compressType(void) const
Definition: Options.cpp:150
Magick::Options::type
ImageType type(void) const
Definition: Options.cpp:913
Magick::Options::file
FILE * file(void) const
Definition: Options.cpp:221
ThrowPPException
#define ThrowPPException(quiet)
Definition: Include.h:1580
Magick::Options::textUnderColor
Color textUnderColor(void) const
Definition: Options.cpp:788
Options.h
Magick::Options::x11Display
std::string x11Display(void) const
Definition: Options.cpp:937
Magick::Options::textInterwordSpacing
double textInterwordSpacing(void) const
Definition: Options.cpp:766
Magick::Options::textGravity
GravityType textGravity() const
Definition: Options.cpp:744
Magick::Options::samplingFactor
std::string samplingFactor(void) const
Definition: Options.cpp:534
MagickCore
Definition: Include.h:45
Include.h
Magick::Options::quantizeDitherMethod
DitherMethod quantizeDitherMethod(void) const
Definition: Options.cpp:490
Magick::Options::backgroundTexture
std::string backgroundTexture(void) const
Definition: Options.cpp:106
Magick::Options::verbose
bool verbose(void) const
Definition: Options.cpp:923
Magick::Options::strokePattern
const MagickCore::Image * strokePattern(void) const
Definition: Options.cpp:664
Magick::Options::strokeLineJoin
LineJoin strokeLineJoin(void) const
Definition: Options.cpp:635
Magick::Options::transformOrigin
void transformOrigin(const double tx_, const double ty_)
Definition: Options.cpp:793
Magick::Options::transformSkewY
void transformSkewY(const double skewy_)
Definition: Options.cpp:887
Magick::Options::transformSkewX
void transformSkewX(const double skewx_)
Definition: Options.cpp:866
Magick::Options::monochrome
bool monochrome(void) const
Definition: Options.cpp:422
Magick::Options::drawInfo
MagickCore::DrawInfo * drawInfo(void)
Definition: Options.cpp:945
Magick::Options::size
Geometry size(void) const
Definition: Options.cpp:550
Magick::CloneString
MagickPPExport void CloneString(char **destination_, const std::string &source_)
Definition: Functions.cpp:25
Magick::Point
class MagickPPExport Point
Definition: Geometry.h:200
Magick::Image
class MagickPPExport Image
Definition: Drawable.h:722
Magick::Options::interlaceType
InterlaceType interlaceType(void) const
Definition: Options.cpp:386
Magick::Options::strokeWidth
double strokeWidth(void) const
Definition: Options.cpp:675
Magick::Options::Options
Options(void)
Definition: Options.cpp:29
GetPPException
#define GetPPException
Definition: Include.h:1561
Magick::Options::fontStyle
StyleType fontStyle(void) const
Definition: Options.cpp:349
Exception.h
Magick::Geometry::isValid
void isValid(bool isValid_)
Definition: Geometry.cpp:369
Magick::Options::depth
size_t depth(void) const
Definition: Options.cpp:201
Magick::Options::fontPointsize
double fontPointsize(void) const
Definition: Options.cpp:337
Magick::Options::boxColor
Color boxColor(void) const
Definition: Options.cpp:130
Magick::Options::debug
bool debug(void) const
Definition: Options.cpp:173
Magick::Options::quantizeColorSpace
ColorspaceType quantizeColorSpace(void) const
Definition: Options.cpp:468
Magick::Options::textAntiAlias
bool textAntiAlias(void) const
Definition: Options.cpp:706
Magick::Options::resolutionUnits
ResolutionType resolutionUnits(void) const
Definition: Options.cpp:520