internal void AddOperation(Constants.Operations Op, Bitmap bmpData) { try { if (m_iIndex != -1) { //Simple loop to remove all after current point while (true) { //Check that index is greater than 1 because if its 0 it'll remove the first object, //and below that is out of range if (m_hoHistory.Count - 1 > m_iIndex && (m_iIndex >= 0 && m_hoHistory.Count > 1)) { m_hoHistory.RemoveAt(m_hoHistory.Count - 1); } else { break; } } } m_hoHistory.Add(new HistoryObject(bmpData, Op, Constants.strHistPath + "\\" + m_iID.ToString())); m_iIndex = m_hoHistory.Count - 1; } catch (Exception ex) { Global.WriteToLog(ex); } }
internal HistoryObject(Bitmap bmpImage, Constants.Operations Op, string CachePath) { m_bmpBitmap = (Bitmap)bmpImage.Clone(); m_bIsCached = false; m_Op = Op; m_strCachePath = CachePath; }
/// <summary> /// Authorizes a user based on their jwt token /// </summary> /// <param name="operation">The operation the user requested</param> /// <param name="jwtToken">The jwt token of the user</param> private void AuthorizeUser(Constants.Operations operation, ref string jwtToken) { bool isAuthorized = authorizationManager.AuthorizeUser(operation.ToString(), ref jwtToken); if (!isAuthorized) { throw new ArgumentException(Constants.TicketManagerUnauthorizedUpdateTickets); } }
public Bitmap BatchOp(Constants.Operations Op, List <object> Arguments) { Global.WriteToLog("Performing batch operation " + Op.ToString(), true); //Clear out previous stuff m_ahPrimaryAutomationHandler.Clear(); //Add op to handler m_ahPrimaryAutomationHandler.AddOperation(Op, Arguments); //Start handler m_ahPrimaryAutomationHandler.Start(m_ihPrimaryImageHandler.CurrentImageIndex); //Clear handler m_ahPrimaryAutomationHandler.Clear(); //Return current image. return(m_ihPrimaryImageHandler.CurrentImage); }
internal void AddOperation(Constants.Operations Op, List <object> Arguments) { m_OperationList.Add(Op); m_ArgumentList.Add(Arguments); }
/// <summary> /// Resizes the input image to a size fast to parse through, applys the operation and shows as a preview. Will show to the user upon preview generation /// </summary> /// <param name="Input">The source image</param> /// <param name="Operation">The operation to perform. Resize and File IO operations not supported</param> /// <param name="Arguments"></param> internal void SetPreviewImage(Bitmap Input, Constants.Operations Operation, List <object> Arguments) { try { //Sanity check if (Input == null) { return; } Global.WriteToLog("Generating preview...", true); //For now stretch image. We can worry about scaling later //m_bmpOutput = new Bitmap(Input, Constants.iPreviewSize, Constants.iPreviewSize);//Core.BasicOps.MaintainAspectRatio(new Size(Constants.iPreviewSize, Constants.iPreviewSize), Input.Size)); m_bmpOutput = new Bitmap(Input, Core.BasicOps.MaintainAspectRatio_DontExcedeNewSize(new Size(Constants.iPreviewSize, Constants.iPreviewSize), Input.Size)); //Switch to apply operations on the input image. Since we dont want actions to apply to the loaded images, //this bypasses the controller and talks directly to the core. switch (Operation) { case (Constants.Operations.AddText): m_bmpOutput = Core.OtherOps.AddCaption(m_bmpOutput, (Rectangle)(Arguments)[0], (string)(Arguments)[1], (Font)(Arguments)[2], (Brush)(Arguments)[3]); break; case (Constants.Operations.Brightness): m_bmpOutput = Core.RGB.Brightness(m_bmpOutput, (float)(Arguments)[0]); break; case (Constants.Operations.Crop): m_bmpOutput = Core.BasicOps.Crop(m_bmpOutput, (Rectangle)(Arguments)[0]); break; case (Constants.Operations.Dither): m_bmpOutput = Core.RGB.Dither_Atkinson(m_bmpOutput); break; case (Constants.Operations.Flip): m_bmpOutput = Core.BasicOps.Flip(m_bmpOutput, (Core.BasicOps.FlipAxis)(Arguments)[0]); break; case (Constants.Operations.Gamma): m_bmpOutput = Core.RGB.Gamma(m_bmpOutput, (float)(Arguments)[0], (float)(Arguments)[1], (float)(Arguments)[2]); break; case (Constants.Operations.Grayscale): m_bmpOutput = Core.RGB.Grayscale(m_bmpOutput); break; case (Constants.Operations.Hue): m_bmpOutput = Core.HLS.ChangeHue(m_bmpOutput, (float)(Arguments)[0]); break; case (Constants.Operations.Invert): m_bmpOutput = Core.RGB.Invert(m_bmpOutput); break; case (Constants.Operations.Luminosity): m_bmpOutput = Core.HLS.ChangeLuminosity(m_bmpOutput, (float)(Arguments)[0]); break; case (Constants.Operations.RemoveRedEye): m_bmpOutput = Core.OtherOps.RedEyeRemoval(m_bmpOutput, (Rectangle)(Arguments)[0]); break; case (Constants.Operations.Rotate): m_bmpOutput = Core.BasicOps.Rotate(m_bmpOutput, (Core.BasicOps.RotateDirection)(Arguments)[0]); break; case (Constants.Operations.Saturation): m_bmpOutput = Core.HLS.ChangeSaturation(m_bmpOutput, (float)(Arguments)[0]); break; case (Constants.Operations.Sepia): m_bmpOutput = Core.RGB.Sepia(m_bmpOutput); break; case Constants.Operations.ChromaKey: m_bmpOutput = Core.OtherOps.ChromaKey(m_bmpOutput, (Bitmap)(Arguments)[1], (float)(Arguments)[2]); break; default: throw new Exception("Unsupported preview task attempted"); } if (m_MouseoverPopup) { //Show popup this.Show(); MoveToMouse(); //Set as frontmost control this.BringToFront(); } } catch (Exception ex) { Global.WriteToLog(ex); Global.WriteToLog("Not showing preview because of exception", true, false); m_bmpOutput = null; if (m_MouseoverPopup) { this.Hide(); } } }
public void Automation_AddOperation(Constants.Operations Op, List <object> Arguments) { Global.WriteToLog("Adding operation" + Op.ToString() + " to automation list", true); m_ahPrimaryAutomationHandler.AddOperation(Op, Arguments); }