Exemple #1
0
        /// <summary>
        ///     Injecte un contrat au sein d'un gestionnaire adapté et retourne l'observable
        ///     de finalisation.
        /// </summary>
        /// <typeparam name="TContract">Type de contrat injecté.</typeparam>
        /// <param name="contract">Contrat injecté.</param>
        /// <param name="manager">Gestionnaire utilisé.</param>
        /// <param name="postback">Actions complémentaires.</param>
        /// <param name="async">Mode asynchrone.</param>
        /// <returns>Observable correspondant.</returns>
        private IObservable <ContractResult> Run <TContract>(TContract contract, IContractManager <TContract> manager, Action <QuickProcess> postback, bool async)
            where TContract : IContract
        {
            // Gestion du statut
            if (CurrentStatus != ContractStatus.RUNNING)
            {
                throw new EngineException("Processes piling can only be done inside of an 'Execute()' treatment");
            }

            // Gestion de l'observable
            if (!async)
            {
                SubProcesses.Add(contract);
            }

            // Gestion du retour
            if (postback != null)
            {
                contract.OnFinalized.Subscribe((result) =>
                {
                    var sub = new QuickProcess(Engine, postback);
                    Engine.ProcessManager.Inject(sub);
                });
            }

            // Injection et renvoi
            manager.Inject(contract);
            return(contract.OnFinalized);
        }
Exemple #2
0
        public void Rotate_Angle10AndNegative_ReturnsImage(float angle)
        {
            // Act
            var result = QuickProcess.Rotate(_image, angle);

            // Assert
            result.ShouldSatisfyAllConditions
            (
                () => result.Width.ShouldBe(215),
                () => result.Height.ShouldBe(134)
            );
        }
Exemple #3
0
        public void Rotate_Angle0_ShouldReturnRotatedImage(float angle)
        {
            // Act
            var result = QuickProcess.Rotate(_image, angle);

            // Assert
            result.ShouldSatisfyAllConditions
            (
                () => result.Width.ShouldBe(number2),
                () => result.Height.ShouldBe(number1)
            );
        }
Exemple #4
0
        public void ResizeCanvas_WithAnchorType_ShouldReturnImage(int width,
                                                                  int heigth, AnchorType anchorType)
        {
            // Act
            var result = QuickProcess.ResizeCanvas(_image, width, heigth,
                                                   anchorType, color);

            // Assert
            result.ShouldSatisfyAllConditions
            (
                () => result.Size.ShouldNotBeNull(),
                () => result.Height.ShouldBe(heigth),
                () => result.Width.ShouldBe(width)
            );
        }
        /*
         * /// <summary>
         * /// Gets or sets the license key.
         * /// </summary>
         * public string License
         * {
         *      get
         *      {
         *              return _license;
         *      }
         *
         *      set
         *      {
         *              _license = value;
         *      }
         * }*/

        /// <summary>
        /// Brightnesses the image with the specified brightness.
        /// </summary>
        /// <param name="brightness">The brightness.</param>
        public void Brightness(int brightness)
        {
            _image = QuickProcess.Brightness(_image, brightness);
        }
 /// <summary>
 /// Spheres the image.
 /// </summary>
 public void Sphere()
 {
     _image = QuickProcess.Sphere(_image);
 }
 /// <summary>
 /// Pixelizes the image with the specified pixel size.
 /// </summary>
 /// <param name="pixelSize">Size of the pixel.</param>
 /// <param name="grid">if set to <c>true</c> [grid].</param>
 /// <param name="gridColor">Color of the grid.</param>
 public void Pixelize(short pixelSize, bool grid, Color gridColor)
 {
     _image = QuickProcess.Pixelize(_image, pixelSize, grid, gridColor);
 }
 /// <summary>
 /// Jiffers the image with the specified degree.
 /// </summary>
 /// <param name="degree">The degree.</param>
 public void Jiffer(int degree)
 {
     _image = QuickProcess.Jiffer(_image, degree);
 }
 /// <summary>
 /// Inverts the image.
 /// </summary>
 public void Invert()
 {
     _image = QuickProcess.Invert(_image);
 }
 /// <summary>
 /// Gammas the image with the specified color.
 /// </summary>
 /// <param name="red">The red color.</param>
 /// <param name="green">The green color.</param>
 /// <param name="blue">The blue color.</param>
 public void Gamma(int red, int green, int blue)
 {
     _image = QuickProcess.Gamma(_image, red, green, blue);
 }
 /// <summary>
 /// Crops the image with the specified selection.
 /// </summary>
 /// <param name="selection">The selection.</param>
 public void Crop(Selection selection)
 {
     //SetLicense();
     _image = QuickProcess.Crop(_image, selection.X1, selection.Y1, selection.X2, selection.Y2);
 }
 /// <summary>
 /// Crops the specified point.
 /// </summary>
 /// <param name="from">From point.</param>
 /// <param name="to">To point.</param>
 public void Crop(Point from, Point to)
 {
     //SetLicense();
     _image = QuickProcess.Crop(_image, from, to);
 }
 /// <summary>
 /// Resizes the canvas.
 /// </summary>
 /// <param name="width">The width.</param>
 /// <param name="height">The height.</param>
 /// <param name="anchor">The anchor.</param>
 /// <param name="background">The background.</param>
 public void ResizeCanvas(int width, int height, AnchorType anchor, Color background)
 {
     //SetLicense();
     _image = QuickProcess.ResizeCanvas(_image, width, height, anchor, background);
 }
 /// <summary>
 /// Resizes the image.
 /// </summary>
 /// <param name="width">The width.</param>
 /// <param name="height">The height.</param>
 /// <param name="constrainProportions">if set to <c>true</c> constrains proportions.</param>
 /// <param name="resizeSmaller">if set to <c>true</c> resize smaller.</param>
 public void ResizeImage(int width, int height, bool constrainProportions, bool resizeSmaller)
 {
     //SetLicense();
     _image = QuickProcess.ResizeImage(_image, width, height, constrainProportions, resizeSmaller);
 }
 /// <summary>
 /// Colorizes the image with the specified red.
 /// </summary>
 /// <param name="red">The red color.</param>
 /// <param name="green">The green color.</param>
 /// <param name="blue">The blue color.</param>
 public void Colorize(int red, int green, int blue)
 {
     _image = QuickProcess.Colorize(_image, red, green, blue);
 }
 /// <summary>
 /// Contrasts the specified contrast value.
 /// </summary>
 /// <param name="contrastValue">The contrast value.</param>
 public void Contrast(int contrastValue)
 {
     _image = QuickProcess.Contrast(_image, contrastValue);
 }
 /// <summary>
 /// Crops the image with specified selection.
 /// </summary>
 /// <param name="xFrom">The x from position.</param>
 /// <param name="yFrom">The y from position.</param>
 /// <param name="xTo">The x to position.</param>
 /// <param name="yTo">The y to position.</param>
 public void Crop(int xFrom, int yFrom, int xTo, int yTo)
 {
     //SetLicense();
     _image = QuickProcess.Crop(_image, xFrom, yFrom, xTo, yTo);
 }
 /// <summary>
 /// Grayscale the image.
 /// </summary>
 public void GrayScale()
 {
     _image = QuickProcess.GrayScale(_image);
 }
 /// <summary>
 /// Flips the image with the specified flip type.
 /// </summary>
 /// <param name="flipType">Type of the flip.</param>
 public void Flip(FlipType flipType)
 {
     //SetLicense();
     _image = QuickProcess.Flip(_image, flipType);
 }
 /// <summary>
 /// Image edges detection.
 /// </summary>
 /// <param name="threshold">The threshold.</param>
 public void EdgeDetection(byte threshold)
 {
     _image = QuickProcess.EdgeDetection(_image, threshold);
 }
 /// <summary>
 /// Zooms the image with the specified x position.
 /// </summary>
 /// <param name="xPos">The x position.</param>
 /// <param name="yPos">The y position.</param>
 /// <param name="factor">The factor.</param>
 public void Zoom(int xPos, int yPos, float factor)
 {
     //SetLicense();
     _image = QuickProcess.Zoom(_image, xPos, yPos, factor);
 }
 /// <summary>
 /// Luminances the image with the specified factor.
 /// </summary>
 /// <param name="factor">The factor.</param>
 public void Luminance(int factor)
 {
     _image = QuickProcess.Luminance(_image, factor);
 }
 /// <summary>
 /// Rotates the image with the specified angle.
 /// </summary>
 /// <param name="angle">The angle.</param>
 public void Rotate(float angle)
 {
     //SetLicense();
     _image = QuickProcess.Rotate(_image, angle);
 }
 /// <summary>
 /// Satures the images with the specified factor.
 /// </summary>
 /// <param name="factor">The factor.</param>
 public void Saturation(int factor)
 {
     _image = QuickProcess.Saturation(_image, factor);
 }
 /// <summary>
 /// Rotates the image at right.
 /// </summary>
 public void RotateRight()
 {
     //SetLicense();
     _image = QuickProcess.RotateRight(_image);
 }
 /// <summary>
 /// Waters the image with the specified wave.
 /// </summary>
 /// <param name="wave">The wave.</param>
 public void Water(int wave)
 {
     _image = QuickProcess.Water(_image, wave);
 }
 /// <summary>
 /// Adds image text.
 /// </summary>
 /// <param name="text">The text.</param>
 /// <param name="font">The font.</param>
 /// <param name="size">The size.</param>
 /// <param name="style">The style.</param>
 /// <param name="foreColor">Fore color.</param>
 /// <param name="antialias">if set to <c>true</c> using of antialias.</param>
 /// <param name="xpos">The x position.</param>
 /// <param name="ypos">The y position.</param>
 /// <param name="aligment">The aligment.</param>
 public void AddText(string text, string font, int size, FontStyle style, System.Drawing.Color foreColor, bool antialias, int xpos, int ypos, StringAlignment aligment)
 {
     //SetLicense();
     _image = QuickProcess.AddText(_image, text, font, size, style, foreColor, antialias, xpos, ypos, aligment);
 }