Ejemplo n.º 1
0
 /// <summary>
 /// Releases the unmanaged resources used by the ImageMagickSharp.PixelWand and optionally
 /// releases the managed resources. </summary>
 /// <param name="disposing"> true to release both managed and unmanaged resources; false to
 /// release only unmanaged resources. </param>
 protected virtual void Dispose(bool disposing)
 {
     if (this.Handle != IntPtr.Zero)
     {
         DrawingWandInterop.DestroyDrawingWand(this);
         this.Handle = IntPtr.Zero;
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the ImageMagickSharp.DrawingWand&lt;T&gt; class. </summary>
 /// <exception cref="Exception"> Thrown when an exception error condition occurs. </exception>
 public DrawingWand()
 {
     this.Handle = DrawingWandInterop.NewDrawingWand();
     if (this.Handle == IntPtr.Zero)
     {
         throw new Exception("Error acquiring wand.");
     }
 }
Ejemplo n.º 3
0
 /// <summary> Initializes a new instance of the ImageMagickSharp.DrawingWand class. </summary>
 /// <exception cref="Exception"> Thrown when an exception error condition occurs. </exception>
 /// <param name="fillColor"> The fill color. </param>
 internal DrawingWand(PixelWand fillColor)
 {
     this.Handle = DrawingWandInterop.NewDrawingWand();
     if (this.Handle == IntPtr.Zero)
     {
         throw new Exception("Error acquiring wand.");
     }
     this.FillColor = fillColor;
 }
Ejemplo n.º 4
0
 /// <summary> Clears the exception. </summary>
 public override void ClearException()
 {
     DrawingWandInterop.DrawClearException(this);
 }
Ejemplo n.º 5
0
        /// <summary> Draw ellipse. </summary>
        /// <param name="ox"> The origin x ordinate. </param>
        /// <param name="oy"> The origin y ordinate. </param>
        /// <param name="rx"> The radius of corner in horizontal direction. </param>
        /// <param name="ry"> The radius of corner in vertical direction. </param>
        /// <param name="start"> starting rotation in degrees. </param>
        /// <param name="end"> ending rotation in degrees. </param>

        /*private void DrawEllipse(double ox, double oy, double rx, double ry, double start, double end)
         * {
         *      DrawingWandInterop.DrawEllipse(this, ox, oy, rx, ry, start, end);
         * }
         *
         * /// <summary> Draw arc. </summary>
         * /// <param name="sx"> The starting x ordinate of bounding rectangle. </param>
         * /// <param name="sy"> The starting y ordinate of bounding rectangle. </param>
         * /// <param name="ex"> The ending x ordinate of bounding rectangle. </param>
         * /// <param name="ey"> The ending y ordinate of bounding rectangle. </param>
         * /// <param name="sd"> The starting degrees of rotation. </param>
         * /// <param name="ed"> The ending degrees of rotation. </param>
         * private void DrawArc(double sx, double sy, double ex, double ey, double sd, double ed)
         * {
         *      DrawingWandInterop.DrawArc(this, sx, sy, ex, ey, sd, ed);
         * }
         *
         * /// <summary> Draw line. </summary>
         * /// <param name="sx"> The starting x ordinate of bounding rectangle. </param>
         * /// <param name="sy"> The starting y ordinate of bounding rectangle. </param>
         * /// <param name="ex"> The ending x ordinate of bounding rectangle. </param>
         * /// <param name="ey"> The ending y ordinate of bounding rectangle. </param>
         * private void DrawLine(double sx, double sy, double ex, double ey)
         * {
         *      DrawingWandInterop.DrawLine(this, sx, sy, ex, ey);
         * }
         *
         * /// <summary> Draw affine. </summary>
         * /// <param name="affine"> The affine. </param>
         * private void DrawAffine(double[] affine)
         * {
         *      DrawingWandInterop.DrawAffine(this, affine);
         * }*/
        #endregion

        #region [Wand Methods - Exception]
        /// <summary> Gets the exception. </summary>
        /// <param name="exceptionSeverity"> The exception severity. </param>
        /// <returns> The exception. </returns>
        public override IntPtr GetException(out int exceptionSeverity)
        {
            IntPtr exceptionPtr = DrawingWandInterop.DrawGetException(this, out exceptionSeverity);

            return(exceptionPtr);
        }
Ejemplo n.º 6
0
 /// <summary> Draw circle. </summary>
 /// <param name="ox"> The origin x ordinate. </param>
 /// <param name="oy"> The origin y ordinate. </param>
 /// <param name="px"> The perimeter x ordinate. </param>
 /// <param name="py"> The perimeter y ordinate. </param>
 public void DrawCircle(double ox, double oy, double px, double py)
 {
     DrawingWandInterop.DrawCircle(this, ox, oy, px, py);
 }
Ejemplo n.º 7
0
 /// <summary> Draw round rectangle. </summary>
 /// <param name="x1"> The first x value. </param>
 /// <param name="y1"> The first y value. </param>
 /// <param name="x2"> The second x value. </param>
 /// <param name="y2"> The second y value. </param>
 /// <param name="rx"> The radius of corner in horizontal direction. </param>
 /// <param name="ry"> The radius of corner in vertical direction. </param>
 internal void DrawRoundRectangle(double x1, double y1, double x2, double y2, double rx, double ry)
 {
     DrawingWandInterop.DrawRoundRectangle(this, x1, y1, x2, y2, rx, ry);
 }
Ejemplo n.º 8
0
        /// <summary> Gets or sets the stroke opacity. </summary>
        /// <value> The stroke opacity. </value>

        /*private double StrokeOpacity
         * {
         *      get { return DrawingWandInterop.DrawGetStrokeOpacity(this); }
         *      set { DrawingWandInterop.DrawSetStrokeOpacity(this, value); }
         * }
         *
         * /// <summary> Gets or sets the width of the stroke. </summary>
         * /// <value> The width of the stroke. </value>
         * private double StrokeWidth
         * {
         *      get { return DrawingWandInterop.DrawGetStrokeWidth(this); }
         *      set { DrawingWandInterop.DrawSetStrokeWidth(this, value); }
         * }*/

        /// <summary> Gets or sets the color of the text under. </summary>
        /// <value> The color of the text under. </value>

        /*private PixelWand TextUnderColor
         * {
         *      /* NOT WORKINGget
         *      {
         *              IntPtr background;
         *              DrawingWandInterop.DrawGetTextUnderColor(this, out background);
         *              return new PixelWand(background);
         *      }*/
        /*set { DrawingWandInterop.DrawSetTextUnderColor(this, value); }
         * }
         *
         * /// <summary> Draw color. </summary>
         * /// <param name="x"> The x coordinate. </param>
         * /// <param name="y"> The y coordinate. </param>
         * /// <param name="paintmethod"> The paintmethod. </param>
         * private void DrawColor(double x, double y, PaintMethodType paintmethod)
         * {
         * DrawingWandInterop.DrawColor(this, x, y, paintmethod);
         * }*/

        #endregion

        #region [Drawing Wand Methods - Geometry]
        /// <summary> Draw rectangle. </summary>
        /// <param name="x1"> The first x value. </param>
        /// <param name="y1"> The first y value. </param>
        /// <param name="x2"> The second x value. </param>
        /// <param name="y2"> The second y value. </param>
        public void DrawRectangle(double x1, double y1, double x2, double y2)
        {
            DrawingWandInterop.DrawRectangle(this, x1, y1, x2, y2);
        }
Ejemplo n.º 9
0
 /// <summary> Draw annotation. </summary>
 /// <param name="x"> The x coordinate. </param>
 /// <param name="y"> The y coordinate. </param>
 /// <param name="text"> The text. </param>
 public void DrawAnnotation(double x, double y, string text)
 {
     DrawingWandInterop.DrawAnnotation(this, x, y, text);
 }
Ejemplo n.º 10
0
        /// <summary> Gets or sets a value indicating whether the stroke antialias. </summary>
        /// <value> true if stroke antialias, false if not. </value>

        /*private bool StrokeAntialias
         * {
         *      get { return DrawingWandInterop.DrawGetStrokeAntialias(this); }
         *      set { DrawingWandInterop.DrawSetStrokeAntialias(this, value); }
         * }
         *
         * /// <summary> Gets or sets the fill opacity. </summary>
         * /// <value> The fill opacity. </value>
         * private double FillOpacity
         * {
         *      get { return DrawingWandInterop.DrawGetFillOpacity(this); }
         *      set { DrawingWandInterop.DrawSetFillOpacity(this, value); }
         * }
         *
         * /// <summary> Gets or sets the opacity. </summary>
         * /// <value> The opacity. </value>
         * private double Opacity
         * {
         *      get { return DrawingWandInterop.DrawGetOpacity(this); }
         *      set { DrawingWandInterop.DrawSetOpacity(this, value); }
         * }
         *
         * /// <summary> Gets or sets the vector graphics. </summary>
         * /// <value> The vector graphics. </value>
         * private string VectorGraphics
         * {
         *      get { return DrawingWandInterop.DrawGetVectorGraphics(this); }
         *      set { DrawingWandInterop.DrawSetVectorGraphics(this, value); }
         * }*/

        /// <summary> Draw composite. </summary>
        /// <param name="compose"> The compose. </param>
        /// <param name="x"> The x coordinate. </param>
        /// <param name="y"> The y coordinate. </param>
        /// <param name="width"> The width. </param>
        /// <param name="height"> The height. </param>
        /// <param name="imageWand"> The magickwand. </param>
        /// <returns> true if it succeeds, false if it fails. </returns>
        internal bool DrawComposite(CompositeOperator compose, double x, double y, double width, double height, ImageWand imageWand)
        {
            return(this.CheckErrorBool(DrawingWandInterop.DrawComposite(this, compose, x, y, width, height, imageWand.MagickWand.Handle)));
        }