MagickCore  7.0.3
draw.c File Reference
Include dependency graph for draw.c:

Go to the source code of this file.

Data Structures

struct  _EdgeInfo
 
struct  _ElementInfo
 
struct  _PolygonInfo
 
struct  _PathInfo
 

Macros

#define BezierQuantum   200
 
#define DrawEpsilon   (1.0e-10)
 
#define RenderImageTag   "Render/Image"
 

Typedefs

typedef struct _EdgeInfo EdgeInfo
 
typedef struct _ElementInfo ElementInfo
 
typedef struct _PolygonInfo PolygonInfo
 
typedef struct _PathInfo PathInfo
 

Enumerations

enum  PathInfoCode {
  MoveToCode, OpenCode, GhostlineCode, LineToCode,
  EndCode
}
 

Functions

static MagickBooleanType DrawStrokePolygon (Image *, const DrawInfo *, const PrimitiveInfo *, ExceptionInfo *)
 
static PrimitiveInfoTraceStrokePolygon (const DrawInfo *, const PrimitiveInfo *)
 
static size_t TracePath (PrimitiveInfo *, const char *)
 
static void TraceArc (PrimitiveInfo *, const PointInfo, const PointInfo, const PointInfo)
 
static void TraceArcPath (PrimitiveInfo *, const PointInfo, const PointInfo, const PointInfo, const double, const MagickBooleanType, const MagickBooleanType)
 
static void TraceBezier (PrimitiveInfo *, const size_t)
 
static void TraceCircle (PrimitiveInfo *, const PointInfo, const PointInfo)
 
static void TraceEllipse (PrimitiveInfo *, const PointInfo, const PointInfo, const PointInfo)
 
static void TraceLine (PrimitiveInfo *, const PointInfo, const PointInfo)
 
static void TraceRectangle (PrimitiveInfo *, const PointInfo, const PointInfo)
 
static void TraceRoundRectangle (PrimitiveInfo *, const PointInfo, const PointInfo, PointInfo)
 
static void TraceSquareLinecap (PrimitiveInfo *, const size_t, const double)
 
MagickExport DrawInfoAcquireDrawInfo (void)
 
MagickExport DrawInfoCloneDrawInfo (const ImageInfo *image_info, const DrawInfo *draw_info)
 
static int CompareEdges (const void *x, const void *y)
 
static void LogPolygonInfo (const PolygonInfo *polygon_info)
 
static void ReversePoints (PointInfo *points, const size_t number_points)
 
static PolygonInfoConvertPathToPolygon (const PathInfo *path_info)
 
static void LogPathInfo (const PathInfo *path_info)
 
static PathInfoConvertPrimitiveToPath (const PrimitiveInfo *primitive_info)
 
MagickExport DrawInfoDestroyDrawInfo (DrawInfo *draw_info)
 
static size_t DestroyEdge (PolygonInfo *polygon_info, const size_t edge)
 
static PolygonInfoDestroyPolygonInfo (PolygonInfo *polygon_info)
 
static SegmentInfo AffineEdge (const Image *image, const AffineMatrix *affine, const double y, const SegmentInfo *edge)
 
static AffineMatrix InverseAffineMatrix (const AffineMatrix *affine)
 
MagickExport MagickBooleanType DrawAffineImage (Image *image, const Image *source, const AffineMatrix *affine, ExceptionInfo *exception)
 
static void DrawBoundingRectangles (Image *image, const DrawInfo *draw_info, const PolygonInfo *polygon_info, ExceptionInfo *exception)
 
MagickExport MagickBooleanType DrawClipPath (Image *image, const DrawInfo *draw_info, const char *name, ExceptionInfo *exception)
 
static MagickBooleanType DrawDashPolygon (const DrawInfo *draw_info, const PrimitiveInfo *primitive_info, Image *image, ExceptionInfo *exception)
 
static MagickBooleanType IsPoint (const char *point)
 
static void TracePoint (PrimitiveInfo *primitive_info, const PointInfo point)
 
MagickExport MagickBooleanType DrawImage (Image *image, const DrawInfo *draw_info, ExceptionInfo *exception)
 
static double GetStopColorOffset (const GradientInfo *gradient, const ssize_t x, const ssize_t y)
 
static int StopInfoCompare (const void *x, const void *y)
 
MagickExport MagickBooleanType DrawGradientImage (Image *image, const DrawInfo *draw_info, ExceptionInfo *exception)
 
MagickExport MagickBooleanType DrawPatternPath (Image *image, const DrawInfo *draw_info, const char *name, Image **pattern, ExceptionInfo *exception)
 
static PolygonInfo ** DestroyPolygonThreadSet (PolygonInfo **polygon_info)
 
static PolygonInfo ** AcquirePolygonThreadSet (const PrimitiveInfo *primitive_info)
 
static double GetFillAlpha (PolygonInfo *polygon_info, const double mid, const MagickBooleanType fill, const FillRule fill_rule, const ssize_t x, const ssize_t y, double *stroke_alpha)
 
static MagickBooleanType DrawPolygonPrimitive (Image *image, const DrawInfo *draw_info, const PrimitiveInfo *primitive_info, ExceptionInfo *exception)
 
static void LogPrimitiveInfo (const PrimitiveInfo *primitive_info)
 
MagickExport MagickBooleanType DrawPrimitive (Image *image, const DrawInfo *draw_info, const PrimitiveInfo *primitive_info, ExceptionInfo *exception)
 
static void DrawRoundLinecap (Image *image, const DrawInfo *draw_info, const PrimitiveInfo *primitive_info, ExceptionInfo *exception)
 
MagickExport void GetAffineMatrix (AffineMatrix *affine_matrix)
 
MagickExport void GetDrawInfo (const ImageInfo *image_info, DrawInfo *draw_info)
 
static double Permutate (const ssize_t n, const ssize_t k)
 

Macro Definition Documentation

§ BezierQuantum

#define BezierQuantum   200

Definition at line 91 of file draw.c.

Referenced by DrawImage(), TraceBezier(), and TraceStrokePolygon().

§ DrawEpsilon

§ RenderImageTag

#define RenderImageTag   "Render/Image"

Referenced by DrawImage().

Typedef Documentation

§ EdgeInfo

typedef struct _EdgeInfo EdgeInfo

§ ElementInfo

typedef struct _ElementInfo ElementInfo

§ PathInfo

typedef struct _PathInfo PathInfo

§ PolygonInfo

typedef struct _PolygonInfo PolygonInfo

Enumeration Type Documentation

§ PathInfoCode

Enumerator
MoveToCode 
OpenCode 
GhostlineCode 
LineToCode 
EndCode 

Definition at line 141 of file draw.c.

Function Documentation

§ AcquireDrawInfo()

MagickExport DrawInfo* AcquireDrawInfo ( void  )

Definition at line 204 of file draw.c.

References AcquireMagickMemory(), GetDrawInfo(), ResourceLimitFatalError, and ThrowFatalException.

Referenced by GradientImage().

§ AcquirePolygonThreadSet()

§ AffineEdge()

static SegmentInfo AffineEdge ( const Image image,
const AffineMatrix affine,
const double  y,
const SegmentInfo edge 
)
static

§ CloneDrawInfo()

MagickExport DrawInfo* CloneDrawInfo ( const ImageInfo image_info,
const DrawInfo draw_info 
)

Definition at line 243 of file draw.c.

References AcquireExceptionInfo(), AcquireMagickMemory(), AcquireQuantumMemory(), _DrawInfo::affine, _DrawInfo::align, _DrawInfo::border_color, _DrawInfo::bounds, _DrawInfo::clip_mask, _DrawInfo::clip_units, CloneImage(), CloneString(), _DrawInfo::compose, CopyMagickMemory(), _DrawInfo::dash_offset, _DrawInfo::dash_pattern, _DrawInfo::debug, _DrawInfo::decorate, _DrawInfo::density, DestroyExceptionInfo(), _DrawInfo::direction, DrawEpsilon, _DrawInfo::element_reference, _DrawInfo::encoding, _DrawInfo::family, _DrawInfo::fill, _DrawInfo::fill_alpha, _DrawInfo::fill_pattern, _DrawInfo::fill_rule, _DrawInfo::font, _DrawInfo::geometry, GetDrawInfo(), _DrawInfo::gradient, _DrawInfo::gravity, _DrawInfo::interline_spacing, _DrawInfo::interword_spacing, IsEventLogging(), _DrawInfo::kerning, _DrawInfo::linecap, _DrawInfo::linejoin, MagickTrue, _DrawInfo::metrics, _DrawInfo::miterlimit, _GradientInfo::number_stops, _DrawInfo::pointsize, _DrawInfo::primitive, _DrawInfo::render, ResourceLimitFatalError, _DrawInfo::server_name, _GradientInfo::stops, _DrawInfo::stretch, _DrawInfo::stroke, _DrawInfo::stroke_alpha, _DrawInfo::stroke_antialias, _DrawInfo::stroke_pattern, _DrawInfo::stroke_width, _DrawInfo::style, _DrawInfo::text, _DrawInfo::text_antialias, ThrowFatalException, _DrawInfo::undercolor, _DrawInfo::viewbox, and _DrawInfo::weight.

Referenced by AnnotateImage(), DrawBoundingRectangles(), DrawClipPath(), DrawDashPolygon(), DrawImage(), DrawPatternPath(), DrawPrimitive(), DrawStrokePolygon(), GetMultilineTypeMetrics(), GetTypeMetrics(), MontageImageList(), PolaroidImage(), RenderHoughLines(), RenderType(), and VignetteImage().

§ CompareEdges()

static int CompareEdges ( const void *  x,
const void *  y 
)
static

Definition at line 387 of file draw.c.

References DrawEpsilon, _EdgeInfo::points, _PointInfo::x, and _PointInfo::y.

Referenced by ConvertPathToPolygon().

§ ConvertPathToPolygon()

§ ConvertPrimitiveToPath()

§ DestroyDrawInfo()

§ DestroyEdge()

static size_t DestroyEdge ( PolygonInfo polygon_info,
const size_t  edge 
)
static

§ DestroyPolygonInfo()

static PolygonInfo* DestroyPolygonInfo ( PolygonInfo polygon_info)
static

§ DestroyPolygonThreadSet()

static PolygonInfo** DestroyPolygonThreadSet ( PolygonInfo **  polygon_info)
static

§ DrawAffineImage()

§ DrawBoundingRectangles()

§ DrawClipPath()

§ DrawDashPolygon()

§ DrawGradientImage()

§ DrawImage()

MagickExport MagickBooleanType DrawImage ( Image image,
const DrawInfo draw_info,
ExceptionInfo exception 
)

Definition at line 1672 of file draw.c.

References AcquireImageInfo(), AcquireMagickMemory(), AcquireQuantumMemory(), AcquireString(), _DrawInfo::affine, _DrawInfo::align, AllCompliance, _PixelInfo::alpha, AlphaPrimitive, ArcPrimitive, BezierPrimitive, BezierQuantum, _EdgeInfo::bounds, _DrawInfo::bounds, CatchException(), CirclePrimitive, ClampToQuantum(), _DrawInfo::clip_mask, _DrawInfo::clip_units, CloneDrawInfo(), CloneString(), _StopInfo::color, ColorPrimitive, _Image::columns, _DrawInfo::compose, _PrimitiveInfo::coordinates, CopyMagickString(), _DrawInfo::dash_offset, _DrawInfo::dash_pattern, _Image::debug, _DrawInfo::decorate, DegreesToRadians(), DestroyDrawInfo(), DestroyImageInfo(), DestroyString(), DirectClass, _EdgeInfo::direction, _DrawInfo::direction, DrawClipPath(), DrawEpsilon, DrawError, DrawEvent, DrawPatternPath(), DrawPrimitive(), EllipsePrimitive, _Image::filename, _ImageInfo::filename, FileToString(), _DrawInfo::fill, _DrawInfo::fill_alpha, _DrawInfo::fill_pattern, _DrawInfo::fill_rule, FloodfillMethod, FormatLocaleString(), GetAffineMatrix(), GetImageArtifact(), GetMagickModule, GetNextToken(), _DrawInfo::gradient, GradientImage(), _DrawInfo::gravity, _RectangleInfo::height, ImagePrimitive, _DrawInfo::interline_spacing, _DrawInfo::interword_spacing, IsPoint(), _DrawInfo::kerning, LinearGradient, _DrawInfo::linecap, _DrawInfo::linejoin, LinePrimitive, LocaleCompare(), LogMagickEvent(), MagickAlignOptions, MagickClipPathOptions, MagickComposeOptions, MagickCoreSignature, MagickDecorateOptions, MagickDirectionOptions, MagickFalse, MagickFillRuleOptions, MagickGravityOptions, MagickLineCapOptions, MagickLineJoinOptions, MagickMax, MagickMethodOptions, MagickPathExtent, MagickPI, MagickStretchOptions, MagickStyleOptions, MagickTrue, MagickWeightOptions, _PrimitiveInfo::method, _DrawInfo::miterlimit, _EdgeInfo::number_points, ObjectBoundingBox, _StopInfo::offset, OpaqueAlpha, PadSpread, _Image::page, ParseCommandOption(), PathPrimitive, _PrimitiveInfo::point, PointPrimitive, _DrawInfo::pointsize, PolygonPrimitive, PolylinePrimitive, _DrawInfo::primitive, _PrimitiveInfo::primitive, QuantumRange, QuantumScale, QueryColorCompliance(), RadialGradient, ReadImage(), ReadPixelMask, RectanglePrimitive, RelinquishMagickMemory(), RenderImageTag, ResizeQuantumMemory(), ResourceLimitError, ResourceLimitFatalError, RoundRectanglePrimitive, _Image::rows, _AffineMatrix::rx, _AffineMatrix::ry, SetImageArtifact(), SetImageMask(), SetImageProgress(), SetImageStorageClass(), _DrawInfo::signature, _Image::signature, _DrawInfo::stretch, StringToDouble(), StringToLong(), StringToUnsignedLong(), _DrawInfo::stroke, _DrawInfo::stroke_alpha, _DrawInfo::stroke_antialias, _DrawInfo::stroke_pattern, _DrawInfo::stroke_width, _DrawInfo::style, _AffineMatrix::sx, _AffineMatrix::sy, _PrimitiveInfo::text, _DrawInfo::text_antialias, TextPrimitive, ThrowBinaryException, ThrowFatalException, ThrowMagickException(), TraceArc(), TraceBezier(), TraceCircle(), TraceEllipse(), TraceEvent, TraceLine(), TracePath(), TracePoint(), TraceRectangle(), TraceRoundRectangle(), _AffineMatrix::tx, _AffineMatrix::ty, _GradientInfo::type, UndefinedPrimitive, _DrawInfo::viewbox, _DrawInfo::weight, _RectangleInfo::width, _PointInfo::x, _RectangleInfo::x, _SegmentInfo::x1, _SegmentInfo::x2, _PointInfo::y, _RectangleInfo::y, _SegmentInfo::y1, and _SegmentInfo::y2.

Referenced by AnnotateImage(), DrawClipPath(), DrawPatternPath(), RenderHoughLines(), RenderType(), and VignetteImage().

§ DrawPatternPath()

§ DrawPolygonPrimitive()

§ DrawPrimitive()

MagickExport MagickBooleanType DrawPrimitive ( Image image,
const DrawInfo draw_info,
const PrimitiveInfo primitive_info,
ExceptionInfo exception 
)

Definition at line 4302 of file draw.c.

References AcquireAuthenticCacheView(), AcquireImageInfo(), _DrawInfo::affine, _PixelInfo::alpha, _DrawInfo::alpha, _Image::alpha_trait, AlphaChannel, AlphaPrimitive, AnnotateImage(), _PixelInfo::blue, _DrawInfo::border_color, ClampToQuantum(), CloneDrawInfo(), CloneString(), ColorPrimitive, _Image::colorspace, _Image::columns, _DrawInfo::compose, CompositeImage(), CompositePixelOver(), CopyMagickString(), _DrawInfo::dash_pattern, _Image::debug, DestroyCacheView(), DestroyDrawInfo(), DestroyImage(), DestroyImageInfo(), DrawAffineImage(), DrawDashPolygon(), DrawEpsilon, DrawEvent, DrawPolygonPrimitive(), DrawStrokePolygon(), ExpandAffine(), _ImageInfo::filename, _DrawInfo::fill, FillToBorderMethod, _Image::filter, FloodfillMethod, FloodfillPaintImage(), FormatLocaleString(), _DrawInfo::geometry, GetCacheViewAuthenticPixels(), GetFillColor(), GetMagickModule, GetOneCacheViewVirtualPixelInfo(), GetOneVirtualPixelInfo(), GetPixelAlpha(), GetPixelChannels(), GetPixelInfo(), GetPixelInfoPixel(), _Image::gravity, _DrawInfo::gravity, _PixelInfo::green, ImagePrimitive, _Image::interpolate, IsEventLogging(), IsFuzzyEquivalencePixelInfo(), IsGrayColorspace(), IsPixelInfoGray(), _DrawInfo::linecap, _DrawInfo::linejoin, LocaleNCompare(), LogMagickEvent(), LogPrimitiveInfo(), magick_restrict, MagickFalse, MagickPathExtent, MagickTrue, _PrimitiveInfo::method, OpaqueAlpha, OpaqueAlphaChannel, OverCompositeOp, ParseGravityGeometry(), _PrimitiveInfo::point, PointMethod, PointPrimitive, _PrimitiveInfo::primitive, ReadImage(), ReadInlineImage(), _PixelInfo::red, ReplaceMethod, ResetMethod, RoundCap, RoundJoin, _Image::rows, _AffineMatrix::rx, _AffineMatrix::ry, SetGeometry(), SetImageAlpha(), SetImageAlphaChannel(), SetImageChannelMask(), SetImageColorspace(), SetImageProgressMonitor(), SetPixelAlpha(), SetPixelViaPixelInfo(), sRGBColorspace, _DrawInfo::stroke, _DrawInfo::stroke_pattern, _DrawInfo::stroke_width, _AffineMatrix::sx, _AffineMatrix::sy, SyncCacheViewAuthenticPixels(), _DrawInfo::text, _PrimitiveInfo::text, TextPrimitive, TileVirtualPixelMethod, TransformImage(), TransparentAlpha, _AffineMatrix::tx, _AffineMatrix::ty, UndefinedPixelTrait, UndefinedPrimitive, _PointInfo::x, _RectangleInfo::x, _PointInfo::y, and _RectangleInfo::y.

Referenced by DrawBoundingRectangles(), and DrawImage().

§ DrawRoundLinecap()

static void DrawRoundLinecap ( Image image,
const DrawInfo draw_info,
const PrimitiveInfo primitive_info,
ExceptionInfo exception 
)
static

§ DrawStrokePolygon()

§ GetAffineMatrix()

MagickExport void GetAffineMatrix ( AffineMatrix affine_matrix)

§ GetDrawInfo()

MagickExport void GetDrawInfo ( const ImageInfo image_info,
DrawInfo draw_info 
)

Definition at line 4930 of file draw.c.

References AcquireExceptionInfo(), AcquireString(), _DrawInfo::affine, AllCompliance, _PixelInfo::alpha, _DrawInfo::alpha, _ImageInfo::antialias, _DrawInfo::border_color, _ImageInfo::border_color, ButtCap, CloneImageInfo(), CloneString(), _DrawInfo::compose, _DrawInfo::debug, _DrawInfo::decorate, _DrawInfo::density, _ImageInfo::density, DestroyExceptionInfo(), DestroyImageInfo(), _DrawInfo::direction, DrawEpsilon, _DrawInfo::encoding, EvenOddRule, _DrawInfo::family, _DrawInfo::fill, _DrawInfo::fill_alpha, _DrawInfo::fill_rule, _DrawInfo::font, _ImageInfo::font, GetAffineMatrix(), GetImageOption(), GetMagickModule, _DrawInfo::gravity, _DrawInfo::interline_spacing, _DrawInfo::interword_spacing, IsEventLogging(), _DrawInfo::kerning, _DrawInfo::linecap, _DrawInfo::linejoin, LogMagickEvent(), MagickCoreSignature, MagickDirectionOptions, MagickFalse, MagickGravityOptions, MagickStyleOptions, MagickTrue, MagickWeightOptions, MiterJoin, _DrawInfo::miterlimit, NoDecoration, OpaqueAlpha, OverCompositeOp, ParseCommandOption(), _DrawInfo::pointsize, _ImageInfo::pointsize, QueryColorCompliance(), _DrawInfo::render, ResetMagickMemory(), _DrawInfo::server_name, _ImageInfo::server_name, _DrawInfo::signature, StringToDouble(), StringToUnsignedLong(), _DrawInfo::stroke, _DrawInfo::stroke_alpha, _DrawInfo::stroke_antialias, _DrawInfo::stroke_width, _DrawInfo::style, _DrawInfo::text_antialias, TraceEvent, TransparentAlpha, UndefinedDirection, _DrawInfo::undercolor, and _DrawInfo::weight.

Referenced by AcquireDrawInfo(), and CloneDrawInfo().

§ GetFillAlpha()

static double GetFillAlpha ( PolygonInfo polygon_info,
const double  mid,
const MagickBooleanType  fill,
const FillRule  fill_rule,
const ssize_t  x,
const ssize_t  y,
double *  stroke_alpha 
)
static

§ GetStopColorOffset()

§ InverseAffineMatrix()

static AffineMatrix InverseAffineMatrix ( const AffineMatrix affine)
static

§ IsPoint()

static MagickBooleanType IsPoint ( const char *  point)
inlinestatic

Definition at line 1653 of file draw.c.

References DrawEpsilon, MagickFalse, MagickTrue, and StringToDouble().

Referenced by DrawImage(), and TracePath().

§ LogPathInfo()

static void LogPathInfo ( const PathInfo path_info)
static

§ LogPolygonInfo()

§ LogPrimitiveInfo()

§ Permutate()

static double Permutate ( const ssize_t  n,
const ssize_t  k 
)
inlinestatic

Definition at line 5067 of file draw.c.

Referenced by TraceBezier().

§ ReversePoints()

static void ReversePoints ( PointInfo points,
const size_t  number_points 
)
static

Definition at line 446 of file draw.c.

Referenced by ConvertPathToPolygon().

§ StopInfoCompare()

static int StopInfoCompare ( const void *  x,
const void *  y 
)
static

Definition at line 3358 of file draw.c.

References DrawEpsilon, and _StopInfo::offset.

Referenced by DrawGradientImage().

§ TraceArc()

static void TraceArc ( PrimitiveInfo primitive_info,
const PointInfo  start,
const PointInfo  end,
const PointInfo  degrees 
)
static

Definition at line 5099 of file draw.c.

References TraceEllipse(), _PointInfo::x, and _PointInfo::y.

Referenced by DrawImage().

§ TraceArcPath()

static void TraceArcPath ( PrimitiveInfo primitive_info,
const PointInfo  start,
const PointInfo  end,
const PointInfo  arc,
const double  angle,
const MagickBooleanType  large_arc,
const MagickBooleanType  sweep 
)

§ TraceBezier()

§ TraceCircle()

static void TraceCircle ( PrimitiveInfo primitive_info,
const PointInfo  start,
const PointInfo  end 
)

Definition at line 5338 of file draw.c.

References TraceEllipse(), _PointInfo::x, and _PointInfo::y.

Referenced by DrawImage().

§ TraceEllipse()

static void TraceEllipse ( PrimitiveInfo primitive_info,
const PointInfo  start,
const PointInfo  stop,
const PointInfo  degrees 
)

§ TraceLine()

static void TraceLine ( PrimitiveInfo primitive_info,
const PointInfo  start,
const PointInfo  end 
)

§ TracePath()

§ TracePoint()

static void TracePoint ( PrimitiveInfo primitive_info,
const PointInfo  point 
)
inlinestatic

§ TraceRectangle()

static void TraceRectangle ( PrimitiveInfo primitive_info,
const PointInfo  start,
const PointInfo  end 
)

§ TraceRoundRectangle()

static void TraceRoundRectangle ( PrimitiveInfo primitive_info,
const PointInfo  start,
const PointInfo  end,
PointInfo  arc 
)

§ TraceSquareLinecap()

static void TraceSquareLinecap ( PrimitiveInfo primitive_info,
const size_t  number_vertices,
const double  offset 
)

Definition at line 5890 of file draw.c.

References DrawEpsilon, _PrimitiveInfo::point, _PointInfo::x, and _PointInfo::y.

Referenced by TraceStrokePolygon().

§ TraceStrokePolygon()