Ejemplo n.º 1
0
     public ComplexCorrection(ComplexCorrection inputCorrection)
 {
         Red = inputCorrection.Red;
         Green = inputCorrection.Green;
         Blue = inputCorrection.Blue;
         Master = inputCorrection.Master;
         Contrast = inputCorrection.Contrast;
         Saturation = inputCorrection.Saturation;
         Rotation = inputCorrection.Rotation;
 }
Ejemplo n.º 2
0
        public static Bitmap ProcessBitmap(Bitmap bitmap, ComplexCorrection icorrection, int width, int height)
        {
            if (icorrection == null)
            {
                icorrection = new ComplexCorrection();
            }

            if (icorrection.Contrast.Value != 0)
            {
                float contLevel;
                {
                    if (icorrection.Contrast.Value >= .98)
                    {
                        contLevel = .97f;
                    }
                    else
                    {
                        contLevel = icorrection.Contrast.Value;
                    }
                }
                bitmap.ColorAdjustment.Contrast(contLevel);
            }

            bitmap = AdjustLevels(bitmap, icorrection);

            if (icorrection.Rotation.Value != 0)
            {
                bitmap.Transforms.Rotate(icorrection.Rotation.Value);
            }

            if (icorrection.Saturation.Value != 0)
            {
                float satLevel;
                {
                    if (icorrection.Saturation.Value >= 1)
                    {
                        satLevel = .99f;
                    }
                    else
                    {
                        satLevel = icorrection.Saturation.Value;
                    }
                }
                bitmap.ColorAdjustment.AdjustHsl(0, satLevel, 0);
            }

            return bitmap;
        }
Ejemplo n.º 3
0
 public static Bitmap ProcessBitmap(string path, ComplexCorrection correction, int width, int height)
 {
     return ProcessBitmap(new Bitmap(path), correction, width, height);
 }
Ejemplo n.º 4
0
 private static Bitmap AdjustLevels(Bitmap bmp, ComplexCorrection cx)
 {
     bmp = AdjustChannelLevels(bmp, Channel.Red, cx.Red.GetLevelsValues());
     bmp = AdjustChannelLevels(bmp, Channel.Green, cx.Green.GetLevelsValues());
     bmp = AdjustChannelLevels(bmp, Channel.Blue, cx.Blue.GetLevelsValues());
     bmp = ApplyLevels(bmp, cx.Master.GetLevelsValues());
     return bmp;
 }
Ejemplo n.º 5
0
        public void CheckForCorrections(string order, string roll, string frame)
        {
            using (MySqlConnection connection = new MySqlConnection(_cs))
            using (MySqlCommand pullCommand = connection.CreateCommand())
            {
                try
                {
                    connection.Open();
                    pullCommand.CommandText = "SELECT * FROM `pvcc` WHERE `order` = '@order' AND `roll` = '@roll' AND `frame` = '@frame'";
                    pullCommand.CommandText = pullCommand.CommandText.Replace("@order", order).Replace("@roll", roll).Replace("@frame", frame);

                    using (MySqlDataReader reader = pullCommand.ExecuteReader())
                    {
                        if (reader.HasRows)
                        {
                            while (reader.Read())
                            {
                                thumbCorrection = JsonConvert.DeserializeObject<ComplexCorrection>(reader.GetString("cc"));
                            }
                        }
                        else
                        {
                            thumbCorrection = new ComplexCorrection();
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
Ejemplo n.º 6
0
 private void KeepOriginalRotation(string thisFile)
 {
     //GetDataFromFilename(thisFile);
     rValue = GetCurrentRotation(thisFile);
     string correction = JsonConvert.SerializeObject(_correctionData);
     if (holdCorrections.Checked)
     {
         correction = heldCorrectionString;
     }
     int splitSpot = correction.LastIndexOf(":");
     string firsthalf = correction.Substring(0, splitSpot);
     string secondHalf = correction.Substring(splitSpot);
     if (rValue == "")
     {
         rValue = "0.0";
     }
     secondHalf = @":" + rValue + "}}";
     correction = firsthalf + secondHalf;
     using (var sr = new StringReader(correction))
     using (var jr = new JsonTextReader(sr))
     {
         var js = new JsonSerializer();
         _correctionData = js.Deserialize<ComplexCorrection>(jr);
     }
     LookForDbEntry(correction);
 }
Ejemplo n.º 7
0
        private void LoadImage(string path)
        {
            _lastCorrection = new ComplexCorrection(_correctionData);

            SaveIfNecessary();

            originalPic.ImageLocation = path;
            ShrinkWorkingImage(path);
            currentImage = resizedImage;
            _currentBitmap = new Aurigma.GraphicsMill.Bitmap(currentImage);
            GetDataFromFilename(path);
            if (rollingCorrection.Checked)
            {
                hasCC = true;
                KeepOriginalRotation(Path.GetFileNameWithoutExtension(path));
            }
            else if (holdCorrections.Checked)
            {
                hasCC = true;
                KeepOriginalRotation(Path.GetFileNameWithoutExtension(path));

                UpdateTextBoxes();
            }
            else
            {
                DeserializeIt(pvorder, pvroll, pvframe);
            }
            UpdateImageAndCorrections();
            currentRotation = (int)_correctionData.Rotation.Value;
            AdjustHoldRotation();
        }
Ejemplo n.º 8
0
 private void ProcessRecall(int which, string thisFile)
 {
     switch (which)
     {
         case 1:
             _correctionData = _storedCC1;
             SaveRotValue(thisFile);
             ProcessCurrentImage();
             break;
         case 2:
             _correctionData = _storedCC2;
             SaveRotValue(thisFile);
             ProcessCurrentImage();
             break;
         case 3:
             _correctionData = _storedCC3;
             SaveRotValue(thisFile);
             ProcessCurrentImage();
             break;
         case 4:
             _correctionData = _storedCC4;
             SaveRotValue(thisFile);
             ProcessCurrentImage();
             break;
         case 5:
             _correctionData = _storedCC5;
             SaveRotValue(thisFile);
             ProcessCurrentImage();
             break;
         default:
             break;
     }
 }
Ejemplo n.º 9
0
 private void StoreCC(Button thisButton, int which)
 {
     if (thisButton.BackColor.ToString() == "Color [Gold]")
     {
         switch (which)
         {
             case 1:
                 cc1StoreButton.BackColor = System.Drawing.Color.WhiteSmoke;
                 cc1RecallButton.Enabled = false;
                 break;
             case 2:
                 cc2StoreButton.BackColor = System.Drawing.Color.WhiteSmoke;
                 cc2RecallButton.Enabled = false;
                 break;
             case 3:
                 cc3StoreButton.BackColor = System.Drawing.Color.WhiteSmoke;
                 cc3RecallButton.Enabled = false;
                 break;
             case 4:
                 cc4StoreButton.BackColor = System.Drawing.Color.WhiteSmoke;
                 cc4RecallButton.Enabled = false;
                 break;
             case 5:
                 cc5StoreButton.BackColor = System.Drawing.Color.WhiteSmoke;
                 cc5RecallButton.Enabled = false;
                 break;
             default:
                 break;
         }
     }
     else
     {
         switch (which)
         {
             case 1:
                 _storedCC1 = _correctionData;
                 cc1StoreButton.BackColor = System.Drawing.Color.Gold;
                 cc1RecallButton.Enabled = true;
                 break;
             case 2:
                 _storedCC2 = _correctionData;
                 cc2StoreButton.BackColor = System.Drawing.Color.Gold;
                 cc2RecallButton.Enabled = true;
                 break;
             case 3:
                 _storedCC3 = _correctionData;
                 cc3StoreButton.BackColor = System.Drawing.Color.Gold;
                 cc3RecallButton.Enabled = true;
                 break;
             case 4:
                 _storedCC4 = _correctionData;
                 cc4StoreButton.BackColor = System.Drawing.Color.Gold;
                 cc4RecallButton.Enabled = true;
                 break;
             case 5:
                 _storedCC5 = _correctionData;
                 cc5StoreButton.BackColor = System.Drawing.Color.Gold;
                 cc5RecallButton.Enabled = true;
                 break;
             default:
                 break;
         }
     }
 }
Ejemplo n.º 10
0
        public void DeserializeIt(string order, string roll, string frame)
        {
            using (MySqlConnection connection = new MySqlConnection(_cs))
            using (MySqlCommand pullCommand = connection.CreateCommand())
            {
                try
                {
                    connection.Open();
                    pullCommand.CommandText = "SELECT * FROM `pvcc` WHERE `order` = '@order' AND `roll` = '@roll' AND `frame` = '@frame'";
                    pullCommand.CommandText = pullCommand.CommandText.Replace("@order", order).Replace("@roll", roll).Replace("@frame", frame);

                    using (MySqlDataReader reader = pullCommand.ExecuteReader())
                    {
                        if (reader.HasRows)
                        {
                            while (reader.Read())
                            {
                                _correctionData = JsonConvert.DeserializeObject<ComplexCorrection>(reader.GetString("cc"));
                            }
                            hasCC = true;
                        }
                        else
                        {
                            if ((!rollingCorrection.Checked) && (!holdCorrections.Checked))
                            {
                                _correctionData = new ComplexCorrection();
                                hasCC = false;
                            }
                            else if (holdCorrections.Checked)
                            {
                                _correctionData = JsonConvert.DeserializeObject<ComplexCorrection>(heldCorrectionString);
                            }
                        }

                        if (holdRotation.Checked)
                        {
                            _correctionData.Rotation.Value = currentRotation;
                        }
                        else
                        {
                            currentRotation = (int)_correctionData.Rotation.Value;
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
Ejemplo n.º 11
0
 private void ResetAll()
 {
     _correctionData = new ComplexCorrection();
     currentRotation = 0;
     AdjustHoldRotation();
     eraseCC();
     foreach (Thumbnail control in thumbPanel.Controls)
     {
         if (Path.GetFileNameWithoutExtension(control.Tag.ToString()) == currentFilename.Text)
         {
             control.UpdateThumbnail();
             control.FixSize();
         }
     }
     //FixThumbPanelPadding();
     UpdateImageAndCorrections();
 }
Ejemplo n.º 12
0
        /// <summary>
        /// End variable declaration
        /// </summary>
        /// 
        
        public MainForm()
        {
            try
            {
                InitializeComponent();
                // _instance = this;

                refFilename.Text = "";

                this.KeyPreview = true;

                _correctionData = new ComplexCorrection();

                //Blank Correction Data 
                blankString = JsonConvert.SerializeObject(_correctionData);
                _blankCorrection = new ComplexCorrection(_correctionData);

                //Guarantee CC Folder
                Directory.CreateDirectory(ccFolder);
                Directory.CreateDirectory(thumbsFolder);

                //Add custom histogram control
                histogramBox = new histogramControl();
                histContainer.Controls.Add(histogramBox);
                histogramBox.Anchor = AnchorStyles.Top;
                //histogramBox.Dock = DockStyle.Fill;

                //Setup timer to turn on damn histogram
                startHist = new System.Timers.Timer(500);
                startHist.Elapsed += new ElapsedEventHandler(timer_Elapsed);

                //Add directional panel arrows
                AddLeftArrow();
                AddRightArrow();

                GetPhotogInfo(1049);
            }
            catch (Exception ex)
            {
                
                MessageBox.Show(ex.Message);
            }
        }