Beispiel #1
0
 public Form1()
 {
     InitializeComponent();
     SetTarget( RectangleF.Empty );
     m_saveimg = null;
     m_savegm = null;
     m_outputfilename = String.Empty;
 }
Beispiel #2
0
        private void buttonPreview_Click(object sender, EventArgs e)
        {
            if (textBoxSkeleton.Text.ToLower().EndsWith("skl") ){
                Globemaker gm = new Globemaker(
                    panelPreview.Size,
                    loadSource(),
                    Color.Gray,
                    new Skeleton(textBoxSkeleton.Text));

                if (m_Target == RectangleF.Empty) {
                    gm.ExpandTargetToSize();
                    SetTarget( gm.Target );
                } else {
                    gm.Target = m_Target;
                    gm.ExpandTargetToSize();
                    SetTarget( gm.Target );
                }
                panelPreview.BackgroundImage = new DMSImage(gm).Bitmap;
            }
            else
            {
                DMSImage rainbow = new DMSImage(textBoxSkeleton.Text);
                double scale = Math.Min((double)panelPreview.Width / rainbow.Width, (double)panelPreview.Height / rainbow.Height);

                RainbowRenderer rr = new RainbowRenderer(
                    new Size((int)(scale * rainbow.Width), (int)(scale * rainbow.Height)),
                    loadSource(),
                    Color.Gray,
                    rainbow);
                panelPreview.BackgroundImage = new DMSImage(rr).Bitmap;
                panelPreview.BackgroundImageLayout = ImageLayout.Center;
            }
        }
Beispiel #3
0
        private void buttonGo_Click(object sender, EventArgs e)
        {
            m_savegm = null;
            m_saverr = null;
            progressBar1.Value = 0;

            SaveFileDialog sfd = new SaveFileDialog();
            if (sfd.ShowDialog() != DialogResult.OK)
                return;
            else
                m_outputfilename = sfd.FileName;

            if( textBoxSkeleton.Text.ToLower().EndsWith("skl") ) {
                if( textBoxSource.Text == "" )
                    m_savegm = new Globemaker( new Size((int)(m_Target.Width / DMS.TAU * trackBarScale.Value), (int)(m_Target.Height / DMS.TAU * trackBarScale.Value)),
                                               Color.Gray,
                                               new Skeleton(textBoxSkeleton.Text));
                else
                    m_savegm = new Globemaker( new Size( (int)(m_Target.Width / DMS.TAU * trackBarScale.Value), (int)(m_Target.Height / DMS.TAU * trackBarScale.Value)),
                                               new DMSImage(textBoxSource.Text, checkBoxMirroBall.Checked),
                                               Color.Gray,
                                               new Skeleton(textBoxSkeleton.Text));
                m_savegm.Target = m_Target;
            } else {
                m_saverr = new RainbowRenderer( new DMSImage(textBoxSource.Text),
                                                Color.Gray,
                                                new DMSImage(textBoxSkeleton.Text) );
            }

            bg_worker.RunWorkerAsync();
            timer1.Start();
        }