MagickCore  7.0.1
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   (1.0e-6)
 

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)
 
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   (1.0e-6)

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 201 of file draw.c.

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

Referenced by GradientImage().

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 240 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(), RenderHoughLines(), RenderType(), and VignetteImage().

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

Definition at line 383 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 5835 of file draw.c.

References DrawEpsilon.

Referenced by TraceStrokePolygon().

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

Definition at line 1666 of file draw.c.

References AcquireImageInfo(), AcquireMagickMemory(), AcquireQuantumMemory(), AcquireString(), _DrawInfo::affine, _DrawInfo::align, AllCompliance, _PixelInfo::alpha, _DrawInfo::alpha, AlphaPrimitive, ArcPrimitive, BezierPrimitive, BezierQuantum, _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, _DrawInfo::direction, DrawClipPath(), DrawError, DrawEvent, DrawPatternPath(), DrawPrimitive(), EllipsePrimitive, _Image::filename, _ImageInfo::filename, FileToString(), _DrawInfo::fill, _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, ObjectBoundingBox, _StopInfo::offset, 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_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(), and VignetteImage().

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

Definition at line 4209 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(), 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, MagickEpsilon, 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().

static void DrawRoundLinecap ( Image image,
const DrawInfo draw_info,
const PrimitiveInfo primitive_info,
ExceptionInfo exception 
)
static
MagickExport void GetAffineMatrix ( AffineMatrix affine_matrix)
MagickExport void GetDrawInfo ( const ImageInfo image_info,
DrawInfo draw_info 
)

Definition at line 4832 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, _DrawInfo::encoding, EvenOddRule, _DrawInfo::family, _DrawInfo::fill, _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_antialias, _DrawInfo::stroke_width, _DrawInfo::style, _DrawInfo::text_antialias, TraceEvent, TransparentAlpha, UndefinedDirection, _DrawInfo::undercolor, and _DrawInfo::weight.

Referenced by AcquireDrawInfo(), and CloneDrawInfo().

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 1647 of file draw.c.

References MagickFalse, MagickTrue, and StringToDouble().

Referenced by DrawImage(), and TracePath().

static void LogPathInfo ( const PathInfo path_info)
static
static double Permutate ( const ssize_t  n,
const ssize_t  k 
)
inlinestatic

Definition at line 4964 of file draw.c.

Referenced by TraceBezier().

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

Definition at line 442 of file draw.c.

Referenced by ConvertPathToPolygon().

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

Definition at line 3264 of file draw.c.

References MagickEpsilon, and _StopInfo::offset.

Referenced by DrawGradientImage().

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

Definition at line 4996 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 5236 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 5787 of file draw.c.

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

Referenced by TraceStrokePolygon().