Ejemplo n.º 1
0
        private void RotateMenuItem_Click(object sender, EventArgs e)
        {
            if (picOriginal.Image == null)
            {
                return;
            }

            ToolStripMenuItem tsmi = sender as ToolStripMenuItem;
            int            index   = Convert.ToInt32(tsmi.Tag);
            RotateFlipType rf      = RotateFlipType.RotateNoneFlipNone;

            switch (index)
            {
            case 10: rf = RotateFlipType.RotateNoneFlipNone; break;

            case 11: rf = RotateFlipType.Rotate90FlipNone; break;

            case 12: rf = RotateFlipType.Rotate180FlipNone; break;

            case 13: rf = RotateFlipType.Rotate270FlipNone; break;
            }
            ClearRotateSelect();
            tsmi.Checked = true;
            try
            {
                Bitmap im = new Bitmap(TIImage.ReadImage(oriPath), 480, 800);   //force the epaper size
                im.RotateFlip(rf);
                // im.Save(tmpPath, ImageFormat.Bmp);
                picOriginal.Image = im;
                Bitmap imf = TIImage.ApplyFiliter(CurrentFilter, im);// im);
                imf.Save(tmpPath, ImageFormat.Bmp);
                picFilter.Image = TIImage.ReadImage(tmpPath);
            }
            catch (Exception exp) { MessageBox.Show(exp.Message); }
        }
Ejemplo n.º 2
0
        private string OutPutBitmap(string filepath, string SavePath)
        {
            string outfilepath;
            Bitmap im = new Bitmap(TIImage.ReadImage(filepath), 480, 800);

            im.RotateFlip(RotateFlipType.Rotate180FlipX);//RotateNoneFlipX);
            im = TIImage.BitmapTo1Bpp(im);

            FileInfo finfo = new FileInfo(SavePath);

            outfilepath = finfo.Directory.FullName + "\\" + finfo.Name.Replace(finfo.Extension, "") + "_out.bmp";
            im.Save(outfilepath, System.Drawing.Imaging.ImageFormat.Bmp);
            return(outfilepath);
        }
Ejemplo n.º 3
0
 private void trackBar1_ValueChanged(object sender, EventArgs e)
 {
     lock (trackBar1)
     {
         try
         {
             label1.Text = trackBar1.Value.ToString();
             // Bitmap im = new Bitmap(KLImage.ReadImage(oriPath),480,800);   //force the epaper size
             Bitmap im = TIImage.ApplyFiliter(TIImage.ImageFiliter.Threshold, new Bitmap(picOriginal.Image), (byte)trackBar1.Value, (byte)trackBar2.Value);
             im.Save(tmpPath, ImageFormat.Bmp);
             picFilter.Image = TIImage.ReadImage(tmpPath);
         }
         catch (Exception exp) { MessageBox.Show(exp.Message); }
     }
 }
Ejemplo n.º 4
0
        private void FiliterMenuItem_Click(object sender, EventArgs e)
        {
            if (oriPath == "")
            {
                return;
            }
            if (!File.Exists(oriPath))
            {
                return;
            }

            ToolStripMenuItem tsmi = sender as ToolStripMenuItem;

            ClearFilterSelect();
            tsmi.Checked   = true;
            groupBox2.Text = "Filiter: ( " + tsmi.Text + " )";
            int index = Convert.ToInt32(tsmi.Tag);

            TIImage.ImageFiliter ifilter = TIImage.ImageFiliter.BayerDithering;

            switch (index)
            {
            case 1: ifilter = TIImage.ImageFiliter.Threshold; break;

            case 2: ifilter = TIImage.ImageFiliter.ThresholdWithCarry; break;

            case 3: ifilter = TIImage.ImageFiliter.OrderedDithering; break;

            case 4: ifilter = TIImage.ImageFiliter.BayerDithering; break;

            case 5: ifilter = TIImage.ImageFiliter.FloydSteinbergDithering; break;

            case 6: ifilter = TIImage.ImageFiliter.BurkesDithering; break;

            case 7: ifilter = TIImage.ImageFiliter.JarvisJudiceNinkeDithering; break;

            case 8: ifilter = TIImage.ImageFiliter.SierraDithering; break;

            case 9: ifilter = TIImage.ImageFiliter.StuckiDithering; break;

            case 10: ifilter = TIImage.ImageFiliter.Convolution; break;

            case 11: ifilter = TIImage.ImageFiliter.None; break;
            }
            try
            {
                if (ifilter == TIImage.ImageFiliter.Threshold)
                {
                    trackBar1.Value   = 128;
                    trackBar1.Visible = true;
                    label1.Visible    = true;
                    trackBar2.Value   = 2;
                    trackBar2.Visible = true;
                }
                else
                {
                    trackBar1.Visible = false;
                    trackBar2.Visible = false;
                    label1.Visible    = false;
                }

                // Bitmap im = new Bitmap(KLImage.ReadImage(oriPath),480,800);   //force the epaper size
                Bitmap im = TIImage.ApplyFiliter(ifilter, new Bitmap(picOriginal.Image));
                CurrentFilter   = ifilter;
                CurrentMenuItem = tsmi;
                PictureCarrier.Properties.Settings.Default.MenuFilterID = index;
                im.Save(tmpPath, ImageFormat.Bmp);
                picFilter.Image = TIImage.ReadImage(tmpPath);
            }
            catch (Exception exp) { MessageBox.Show(exp.Message); }
        }