Esempio n. 1
0
        public cipFormLightnessContrast(Image image, Raster source)
        {
            InitializeComponent();

            CipSize size = new CipSize(image.Size);
            CipSize newSize = Resample.SizeAdaptHeight(size, 200);
            Resample resampleFIlter = new Resample(newSize, CipInterpolationMode.BicubicSpline);
            raster = resampleFIlter.ProcessWithoutWorker(source);
            this.ThumbnailBitmap = raster.ToBitmap();
            this.pBoxPreview.Image = this.ThumbnailBitmap;

            thread = new Thread(new ThreadStart(this.ReDraw));
            thread.Priority = ThreadPriority.Normal;
        }
Esempio n. 2
0
        public cipFormSmoothing(Image image, Raster source, System.Globalization.CultureInfo selectedCulture)
        {
            Thread.CurrentThread.CurrentUICulture = selectedCulture;
            InitializeComponent();

            CipSize size = new CipSize(image.Size);
            CipSize newSize = Resample.SizeAdaptHeight(size, 200);
            Resample resampleFIlter = new Resample(newSize, CipInterpolationMode.BicubicSpline);
            raster = resampleFIlter.ProcessWithoutWorker(source);
            this.ThumbnailBitmap = raster.ToBitmap();
            this.pBoxPreview.Image = this.ThumbnailBitmap;

            thread = new Thread(new ThreadStart(this.ReDraw));
            thread.Priority = ThreadPriority.Normal;
        }
Esempio n. 3
0
        public cipFormHistogram(Image image,Raster source)
        {
            InitializeComponent();
            level = trackBarThreshold.Value / 1000f;
            textBoxLevel.Text = Convert.ToString(this.level);

            CipSize size = new CipSize(image.Size);
            CipSize newSize = Resample.SizeAdaptHeight(size, 200);
            Resample resampleFIlter = new Resample(newSize, CipInterpolationMode.BicubicSpline);
            raster = resampleFIlter.ProcessWithoutWorker(source);
            this.ThumbnailBitmap = raster.ToBitmap();
            this.pBoxPreview.Image = this.ThumbnailBitmap;

            thread = new Thread(new ThreadStart(this.ReDraw));
            thread.Priority = ThreadPriority.Normal;
        }
Esempio n. 4
0
        public cipFormResample(Image image)
        {
            InitializeComponent();

            this.radioButtonSizeFactor.Checked = false;
            this.radioButtonPixels.Checked = false;
            this.radioButtonStandart.Checked = true;
            this.textBoxSizeFactor.Enabled = false;
            this.numericUpDownWidth.Enabled = false;
            this.numericUpDownHeight.Enabled = false;
            this.comboBoxStandartSizes.Enabled = true;

            oldSize = new CipSize(image.Width, image.Height);
            nSize = new CipSize(oldSize);
            this.labelOriginalSizeVar.Text = oldSize.ToString();
            this.CipShowNewSize();
            this.CipChangeNumericSize();
            this.comboBoxStandartSizes.SelectedIndex = 0;
            this.comboBoxFilter.SelectedIndex = 1;
            this.mode = CipInterpolationMode.BicubicSpline;
            
        }
Esempio n. 5
0
 /// <summary>
 /// Adapts current width to new height.
 /// </summary>
 /// <param name="oldSize">Current size.</param>
 /// <param name="nh">New height.</param>
 /// <returns>New scaled size.</returns>
 public static CipSize SizeAdaptWidth(CipSize oldSize, int nh)
 {
     if (oldSize.Height != 0)
     {
         float ration = (float)oldSize.Width / (float)oldSize.Height;
         int w = (int)(nh * ration + 0.5f);
         return new CipSize(w, nh);
     }
     else
         return oldSize;
 }
Esempio n. 6
0
 /// <summary>
 /// Adapts current height to new width.
 /// </summary>
 /// <param name="oldSize">Current size.</param>
 /// <param name="nw">New width.</param>
 /// <returns>New scaled size.</returns>
 public static CipSize SizeAdaptHeight(CipSize oldSize, int nw)
 {
     if (oldSize.Height != 0)
     {
         float ration = (float)oldSize.Width / (float)oldSize.Height;
         int h = (int)(nw / ration + 0.5f);
         return new CipSize(nw, h);
     }
     else
         return oldSize;
 }
Esempio n. 7
0
 /// <summary>
 /// Scale size by size factor.
 /// </summary>
 /// <param name="size">Current size.</param>
 /// <param name="sizeFactor">Factor.</param>
 /// <returns>New scaled size.</returns>
 public static CipSize SizeFactorScale(CipSize size, float sizeFactor)
 {
     return SizeFactorScale(size.Width, size.Height, sizeFactor);
 }
Esempio n. 8
0
 public CipSize(CipSize size)
 {
     this.width = size.width;
     this.height = size.height;
 }
Esempio n. 9
0
 /// <summary>
 /// Constructor with parameters.
 /// </summary>
 /// <param name="mode">
 /// mode can be 0 for fast (nearest pixel) method, 
 /// 1 for accurate (bicubic spline interpolation) method, 
 /// or 2 for slow (bilinear) method.</param>
 /// <param name="newSize">New size.</param>
 public Resample(CipSize newSize, Cip.Transformations.CipInterpolationMode mode)
 {
     this.newx = newSize.Width;
     this.newy = newSize.Height;
     this.mode = mode;
 }
Esempio n. 10
0
 private void textBoxSizeFactor_TextChanged(object sender, EventArgs e)
 {
     try
     {
         float factor = (float)Convert.ToDouble(this.textBoxSizeFactor.Text);
         nSize = Cip.Transformations.Resample.SizeFactorScale(oldSize, factor);
         this.CipShowNewSize();
     }
     catch
     {
         MessageBox.Show("Enter floating point number like 1,5");
         this.textBoxSizeFactor.Text = "1,5";
     }
 }
Esempio n. 11
0
 private void numericUpDownHeight_ValueChanged(object sender, EventArgs e)
 {
     int nh = Convert.ToInt32(numericUpDownHeight.Value);
     nSize = Cip.Transformations.Resample.SizeAdaptWidth(oldSize, nh);
     this.CipChangeNumericSize();
 }
Esempio n. 12
0
 private void comboBoxStandartSizes_SelectedIndexChanged(object sender, EventArgs e)
 {
     switch (this.comboBoxStandartSizes.SelectedIndex)
     {
         case 0:
             {
                 //screen size
                 Rectangle rect = Screen.PrimaryScreen.Bounds;
                 nSize.Width = rect.Width;
                 nSize.Height = rect.Height;
                 this.CipShowNewSize();
                 break;
             }
         case 1:
             { 
                 //160x120
                 nSize.Width = 160;
                 nSize.Height = 120;
                 this.CipShowNewSize();
                 break;
             }
         case 2:
             {
                 //320x240
                 nSize.Width = 320;
                 nSize.Height = 240;
                 this.CipShowNewSize();
                 break;
             }
         case 3:
             {
                 //640x480
                 nSize.Width = 640;
                 nSize.Height = 480;
                 this.CipShowNewSize();
                 break;
             }
         case 4:
             {
                 //800x600
                 nSize.Width = 800;
                 nSize.Height = 600;
                 this.CipShowNewSize();
                 break;
             }
         case 5:
             {
                 //1024x768
                 nSize.Width = 1024;
                 nSize.Height = 768;
                 this.CipShowNewSize();
                 break;
             }
         case 6:
             {
                 //1200x900
                 nSize.Width = 1200;
                 nSize.Height = 900;
                 this.CipShowNewSize();
                 break;
             }
         case 7:
             {
                 //1280x1024
                 nSize.Width = 1280;
                 nSize.Height = 1024;
                 this.CipShowNewSize();
                 break;
             }
         case 8:
             {
                 //1600x1200
                 nSize.Width = 1600;
                 nSize.Height = 1200;
                 this.CipShowNewSize();
                 break;
             }
         case 9:
             {
                 //2048x1536
                 nSize.Width = 2048;
                 nSize.Height = 1536;
                 this.CipShowNewSize();
                 break;
             }
         case 10:
             {
                 //50%
                 nSize = Cip.Transformations.Resample.SizeFactorScale(oldSize, 0.5f);
                 this.CipShowNewSize();
                 break;
             }
         case 11:
             { 
                 //200%
                 nSize = Cip.Transformations.Resample.SizeFactorScale(oldSize, 2.0f);
                 this.CipShowNewSize();
                 break;
             }
         default:
             {
                 nSize = new CipSize(oldSize);
                 this.CipShowNewSize();
                 break;
             }
     }
 }