/// <summary> /// Constructor caller of base constructor /// Also reads a saves LUT file by its filename /// </summary> /// <param name="mod">One of provided image modifications</param> /// <param name="imageSet">Pointer to image set from engine</param> /// <param name="name">LUT filename</param> public ApplyLUT(ImageModification mod, ImageSet imageSet, string name) : base(mod, imageSet) { Tuple <int, Tuple <byte, byte, byte> [, , ]> lut = LookUpTable.Read(name); size = lut.Item1; map = lut.Item2; }
/// <summary> /// Processes adjustment of saturation, brightness and clarity /// </summary> /// <param name="mod">adjustment type</param> /// <param name="newValue">new value from numeric field</param> private void OnSyncValues(ImageModification mod, int newValue) { ColorEdit task; switch (mod) { case ImageModification.Saturation: task = new SaturationEdit(ImageModification.Saturation, imageSet, newValue); log.Add("Image saturation modified"); break; case ImageModification.Brightness: task = new BrightnessEdit(ImageModification.Brightness, imageSet, newValue); log.Add("Image brightness modified"); break; case ImageModification.Clarity: task = new ClarityEdit(ImageModification.Clarity, imageSet, newValue); log.Add("Image clarity modified"); break; default: task = null; break; } taskControl.Add(task); taskControl.CheckAndProcess(); }
/// <summary> /// Constructor caller of base constructor and color exchange parser /// </summary> /// <param name="mod">One of provided image modifications</param> /// <param name="imageSet">Pointer to image set from engine</param> /// <param name="first">First color</param> /// <param name="second">Second color</param> public ColorChange(ImageModification mod, ImageSet imageSet, string first, string second) : base(mod, imageSet) { this.first = -1; this.second = -1; switch (first) { case "red": this.first = 0; break; case "green": this.first = 1; break; case "blue": this.first = 2; break; } switch (second) { case "red": this.second = 0; break; case "green": this.second = 1; break; case "blue": this.second = 2; break; } }
/// <summary> /// Initialize image task type, image color filter (as image view mode), image set and /// other variables with defaults /// </summary> /// <param name="mod">One of provided image modifications</param> /// <param name="imageSet">Pointer to image set from engine</param> public ImageTask(ImageModification mod, ImageSet imageSet) { taskType = mod; ongoing = false; previous = null; next = null; iSet = imageSet; iMode = iSet.imageMode; }
public void ShuiYinToImage(string imgPath) { try { ImageModification imgM = new ImageModification(); imgM.ModifyImagePath = imgPath; imgM.DrawedImagePath = Server.MapPath("~/") + "UserFiles\\shuiyinSource.png"; imgM.LucencyPercent = 80; imgM.BottoamSpace = 50; imgM.RightSpace = 260; imgM.DrawImage(); } catch { } }
/// <summary> /// Create restore point and initialize values from current image set /// </summary> /// <param name="mode">Image view mode</param> /// <param name="taskType">Task type</param> /// <param name="image">Main image</param> /// <param name="thumb">Thumbnail image</param> /// <param name="saturation">Saturation level</param> /// <param name="brightness">Brightness level</param> /// <param name="clarity">Clarity level</param> public RestorePoint( ImageMode mode, ImageModification taskType, Bitmap image, Bitmap thumb, int saturation, int brightness, int clarity ) { this.mode = mode; this.taskType = taskType; this.image = image; this.thumb = thumb; this.saturation = saturation; this.brightness = brightness; this.clarity = clarity; }
static void Main(string[] args) { Console.Write("Write the path to the picture you want to alternate here: "); var inputPath = Console.ReadLine(); var inputImage = Image.FromFile(inputPath); var inputImageWidth = inputImage.Width; var inputImageHeight = inputImage.Height; if (inputImageWidth < 200 && inputImageHeight < 200) { Console.WriteLine("Your input picture cannot be smaller then 200 x 200! Try again!"); } else if (inputImageWidth > 1920 && inputImageHeight > 1080) { Console.WriteLine("Your input pictrue cannot be bigger then 1920 x 1080! Try again!"); } else { var inputPicture = new Bitmap(inputImage); var inputPictureOne = new Bitmap(inputImage); var inputPictureTwo = new Bitmap(inputImage); ImageModification.MakeNegativePicture(inputPicture, inputPath); ImageModification.MakeBlurredPicture(inputPictureOne, inputPath); ImageModification.MakeGrayscalePicture(inputPictureTwo, inputPath); } /*Löser inte detta * try * { * * * } * catch (FileNotFoundException fileNotFound) * { * Console.WriteLine("The file was not found, please try again", fileNotFound); * } * catch (ArgumentException noFileInput) * { * Console.WriteLine("You need to enter a path to an imagefile that you would like to modify", noFileInput); * } */ }
/// <summary> /// Constructor caller of base constructor /// </summary> /// <param name="mod">One of provided image modifications</param> /// <param name="imageSet">Pointer to image set from engine</param> public ColorInvert(ImageModification mod, ImageSet imageSet) : base(mod, imageSet) { }
/// <summary> /// Constructor caller of base constructor /// </summary> /// <param name="mod">One of provided image modifications</param> /// <param name="imageSet">Pointer to image set from engine</param> public ColorTask(ImageModification mod, ImageSet imageSet) : base(mod, imageSet) { }
/// <summary> /// Constructor caller of base constructor /// </summary> /// <param name="mod">One of provided image modifications</param> /// <param name="imageSet">Pointer to image set from engine</param> /// <param name="value">Particular edit level</param> public SaturationEdit(ImageModification mod, ImageSet imageSet, int value) : base(mod, imageSet, value) { }
/// <summary> /// Constructor caller of base constructor /// </summary> /// <param name="mod">One of provided image modifications</param> /// <param name="imageSet">Pointer to image set from engine</param> public FlipTask(ImageModification mod, ImageSet imageSet) : base(mod, imageSet) { }
/// <summary> /// Constructor caller of base constructor /// </summary> /// <param name="mod">One of provided image modifications</param> /// <param name="imageSet">Pointer to image set from engine</param> /// <param name="value">Particular edit level</param> public BrightnessEdit(ImageModification mod, ImageSet imageSet, int value) : base(mod, imageSet, value) { }
/// <summary> /// Constructor caller of base constructor /// Inicialize also edit value /// </summary> /// <param name="mod">One of provided image modifications</param> /// <param name="imageSet">Pointer to image set from engine</param> /// <param name="value">Particular edit level</param> public ColorEdit(ImageModification mod, ImageSet imageSet, int value) : base(mod, imageSet) { this.value = value; }
/// <summary> /// Constructor caller of base constructor /// </summary> /// <param name="mod">One of provided image modifications</param> /// <param name="imageSet">Pointer to image set from engine</param> public FlipHorizontal(ImageModification mod, ImageSet imageSet) : base(mod, imageSet) { }
/// <summary> /// Constructor caller of base constructor /// </summary> /// <param name="mod">One of provided image modifications</param> /// <param name="imageSet">Pointer to image set from engine</param> public ApplyGreyStyle(ImageModification mod, ImageSet imageSet) : base(mod, imageSet) { }
/// <summary> /// Constructor caller of base constructor /// </summary> /// <param name="mod">One of provided image modifications</param> /// <param name="imageSet">Pointer to image set from engine</param> public FlipVertical(ImageModification mod, ImageSet imageSet) : base(mod, imageSet) { }
/// <summary> /// Constructor caller of base constructor /// </summary> /// <param name="mod">One of provided image modifications</param> /// <param name="imageSet">Pointer to image set from engine</param> /// <param name="value">Particular edit level</param> public ClarityEdit(ImageModification mod, ImageSet imageSet, int value) : base(mod, imageSet, value) { }