MagickCore  6.7.5
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

Defines

#define BezierQuantum   200
#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 MagickRealType, 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 MagickRealType)
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 MagickRealType 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 MagickRealType GetFillAlpha (PolygonInfo *polygon_info, const MagickRealType mid, const MagickBooleanType fill, const FillRule fill_rule, const double x, const double y, MagickRealType *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 MagickRealType Permutate (const ssize_t n, const ssize_t k)

Define Documentation

#define BezierQuantum   200

Definition at line 86 of file draw.c.

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

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


Function Documentation

MagickExport DrawInfo* AcquireDrawInfo ( void  )

Definition at line 196 of file draw.c.

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

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

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

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

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

Definition at line 368 of file draw.c.

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

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]
MagickExport MagickBooleanType DrawImage ( Image image,
const DrawInfo draw_info,
ExceptionInfo exception 
)

Definition at line 1667 of file draw.c.

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

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

References _Image::debug, MagickFalse, LogMagickEvent(), DrawEvent, GetMagickModule, _DrawInfo::affine, _AffineMatrix::sx, _AffineMatrix::rx, _AffineMatrix::ry, _AffineMatrix::sy, _AffineMatrix::tx, _AffineMatrix::ty, MagickTrue, _PrimitiveInfo::point, _PointInfo::x, _PointInfo::y, AcquireCacheView(), _PrimitiveInfo::primitive, PointPrimitive, _Image::rows, _Image::columns, GetCacheViewAuthenticPixels(), GetFillColor(), CompositePixelOver(), _PixelInfo::alpha, GetPixelAlpha(), SyncCacheViewAuthenticPixels(), ColorPrimitive, _PrimitiveInfo::method, PointMethod, GetPixelInfo(), SetPixelInfoPixel(), ReplaceMethod, CompositePixelChannel, GetOneCacheViewVirtualPixel(), _PixelInfo::red, RedPixelChannel, _PixelInfo::green, GreenPixelChannel, _PixelInfo::blue, BluePixelChannel, AlphaPixelChannel, GetPixelInfoPixel(), IsFuzzyEquivalencePixelInfo(), GetPixelChannels(), FloodfillMethod, FillToBorderMethod, GetOneVirtualPixelInfo(), TileVirtualPixelMethod, _DrawInfo::border_color, FloodfillPaintImage(), ResetMethod, MattePrimitive, _Image::matte, SetImageAlphaChannel(), OpaqueAlphaChannel, SetPixelAlpha(), ClampToQuantum(), SetPixelChannelMask(), AlphaChannel, TextPrimitive, MaxTextExtent, _PrimitiveInfo::text, CloneDrawInfo(), CloneString(), _DrawInfo::text, FormatLocaleString(), _DrawInfo::geometry, AnnotateImage(), DestroyDrawInfo(), ImagePrimitive, AcquireImageInfo(), LocaleNCompare(), ReadInlineImage(), CopyMagickString(), _ImageInfo::filename, ReadImage(), DestroyImageInfo(), SetImageProgressMonitor(), _Image::filter, TransformImage(), _DrawInfo::alpha, OpaqueAlpha, SetImageAlpha(), SetGeometry(), _Image::gravity, _DrawInfo::gravity, _RectangleInfo::x, _RectangleInfo::y, ParseGravityGeometry(), _Image::interpolate, _DrawInfo::compose, OverCompositeOp, DrawAffineImage(), CompositeImage(), DestroyImage(), IsEventLogging(), LogPrimitiveInfo(), ExpandAffine(), _DrawInfo::dash_pattern, _DrawInfo::stroke_width, MagickEpsilon, _DrawInfo::stroke, TransparentAlpha, DrawPolygonPrimitive(), DrawDashPolygon(), UndefinedPrimitive, _DrawInfo::linecap, RoundCap, _DrawInfo::linejoin, RoundJoin, DrawStrokePolygon(), and DestroyCacheView().

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 AffineMatrix InverseAffineMatrix ( const AffineMatrix affine) [static]
static MagickBooleanType IsPoint ( const char *  point) [inline, static]

Definition at line 1648 of file draw.c.

References StringToDouble(), MagickFalse, and MagickTrue.

Referenced by DrawImage(), and TracePath().

static void LogPathInfo ( const PathInfo path_info) [static]
static ssize_t MagickAbsoluteValue ( const ssize_t  x) [inline, static]

Definition at line 1055 of file draw.c.

Referenced by GetFillAlpha().

static double MagickMax ( const double  x,
const double  y 
) [inline, static]

Definition at line 1062 of file draw.c.

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

static double MagickMin ( const double  x,
const double  y 
) [inline, static]

Definition at line 1069 of file draw.c.

Referenced by DrawAffineImage(), and TraceBezier().

static MagickRealType Permutate ( const ssize_t  n,
const ssize_t  k 
) [inline, static]

Definition at line 4866 of file draw.c.

Referenced by TraceBezier().

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

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

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

Referenced by DrawImage().

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

Definition at line 5138 of file draw.c.

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

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 
) [inline, static]
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 MagickRealType  offset 
)

Definition at line 5693 of file draw.c.

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

Referenced by TraceStrokePolygon().