Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="parent"></param>
        public override DialogResult Show(Form parent = null, bool setup = false)
        {
            if (fm == null)
            {
                fm                 = new RotateForm(this);
                fm.host            = Host;
                fm.Text            = DisplayName;
                fm.FormBorderStyle = FormBorderStyle.FixedToolWindow;
                fm.MaximizeBox     = false;
                fm.MinimizeBox     = false;
                fm.ShowIcon        = false;
                fm.ShowInTaskbar   = false;
                fm.StartPosition   = FormStartPosition.CenterParent;

                if (Params.Count == 0)
                {
                    InitParams();
                }

                if (Params.ContainsKey("Mode"))
                {
                    fm.SetMode("Mode", Params["Mode"]);
                }
                if (Params.ContainsKey("Angle"))
                {
                    fm.SetAngle("Angle", Params["Angle"]);
                }
                if (Params.ContainsKey("KeepSize"))
                {
                    fm.SetKeepSize("KeepSize", Params["KeepSize"]);
                }

                Translate(fm);
            }
            var result = fm.ShowDialog();

            if (result == DialogResult.OK)
            {
                _success = true;

                Params["Mode"]     = fm.GetMode("Mode");
                Params["Angle"]    = fm.GetAngle("Angle");
                Params["KeepSize"] = fm.GetKeepSize("KeepSize");

                if (!setup)
                {
                    ImgDst = Apply(ImgSrc);
                }
            }
            else
            {
                _success = false;
            }
            if (fm != null)
            {
                fm.Dispose();
                fm = null;
            }
            return(result);
        }
Beispiel #2
0
        private void zToolStripMenuItem_Click(object sender, EventArgs e)
        {
            RotateForm form = new RotateForm();

            form.ShowDialog();
            utils.RotateZ(form.Angle);
            pictureBox1.Invalidate();
        }
Beispiel #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="image"></param>
        /// <returns></returns>
        public override Image Apply(Image image)
        {
            if (image is Image)
            {
                if (Params.Count == 0)
                {
                    InitParams();
                }

                RotateFlipType flip  = (RotateFlipType)Params["Mode"].Value;
                double         angle = Convert.ToDouble(Params["Angle"].Value);
                bool           keep  = Convert.ToBoolean(Params["KeepSize"].Value);

                Image dst = RotateForm.RotateImage(image, flip, angle, keep);
                AddinUtils.CloneExif(image, dst);
                return(dst);
            }
            return(image);
        }