MagickCore  7.0.0
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 RenderImageTag   "Render/Image"
 
#define DrawEpsilon   ((double) 1.0e-10)
 

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 DrawInfo *magick_unused(draw_info), const PathInfo *path_info)
 
static void LogPathInfo (const PathInfo *path_info)
 
static PathInfoConvertPrimitiveToPath (const DrawInfo *magick_unused(draw_info), 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)
 
static ssize_t MagickAbsoluteValue (const ssize_t x)
 
static double MagickMax (const double x, const double y)
 
static double MagickMin (const double x, const double y)
 
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)
 
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 DrawInfo *draw_info, 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)
 
static double DrawEpsilonReciprocal (const double x)
 

Macro Definition Documentation

#define BezierQuantum   200

Definition at line 90 of file draw.c.

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

#define DrawEpsilon   ((double) 1.0e-10)

Referenced by DrawEpsilonReciprocal().

#define RenderImageTag   "Render/Image"

Referenced by DrawImage().

Typedef Documentation

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

Enumeration Type Documentation

Enumerator
MoveToCode 
OpenCode 
GhostlineCode 
LineToCode 
EndCode 

Definition at line 138 of file draw.c.

Function Documentation

MagickExport DrawInfo* AcquireDrawInfo ( void  )

Definition at line 200 of file draw.c.

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

Referenced by GradientImage().

static PolygonInfo** AcquirePolygonThreadSet ( const DrawInfo draw_info,
const PrimitiveInfo primitive_info 
)
static
static SegmentInfo AffineEdge ( const Image image,
const AffineMatrix affine,
const double  y,
const SegmentInfo edge 
)
static
MagickExport DrawInfo* CloneDrawInfo ( const ImageInfo image_info,
const DrawInfo draw_info 
)

Definition at line 239 of file draw.c.

References AcquireExceptionInfo(), AcquireMagickMemory(), AcquireQuantumMemory(), _DrawInfo::affine, _DrawInfo::align, _DrawInfo::alpha, _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, _DrawInfo::element_reference, _DrawInfo::encoding, _DrawInfo::family, _DrawInfo::fill, _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_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(), RenderType(), and VignetteImage().

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

Definition at line 372 of file draw.c.

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

Referenced by ConvertPathToPolygon().

static size_t DestroyEdge ( PolygonInfo polygon_info,
const size_t  edge 
)
static
static PolygonInfo* DestroyPolygonInfo ( PolygonInfo polygon_info)
static
static PolygonInfo** DestroyPolygonThreadSet ( PolygonInfo **  polygon_info)
static
static double DrawEpsilonReciprocal ( const double  x)
inlinestatic

Definition at line 5739 of file draw.c.

References DrawEpsilon.

Referenced by TraceStrokePolygon().

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

Definition at line 1673 of file draw.c.

References AcquireImageInfo(), AcquireMagickMemory(), AcquireQuantumMemory(), AcquireString(), _DrawInfo::affine, _DrawInfo::align, AllCompliance, _PixelInfo::alpha, _DrawInfo::alpha, ArcPrimitive, BezierPrimitive, BezierQuantum, _DrawInfo::bounds, CatchException(), CirclePrimitive, ClampToQuantum(), _DrawInfo::clip_mask, _DrawInfo::clip_units, CloneDrawInfo(), CloneString(), ColorPrimitive, _Image::columns, _DrawInfo::compose, _PrimitiveInfo::coordinates, CopyMagickString(), _DrawInfo::dash_offset, _DrawInfo::dash_pattern, _Image::debug, _DrawInfo::decorate, DegreesToRadians(), DestroyDrawInfo(), DestroyImageInfo(), DestroyString(), DirectClass, DrawClipPath(), DrawError, DrawEvent, DrawPatternPath(), DrawPrimitive(), EllipsePrimitive, _Image::filename, _ImageInfo::filename, FileToString(), _DrawInfo::fill, _DrawInfo::fill_pattern, _DrawInfo::fill_rule, FloodfillMethod, FormatLocaleString(), GetAffineMatrix(), GetImageArtifact(), GetMagickModule, GetMagickToken(), 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, MagickDecorateOptions, MagickFalse, MagickFillRuleOptions, MagickGravityOptions, MagickLineCapOptions, MagickLineJoinOptions, MagickMax(), MagickMethodOptions, MagickPI, MagickSignature, MagickStretchOptions, MagickStyleOptions, MagickTrue, MattePrimitive, MaxTextExtent, _PrimitiveInfo::method, _DrawInfo::miterlimit, ObjectBoundingBox, _Image::page, ParseCommandOption(), PathPrimitive, _PrimitiveInfo::point, PointPrimitive, _DrawInfo::pointsize, PolygonPrimitive, PolylinePrimitive, _DrawInfo::primitive, _PrimitiveInfo::primitive, QuantumRange, QuantumScale, QueryColorCompliance(), ReadImage(), RectanglePrimitive, ReflectSpread, 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_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, 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(), and VignetteImage().

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

Definition at line 4123 of file draw.c.

References AcquireAuthenticCacheView(), AcquireImageInfo(), _DrawInfo::affine, _PixelInfo::alpha, _DrawInfo::alpha, _Image::alpha_trait, AlphaChannel, AnnotateImage(), BlendPixelTrait, _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(), 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(), MagickEpsilon, MagickFalse, MagickTrue, MattePrimitive, MaxTextExtent, _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(), SetPixelInfoPixel(), sRGBColorspace, _DrawInfo::stroke, _DrawInfo::stroke_width, _AffineMatrix::sx, _AffineMatrix::sy, SyncCacheViewAuthenticPixels(), _DrawInfo::text, _PrimitiveInfo::text, TextPrimitive, TileVirtualPixelMethod, TransformImage(), TransparentAlpha, _AffineMatrix::tx, _AffineMatrix::ty, UndefinedPrimitive, _PointInfo::x, _RectangleInfo::x, _PointInfo::y, and _RectangleInfo::y.

Referenced by DrawBoundingRectangles(), and DrawImage().

static void DrawRoundLinecap ( Image image,
const DrawInfo draw_info,
const PrimitiveInfo primitive_info,
ExceptionInfo exception 
)
static
MagickExport void GetAffineMatrix ( AffineMatrix affine_matrix)
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
static AffineMatrix InverseAffineMatrix ( const AffineMatrix affine)
static
static MagickBooleanType IsPoint ( const char *  point)
inlinestatic

Definition at line 1654 of file draw.c.

References MagickFalse, MagickTrue, and StringToDouble().

Referenced by DrawImage(), and TracePath().

static void LogPathInfo ( const PathInfo path_info)
static
static ssize_t MagickAbsoluteValue ( const ssize_t  x)
inlinestatic

Definition at line 1060 of file draw.c.

Referenced by GetFillAlpha().

static double MagickMax ( const double  x,
const double  y 
)
inlinestatic

Definition at line 1067 of file draw.c.

Referenced by DrawAffineImage(), DrawImage(), GetFillAlpha(), and TraceEllipse().

static double MagickMin ( const double  x,
const double  y 
)
inlinestatic

Definition at line 1074 of file draw.c.

Referenced by DrawAffineImage(), and TraceBezier().

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

Definition at line 4864 of file draw.c.

Referenced by TraceBezier().

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

Definition at line 431 of file draw.c.

Referenced by ConvertPathToPolygon().

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

Definition at line 4896 of file draw.c.

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

Referenced by DrawImage().

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 
)
static void TraceCircle ( PrimitiveInfo primitive_info,
const PointInfo  start,
const PointInfo  end 
)

Definition at line 5136 of file draw.c.

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

Referenced by DrawImage().

static void TraceEllipse ( PrimitiveInfo primitive_info,
const PointInfo  start,
const PointInfo  stop,
const PointInfo  degrees 
)
static void TraceLine ( PrimitiveInfo primitive_info,
const PointInfo  start,
const PointInfo  end 
)
static void TracePoint ( PrimitiveInfo primitive_info,
const PointInfo  point 
)
inlinestatic
static void TraceRectangle ( PrimitiveInfo primitive_info,
const PointInfo  start,
const PointInfo  end 
)
static void TraceRoundRectangle ( PrimitiveInfo primitive_info,
const PointInfo  start,
const PointInfo  end,
PointInfo  arc 
)
static void TraceSquareLinecap ( PrimitiveInfo primitive_info,
const size_t  number_vertices,
const double  offset 
)

Definition at line 5691 of file draw.c.

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

Referenced by TraceStrokePolygon().