当前位置: 首页>>代码示例>>C#>>正文


C# ICanvas类代码示例

本文整理汇总了C#中ICanvas的典型用法代码示例。如果您正苦于以下问题:C# ICanvas类的具体用法?C# ICanvas怎么用?C# ICanvas使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ICanvas类属于命名空间,在下文中一共展示了ICanvas类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PaintNonGrouped

 protected override void PaintNonGrouped(float cx, float cy, ICanvas canvas)
 {
     var res = Renderer.Resources;
     canvas.Font = res.EffectFont;
     canvas.TextAlign = TextAlign.Left;
     canvas.FillText(_label, cx + X, cy + Y);
 }
开发者ID:CoderLine,项目名称:alphaTab,代码行数:7,代码来源:LineRangedGlyph.cs

示例2: PaintGrouped

        protected override void PaintGrouped(float cx, float cy, float endX, ICanvas canvas)
        {
            PaintNonGrouped(cx, cy, canvas);

            var lineSpacing = LineSpacing * Scale;
            var textWidth = canvas.MeasureText(_label);
            var startX = cx + X + textWidth + lineSpacing;
            var lineY = cy + Y + (LineTopPadding * Scale);
            var lineSize = LineSize * Scale;

            if (endX > startX)
            {
                var lineX = startX;
                while (lineX < endX)
                {
                    canvas.BeginPath();
                    canvas.MoveTo(lineX, (int)lineY);
                    canvas.LineTo(Math.Min(lineX + lineSize, endX), (int)lineY);
                    lineX += lineSize + lineSpacing;
                    canvas.Stroke();
                }
                canvas.BeginPath();
                canvas.MoveTo(endX, (int)(lineY - LineTopOffset * Scale));
                canvas.LineTo(endX, (int)(lineY + LineTopOffset * Scale));
                canvas.Stroke();
            }
        }
开发者ID:CoderLine,项目名称:alphaTab,代码行数:27,代码来源:LineRangedGlyph.cs

示例3: DrawElement

 protected override void DrawElement(ICanvas canvas)
 {
     foreach (var c in Children)
     {
         c.Draw(canvas);
     }
 }
开发者ID:JoshuaNovak919,项目名称:NGraphics,代码行数:7,代码来源:Group.cs

示例4: InitializeScene

        public override void InitializeScene(ICanvas canvas)
        {
            // Connect with simulator
            connection = new NetworkClient();
            if (!connection.Connect("ganberg2", 9999))
            {
                throw new ApplicationException("Unable to establish connection with host.");
            }
            else
            {
                connection.Subscribe("TimeTick");
                connection.Subscribe("ViewProUpdate");
            }

            // Create and initialize Gameboard.
            background = new Obj_Sprite(texture_file, SpriteFlags.SortTexture | SpriteFlags.AlphaBlend);
            background.Initialize(canvas);
            background.Position = new Vector3(0, 0, 0);
            background.Rotation = new Vector3(0, 0, 0);
            background.Scaling = new Vector3(1, 1, 1);
            background.Texture(canvas);

            // Initialize and create Font;
            this._myFont = canvas.CreateFont(new System.Drawing.Font("Arial", 10));
            message = string.Empty;

            //f16 = new Obj_Sprite("f16.png", SpriteFlags.AlphaBlend);
            //f16.Initialize(canvas);
            //f16.Texture(canvas);
            //f16.Position = new Vector3(0, 0, 0);
            //f16.Rotation = new Vector3(0, 0, 0);
            //f16.Scaling = new Vector3(1, 1, 1);

        }
开发者ID:wshanshan,项目名称:DDD,代码行数:34,代码来源:GIS_Scene.cs

示例5: WhenEnteringEditor

 public void WhenEnteringEditor( ICanvas canvas, DraggingContext context)
 {
     if (_whenEnteringEditor != null)
     {
         _whenEnteringEditor(context);
     }
 }
开发者ID:mtgattie,项目名称:Gleed2D,代码行数:7,代码来源:LambdaDrivenDragDropHandler.cs

示例6: Paint

        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            var blockWidth = 4 * Scale;

            var top = cy + Y + Renderer.TopPadding;
            var bottom = cy + Y + Renderer.Height - Renderer.BottomPadding;
            var left = cx + X + 0.5f;
            // big bar
            var h = bottom - top;
            canvas.FillRect(left, top, blockWidth, h);

            // line
            left += (blockWidth * 2) - 0.5f;
            canvas.BeginPath();
            canvas.MoveTo(left, top);
            canvas.LineTo(left, bottom);
            canvas.Stroke();

            //circles 
            left += 3 * Scale;

            var circleSize = _circleSize * Scale;
            var middle = (top + bottom) / 2;
            canvas.FillCircle(left, middle - (circleSize * _dotOffset), circleSize);
            canvas.FillCircle(left, middle + (circleSize * _dotOffset), circleSize);
        }
开发者ID:eriser,项目名称:alphaTab,代码行数:26,代码来源:RepeatOpenGlyph.cs

示例7: Paint

        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            // if we are linked with the previous, the first glyph of the group will also render this one.
            if (IsLinkedWithPrevious)
            {
                return;
            }

            // we are not linked with any glyph therefore no expansion is required, we render a simple glyph.
            if (!IsLinkedWithNext)
            {
                PaintNonGrouped(cx, cy, canvas);
                return;
            }

            // find last linked glyph that can be
            var lastLinkedGlyph = (GroupedEffectGlyph)NextGlyph;
            while (lastLinkedGlyph.IsLinkedWithNext)
            {
                lastLinkedGlyph = (GroupedEffectGlyph)lastLinkedGlyph.NextGlyph;
            }

            // calculate end X-position

            var cxRenderer = cx - Renderer.X;

            var endRenderer = lastLinkedGlyph.Renderer;
            var endBeatX = endRenderer.GetBeatX(lastLinkedGlyph.Beat, _endPosition);
            var endX = cxRenderer + endRenderer.X + endBeatX;

            PaintGrouped(cx, cy, endX, canvas);
        }
开发者ID:CoderLine,项目名称:alphaTab,代码行数:32,代码来源:GroupedEffectGlyph.cs

示例8: Paint

 public override void Paint(float cx, float cy, ICanvas canvas)
 {
     if (_noteString != null)
     {
         canvas.FillText(_noteString.ToLower(), cx + X, cy + Y);
     }
 }
开发者ID:eriser,项目名称:alphaTab,代码行数:7,代码来源:NoteNumberGlyph.cs

示例9: Draw

        public override void Draw(ICanvas canvas, RectangleF unitrect)
        {
            Color color = Color;
            Pen pen = canvas.CreatePen(color, Width);
            if (Highlighted || Selected)
            {
                pen = Canvas.DrawTools.DrawUtils.SelectedPen;
                if (m_p1.IsEmpty == false) Canvas.DrawTools.DrawUtils.DrawNode(canvas, m_p1);
                if (m_p2.IsEmpty == false) Canvas.DrawTools.DrawUtils.DrawNode(canvas, m_p2);
                if (m_p3.IsEmpty == false) Canvas.DrawTools.DrawUtils.DrawNode(canvas, m_p3);
                if (m_p4.IsEmpty == false) Canvas.DrawTools.DrawUtils.DrawNode(canvas, m_p4);
            }
            canvas.DrawLine(canvas, pen, m_p1, m_p2);
            if (m_p3 != m_p4) canvas.DrawLine(canvas, pen, m_p3, m_p4);
            pen = new Pen(pen.Color, (float)3);
            if (horizontal)
            {
                canvas.DrawLine(canvas, pen, m_p2, new UnitPoint(m_p2.X+0.2,m_p2.Y));
                canvas.DrawLine(canvas, pen, m_p3, new UnitPoint(m_p2.X + 0.8, m_p2.Y));
                canvas.DrawArc(canvas, pen, new UnitPoint(m_p2.X + 0.61, m_p2.Y), (float)0.19, 0, 360);
                canvas.DrawArc(canvas, pen, new UnitPoint(m_p2.X + 0.39, m_p2.Y), (float)0.19, 0, 360);

            }
            else
            {
                canvas.DrawLine(canvas, pen, m_p2, new UnitPoint(m_p2.X , m_p2.Y- 0.2));
                canvas.DrawLine(canvas, pen, m_p3, new UnitPoint(m_p2.X , m_p2.Y- 0.8));
                canvas.DrawArc(canvas, pen, new UnitPoint(m_p2.X , m_p2.Y-0.61), (float)0.19, 0, 360);
                canvas.DrawArc(canvas, pen, new UnitPoint(m_p2.X , m_p2.Y-0.39), (float)0.19, 0, 360);
            }
        }
开发者ID:jjacksons,项目名称:GLUE,代码行数:31,代码来源:Transformer.cs

示例10: Scene

        /// <summary>
        /// Manages a scene to be rendered and updated.
        /// </summary>
        /// <param name="camera">Camera of the scene</param>
        /// <param name="canvas">Canvas that this scene binds to.</param>
        /// <param name="objects">Objects to be rendered</param>
        public Scene(ICamera camera, ICanvas canvas, params SceneObject[] objects)
        {
            if (camera == null || canvas == null) { throw new ArgumentNullException(); }

            this.Canvas = canvas;
            {
                this.rootUI = new SceneRootUI();
            }
            {
                var rootObject = new SceneRootObject(this);
                rootObject.Children.AddRange(objects);
                this.rootObject = rootObject;
            }
            {
                var rootViewPort = new SceneRootViewPort(
                     AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Top, new Padding(0, 0, 0, 0), canvas.Size);
                rootViewPort.Children.Add(new ViewPort(camera,
                    AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom,
                    new Padding(0, 0, 0, 0), canvas.Size));
                this.rootViewPort = rootViewPort;
            }
            //var cursor = UICursor.CreateDefault();
            //cursor.Enabled = false;
            //this.rootCursor.Children.Add(cursor);
            //this.Cursor = cursor;
        }
开发者ID:bitzhuwei,项目名称:CSharpGL,代码行数:32,代码来源:Scene.cs

示例11: Draw

        public override void Draw(ICanvas canvas, RectangleF unitrect)
        {
            Color color = Color;
            Pen pen = canvas.CreatePen(color, Width);
            if (Highlighted || Selected)
            {
                pen = Canvas.DrawTools.DrawUtils.SelectedPen;
                if (m_p1.IsEmpty == false) Canvas.DrawTools.DrawUtils.DrawNode(canvas, m_p1);
                if (m_p2.IsEmpty == false) Canvas.DrawTools.DrawUtils.DrawNode(canvas, m_p2);
                //if ((m_p3.X != m_p2.X + 1 || m_p3.Y != m_p2.Y) && this.horizontal) m_p3 = new UnitPoint(m_p2.X + 1, m_p2.Y);
                //if (m_p3.Y != m_p2.Y + 1 && !this.horizontal) m_p3 = new UnitPoint(m_p2.X, m_p2.Y + 1);
                if (m_p3.IsEmpty == false) Canvas.DrawTools.DrawUtils.DrawNode(canvas, m_p3);
                if (m_p4.IsEmpty == false) Canvas.DrawTools.DrawUtils.DrawNode(canvas, m_p4);
            }
            canvas.DrawLine(canvas, pen, m_p1, m_p2);
            pen = new Pen(pen.Color, (float)4);

            if (horizontal)
            {
                canvas.DrawLine(canvas, pen, new UnitPoint(m_p2.X + 0.1, m_p2.Y), new UnitPoint(m_p2.X + 0.51, m_p2.Y + 0.4));
                canvas.DrawLine(canvas, pen, new UnitPoint(m_p2.X + 0.9, m_p2.Y), new UnitPoint(m_p2.X + 0.49, m_p2.Y + 0.4));
                canvas.Graphics.DrawRectangle(pen, canvas.ToScreen(new UnitPoint(m_p2.X + 0.2, 1)).X, canvas.ToScreen(new UnitPoint(1, m_p2.Y + 0.1)).Y, canvas.ToScreen(new UnitPoint(m_p2.X + 0.8, 1)).X - canvas.ToScreen(new UnitPoint(m_p2.X + 0.2, 1)).X, canvas.ToScreen(new UnitPoint(1, m_p2.Y - 0.6)).Y - canvas.ToScreen(new UnitPoint(1, m_p2.Y - 0.1)).Y);
            }
            else
            {
                canvas.DrawLine(canvas, pen, new UnitPoint(m_p2.X - 0.4, m_p2.Y-0.5), new UnitPoint(m_p2.X + 0.01, m_p2.Y ));
                canvas.DrawLine(canvas, pen, new UnitPoint(m_p2.X + 0.4, m_p2.Y-0.5), new UnitPoint(m_p2.X + -0.01, m_p2.Y ));
                canvas.Graphics.DrawRectangle(pen, canvas.ToScreen(new UnitPoint(m_p2.X - 0.3, 1)).X, canvas.ToScreen(new UnitPoint(1, m_p2.Y - 0.4)).Y, canvas.ToScreen(new UnitPoint(m_p2.X + 0.8, 1)).X - canvas.ToScreen(new UnitPoint(m_p2.X + 0.2, 1)).X, canvas.ToScreen(new UnitPoint(1, m_p2.Y - 0.6)).Y - canvas.ToScreen(new UnitPoint(1, m_p2.Y - 0.1)).Y);

            }
        }
开发者ID:jjacksons,项目名称:GLUE,代码行数:31,代码来源:house.cs

示例12: WinFormsCanvas

        public WinFormsCanvas(ICanvas canvas, WinFormsCanvasPanel panel)
        {
            Background = canvas.Background;
            SnapX = canvas.SnapX;
            SnapY = canvas.SnapY;
            EnableSnap = canvas.EnableSnap;

            History = canvas.History;

            Children = new List<INative>();

            _panel = panel;
            _panel.Layers.Add(this);

            Downs = Observable.FromEventPattern<MouseEventArgs>(_panel, "MouseDown")
                .Where(e => e.EventArgs.Button == MouseButtons.Left)
                .Select(e => Snap(e.EventArgs.Location));

            Ups = Observable.FromEventPattern<MouseEventArgs>(_panel, "MouseUp")
                .Where(e => e.EventArgs.Button == MouseButtons.Left)
                .Select(e => Snap(e.EventArgs.Location));

            Moves = Observable.FromEventPattern<MouseEventArgs>(_panel, "MouseMove")
                .Select(e => Snap(e.EventArgs.Location));

            Native = _panel;
        }
开发者ID:monocraft,项目名称:RxCanvas,代码行数:27,代码来源:WinForms.cs

示例13: Clip

        public bool Clip(ICanvas canvas, CRectangleF clipRect)
        {
            if (canvas.Bound.Left < clipRect.Left)
            {
                canvas.Bound.Left = clipRect.Left;
                canvas.Content.Left = clipRect.Left - canvas.Bound.Left;
            }

            if (canvas.Bound.Top < clipRect.Top)
            {
                canvas.Bound.Top = clipRect.Top;
                canvas.Content.Top = clipRect.Top - canvas.Bound.Top;
            }

            if (canvas.Bound.Right < clipRect.Right)
            {
                canvas.Bound.Right = clipRect.Right;
                canvas.Content.Right = clipRect.Right - canvas.Bound.Right;
            }

            if (canvas.Bound.Bottom < clipRect.Bottom)
            {
                canvas.Bound.Bottom = clipRect.Bottom;
                canvas.Content.Bottom = clipRect.Bottom - canvas.Bound.Bottom;
            }

            return !canvas.Bound.IsEmpty;
        }
开发者ID:doanhtdpl,项目名称:plants-vs-zombies-gameonmobile-uit-term7,代码行数:28,代码来源:RectangleClipping.cs

示例14: Draw

        public void Draw(ICanvas canvas)
        {
            canvas.SaveState ();

            //
            // Scale the viewBox into the size
            //
            var sx = 1.0;
            if (ViewBox.Width > 0) {
                sx = Size.Width / ViewBox.Width;
            }
            var sy = 1.0;
            if (ViewBox.Height > 0) {
                sy = Size.Height / ViewBox.Height;
            }

            canvas.Scale (sx, sy);
            canvas.Translate (-ViewBox.X, -ViewBox.Y);

            //
            // Draw
            //
            foreach (var c in Children) {
                c.Draw (canvas);
            }

            canvas.RestoreState ();
        }
开发者ID:sami1971,项目名称:NGraphics,代码行数:28,代码来源:Graphic.cs

示例15: Draw

        public override void Draw(ICanvas canvas, RectangleF unitrect)
        {
            Color color = Color;
            Brush B = Brushes.Black;
            Pen pen = canvas.CreatePen(color, Width);
            if (Highlighted || Selected)
            {
                pen = Canvas.DrawTools.DrawUtils.SelectedPen;
                if (m_p1.IsEmpty == false) Canvas.DrawTools.DrawUtils.DrawNode(canvas, m_p1);
                if (m_p2.IsEmpty == false) Canvas.DrawTools.DrawUtils.DrawNode(canvas, m_p2);
                if (m_p3.IsEmpty == false) Canvas.DrawTools.DrawUtils.DrawNode(canvas, m_p3);
                B = Brushes.Magenta;
            }
            canvas.DrawLine(canvas, pen, m_p1, m_p2);
            pen = new Pen(pen.Color, (float)3);
            if (horizontal)
            {
                canvas.DrawLine(canvas, pen, m_p2, new UnitPoint(m_p2.X + 0.2, m_p2.Y));
                canvas.Graphics.DrawRectangle(pen, canvas.ToScreen(new UnitPoint(m_p2.X + 0.2, 1)).X, canvas.ToScreen(new UnitPoint(1, m_p2.Y + 0.1)).Y, canvas.ToScreen(m_p3).X - canvas.ToScreen(new UnitPoint(m_p2.X + 0.2, 1)).X, canvas.ToScreen(new UnitPoint(1, m_p2.Y - 0.1)).Y - canvas.ToScreen(new UnitPoint(1, m_p2.Y + 0.1)).Y);
                float size = (canvas.ToScreen(new UnitPoint(m_p1.X + 1, m_p1.Y)).X - canvas.ToScreen(m_p1).X) / 10;
                Font m_font = new System.Drawing.Font("Arial Black", size, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                canvas.Graphics.DrawString("Recorder", m_font, B, canvas.ToScreen(new UnitPoint(m_p2.X + 0.25, m_p2.Y - 0.1)).X, canvas.ToScreen(new UnitPoint(m_p2.X - 0.3, m_p2.Y + 0.1)).Y);

            }
            else
            {
                canvas.DrawLine(canvas, pen, m_p2, new UnitPoint(m_p2.X, m_p2.Y - 0.2));
                canvas.Graphics.DrawRectangle(pen, canvas.ToScreen(new UnitPoint(m_p2.X - 0.4, 1)).X, canvas.ToScreen(new UnitPoint(1, m_p2.Y - 0.2)).Y, canvas.ToScreen(new UnitPoint(m_p2.X + 0.4, 1)).X - canvas.ToScreen(new UnitPoint(m_p2.X - 0.4, 1)).X, canvas.ToScreen(new UnitPoint(1, m_p2.Y - 0.4)).Y - canvas.ToScreen(new UnitPoint(1, m_p2.Y - 0.2)).Y);
                float size = (canvas.ToScreen(new UnitPoint(m_p1.X + 1, m_p1.Y)).X - canvas.ToScreen(m_p1).X) / 10;
                Font m_font = new System.Drawing.Font("Arial Black", size, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                canvas.Graphics.DrawString("Recorder", m_font, B, canvas.ToScreen(new UnitPoint(m_p2.X - 0.35, 1)).X, canvas.ToScreen(new UnitPoint(1, m_p2.Y - 0.2)).Y);
            }
        }
开发者ID:jjacksons,项目名称:GLUE,代码行数:33,代码来源:Recorder.cs


注:本文中的ICanvas类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。