aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.CodeGeneration/Templates/Namespace.cshtml
blob: 05fd682c4ceeb41f421263afc1ed6dd9e409dd2d (plain)
1
2
3
4
5
6
7
    namespace @(Model.Name)
    {
        @foreach (var cls in Model.Classes)
        {
            <div>@cls.GenerateCode()</div>
        }
    }
f { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
using System.Linq;
using RealTimeGraphEx.ExtensionMethods;

namespace RealTimeGraphEx.DX2D
{
    using SharpDX;
    using SharpDX.Direct2D1;
    using System;
    using System.Collections.Generic;

    public class DXGraphSurfaceSingleScroll : Direct2DControl
    {
        private Vector2[] lastPoints;
        private Vector2[] lastPointsFill;
        private System.Windows.Media.Brush _fill;
        private System.Windows.Media.Brush _stroke;
        private double _strokeWidth;
        private bool _fillGraph;
        private bool _antialiazed;
        private bool updated;

        public DXGraphSurfaceSingleScroll()
        {
            lastPoints = new Vector2[0];
            lastPointsFill = new Vector2[0];
        }

        public void SetProperties(Vector2[] polygonPoints, Vector2[] polygonPointsFill, System.Windows.Media.Brush stroke, double strokeWidth, bool fillGraph, System.Windows.Media.Brush fill, bool antialized)
        {
            _stroke = stroke;
            _fill = fill;
            _fillGraph = fillGraph;
            _strokeWidth = strokeWidth;
            _antialiazed = antialized;


            lock (lastPoints)
            {
                lastPoints = polygonPoints;
                lastPointsFill = polygonPointsFill;
                updated = true;
            }
        }

        /// <summary>
        /// Does the actual rendering. 
        /// BeginDraw and EndDraw are already called by the caller. 
        /// </summary>
        public override void Render(RenderTarget target)
        {
            if (lastPoints.Length > 0 && updated)
            {
                target.Clear(Color.Transparent);
                var stroke = _stroke.ToDxBrush(target);
                var fill = _fill.ToDxBrush(target);

                target.AntialiasMode = _antialiazed ? AntialiasMode.PerPrimitive : AntialiasMode.Aliased;

                lock (lastPoints)
                {
                    target.DrawPolygon(m_d2dFactory, stroke, _strokeWidth, lastPoints);

                    if (_fillGraph && _fill != null)
                    {
                        target.FillPolygon(m_d2dFactory, fill, lastPointsFill);
                    }

                    updated = false;
                    GC.Collect(GC.MaxGeneration, GCCollectionMode.Optimized, blocking: false);
                }
            }

            DisableRendering();
        }
    }
}