コード例 #1
0
ファイル: D2dStatechartRenderer.cs プロジェクト: zparr/ATF
        private void DrawPseudostate(TNode state, D2dGraphics g, bool outline)
        {
            RectangleF bounds       = state.Bounds;
            D2dEllipse ellipse      = (D2dEllipse)bounds;
            D2dEllipse innerEllipse = ellipse;

            innerEllipse.RadiusX = 4;
            innerEllipse.RadiusY = 4;
            PointF c = ellipse.Center;

            g.FillEllipse(ellipse, m_theme.FillBrush);

            switch (state.Type)
            {
            case StateType.Start:
                g.FillEllipse(innerEllipse, m_theme.TextBrush);
                break;

            case StateType.Final:
                g.DrawEllipse(ellipse, m_theme.OutlineBrush, 3.0f);
                g.FillEllipse(innerEllipse, m_theme.TextBrush);
                break;

            case StateType.ShallowHistory:
                g.DrawText("H", m_centerText, bounds, m_theme.TextBrush);
                break;

            case StateType.DeepHistory:
                g.DrawText("H*", m_centerText, bounds, m_theme.TextBrush);
                break;

            case StateType.Conditional:
                g.DrawText("C", m_centerText, bounds, m_theme.TextBrush);
                break;
            }

            if (outline && state.Type != StateType.Final)
            {
                g.DrawEllipse(ellipse, m_theme.OutlineBrush);
            }
        }
コード例 #2
0
        private void Draw(TNode node, D2dGraphics g)
        {
            RectangleF             boundRect = node.Bounds;
            D2dEllipse             bounds    = (D2dEllipse)boundRect;
            D2dLinearGradientBrush brush
                = m_theme.FillGradientBrush;

            brush.StartPoint = boundRect.Location;
            brush.EndPoint   = new PointF(boundRect.Right, boundRect.Bottom);
            g.FillEllipse(bounds, brush);
            g.DrawEllipse(bounds, m_theme.OutlineBrush);
            g.DrawText(node.TitleText, m_theme.TextFormat, boundRect, m_theme.TextBrush);
        }
コード例 #3
0
ファイル: D2dUtil.cs プロジェクト: blue3k/ATFClone
        /// <summary>
        /// Draws the eye icon</summary>
        /// <param name="g">The D2dGraphics graphics object</param>
        /// <param name="rect">The rectangle to fit the eye icon in</param>
        /// <param name="pen">The pen used to draw the icon</param>
        /// <param name="strokeWidth">Width of the stroke</param>
        public static void DrawEyeIcon(this D2dGraphics g, RectangleF rect, D2dBrush pen, float strokeWidth)
        {
            float delta = rect.Width / 3;
            var   p1    = new PointF(rect.X, rect.Y + rect.Height / 2);
            var   p2    = new PointF(p1.X + delta, rect.Y);
            var   p3    = new PointF(p1.X + 2 * delta, rect.Y);
            var   p4    = new PointF(rect.X + rect.Width, rect.Y + rect.Height / 2);

            g.DrawBezier(p1, p2, p3, p4, pen, strokeWidth);// top lid
            p2 = new PointF(p2.X, rect.Y + rect.Height);
            p3 = new PointF(p3.X, rect.Y + rect.Height);
            g.DrawBezier(p1, p2, p3, p4, pen, strokeWidth); //bottom lid

            var   irisCenter = new PointF(rect.X + rect.Width / 2, rect.Y + rect.Height / 2);
            float irisRadius = 0.2f * Math.Min(rect.Width, rect.Height);
            var   irisRect   = new RectangleF(irisCenter.X - irisRadius, irisCenter.Y - irisRadius, 2 * irisRadius, 2 * irisRadius);

            g.DrawEllipse(irisRect, pen, strokeWidth * 1.8f);
        }
コード例 #4
0
        private void DrawOutline(TNode state, D2dBrush brush, D2dGraphics g)
        {
            RectangleF bounds = state.Bounds;

            if (state.Type != StateType.Normal)
            {
                g.DrawEllipse((D2dEllipse)bounds, brush, m_theme.StrokeWidth);
            }
            else
            {
                float scaleX     = g.Transform.M11; // assume no rotation.
                float radInPixel = scaleX * CornerRadius;
                if (radInPixel > MinRadiusInPixel)
                {
                    m_stateRect.Rect = bounds;
                    g.DrawRoundedRectangle(m_stateRect, brush, m_theme.StrokeWidth);
                }
                else
                {
                    g.DrawRectangle(bounds, brush, m_theme.StrokeWidth);
                }
            }
        }
コード例 #5
0
 private void DrawOutline(TNode node, D2dBrush brush, D2dGraphics g)
 {
     g.DrawEllipse((D2dEllipse)node.Bounds, brush, m_theme.StrokeWidth);
 }