예제 #1
0
        private void HandleDataGenerated(object sender, DataGeneratedEventArgs e)
        {
            var name = (sender as RuntimeLayer).Userdata as string;
            if (name == null)
                name = sender.GetType().Name;
            if (!m_SaveNames.ContainsKey(name))
                m_SaveNames[name] = 0;
            m_SaveNames[name] += 1;

            // Save the internal result.
            var bitmap = this.m_AlgorithmTraceImageGeneration.RenderTraceResult(
                sender as RuntimeLayer,
                e.Data,
                e.GSArrayWidth,
                e.GSArrayHeight,
                e.GSArrayDepth);
            Console.WriteLine(name + ": " + m_SaveNames[name] + " (internal)");
            bitmap.Save("layer_" + ++m_Count + ".png");

            // Save the normal result.
            int computations;
            this.m_DisableHandler();
            var data = (sender as RuntimeLayer)
                .GenerateData(e.GSAbsoluteX - e.GSMaxOffsetX,
                              e.GSAbsoluteY - e.GSMaxOffsetY,
                              e.GSAbsoluteZ - e.GSMaxOffsetZ,
                              e.GSArrayWidth,
                              e.GSArrayHeight,
                              e.GSArrayDepth, out computations);
            var alt = this.m_AlgorithmTraceImageGeneration.RenderTraceResult(
                    sender as RuntimeLayer,
                    data,
                    e.GSArrayWidth,
                    e.GSArrayHeight,
                    e.GSArrayDepth);
            Console.WriteLine(name + ": " + m_SaveNames[name] + " (normal)");
            alt.Save("layer_" + ++m_Count + ".png");
            this.m_EnableHandler();
        }
예제 #2
0
        private void HandleDataGenerated(object sender, DataGeneratedEventArgs e)
        {
            // Save the internal result.
            if (!this.c_OnlyComparisonDataCheckBox.Checked)
            {
                this.m_Bitmaps.Add(this.m_AlgorithmTraceImageGeneration.RenderTraceResult(
                    sender as RuntimeLayer,
                    e.Data,
                    e.GSArrayWidth,
                    e.GSArrayHeight,
                    e.GSArrayDepth));
                Console.WriteLine(this.m_Bitmaps[this.m_Bitmaps.Count - 1].Size);

                if (this.IsHandleCreated)
                {
                    this.Invoke(new Action(() =>
                    {
                        this.c_TraceProgress.Value += 1;
                        this.Text = @"Trace Algorithm (" + (this.c_TraceProgress.Maximum - this.c_TraceProgress.Value) +
                                    @" operations remaining)";
                    }));
                }
            }

            // Save the normal result.
            int computations;
            this.m_DisableHandlers();
            var data = ((RuntimeLayer)sender)
                .GenerateData(e.GSAbsoluteX - e.GSMaxOffsetX,
                    e.GSAbsoluteY - e.GSMaxOffsetY,
                    e.GSAbsoluteZ - e.GSMaxOffsetZ,
                    e.GSArrayWidth,
                    e.GSArrayHeight,
                    e.GSArrayDepth, out computations);
            this.m_Bitmaps.Add(this.m_AlgorithmTraceImageGeneration.RenderTraceResult(
                sender as RuntimeLayer,
                data,
                e.GSArrayWidth,
                e.GSArrayHeight,
                e.GSArrayDepth));
            Console.WriteLine(this.m_Bitmaps[this.m_Bitmaps.Count - 1].Size);
            this.m_EnableHandlers();

            if (this.IsHandleCreated)
            {
                this.Invoke(new Action(() =>
                {
                    this.c_TraceProgress.Value += 1;
                    this.Text = @"Trace Algorithm (" + (this.c_TraceProgress.Maximum - this.c_TraceProgress.Value) +
                                @" operations remaining)";
                }));
            }
        }