public void TestAlphaRegex() { const string Querystring = "alpha=56"; const int Expected = 56; Alpha alpha = new Alpha(); alpha.MatchRegexIndex(Querystring); int actual = alpha.DynamicParameter; Assert.AreEqual(Expected, actual); }
/// <summary> /// Changes the opacity of the current image. /// </summary> /// <param name="percentage"> /// The percentage by which to alter the images opacity. /// Any integer between 0 and 100. /// </param> /// <returns> /// The current instance of the <see cref="T:ImageProcessor.ImageFactory"/> class. /// </returns> public ImageFactory Alpha(int percentage) { if (this.ShouldProcess) { // Sanitize the input. percentage = ImageMaths.Clamp(percentage, 0, 100); Alpha alpha = new Alpha { DynamicParameter = percentage }; this.CurrentImageFormat.ApplyProcessor(alpha.ProcessImage, this); } return this; }
/// <summary> /// Changes the opacity of the current image. /// </summary> /// <param name="percentage"> /// The percentage by which to alter the images opacity. /// Any integer between 0 and 100. /// </param> /// <returns> /// The current instance of the <see cref="T:ImageProcessor.ImageFactory"/> class. /// </returns> public ImageFactory Alpha(int percentage) { if (this.ShouldProcess) { // Sanitize the input. if (percentage > 100 || percentage < 0) { percentage = 0; } Alpha alpha = new Alpha { DynamicParameter = percentage }; this.Image = alpha.ProcessImage(this); } return this; }
/// <summary> /// Changes the opacity of the current image. /// </summary> /// <param name="percentage"> /// The percentage by which to alter the images opacity. /// Any integer between 0 and 100. /// </param> /// <returns> /// The current instance of the <see cref="T:ImageProcessor.ImageFactory"/> class. /// </returns> public ImageFactory Alpha(int percentage) { if (this.ShouldProcess) { // Sanitize the input. // You can't make an image less transparent. if (percentage < 0 || percentage > 99) { return this; } Alpha alpha = new Alpha { DynamicParameter = percentage }; this.backupFormat.ApplyProcessor(alpha.ProcessImage, this); } return this; }