• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# CanvasAnimatedDrawEventArgs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: CanvasAnimatedControl_OnDraw

		private void CanvasAnimatedControl_OnDraw(ICanvasAnimatedControl sender, CanvasAnimatedDrawEventArgs args)
	    {
		    using (var ds = _blobRenderTarget.CreateDrawingSession())
		    {
				ds.Clear(sender.ClearColor);
				ds.Blend = CanvasBlend.Add;
				foreach (var blob in _blobs)
				{
					_blobBrush.Transform = Matrix3x2.CreateTranslation(blob.Position);
					ds.FillCircle(blob.Position, BlobSize, _blobBrush);
				}
			}
			_mask.Image = _un;
			using (args.DrawingSession.CreateLayer(_mask))
			{
				args.DrawingSession.DrawImage(_gbe);
			}

			foreach (var blob in _blobs)
		    {
			    blob.Position = Vector2.Add(blob.Position, blob.Velocity);
			    var xc = blob.Position.X < 0.0f || blob.Position.X > sender.Size.Width ? -1.0f : 1.0f;
			    var yc = blob.Position.Y < 0.0f || blob.Position.Y > sender.Size.Height ? -1.0f : 1.0f;
				blob.Velocity = new Vector2(blob.Velocity.X * xc, blob.Velocity.Y * yc);
			}
	    }
开发者ID:tomzorz,项目名称:Win2D_fun,代码行数:26,代码来源:MainPage.xaml.cs


示例2: CanvasAnimatedControl_OnDraw

		private void CanvasAnimatedControl_OnDraw(ICanvasAnimatedControl sender, CanvasAnimatedDrawEventArgs args)
		{
			for (int i = 0; i <= _ringCount; i++)
			{
				var currentOffset = StartOffset + i*(RingPadding + RingStrokeWidth);
				using (var c = new CanvasPathBuilder(sender))
				{
					c.BeginFigure(currentOffset, 0.0f);
					c.AddArc(new Vector2(0.0f, 0.0f), currentOffset, currentOffset, 0.0f, (float)(Math.PI * 2));
					c.EndFigure(CanvasFigureLoop.Open);
					using (var g = CanvasGeometry.CreatePath(c))
					{
						var m = _pattern[_animationCounter + (_ringCount - i)];
						_brush.Transform = Matrix3x2.CreateRotation((float)(Math.PI * 2 * m), _center);
						using (args.DrawingSession.CreateLayer(_brush))
						{
							args.DrawingSession.DrawGeometry(g, _center, Color.FromArgb(255,
								m < 0.5 ? Convert.ToByte(Math.Floor(m * 2 * 255)) : Convert.ToByte(Math.Floor((1.5 - m) * 255)),
								m < 0.5 ? (byte)128 : Convert.ToByte(Math.Floor(m * 255)),
								255), RingStrokeWidth);
						}
					}
				}
			}
			_animationCounter++;
			if (_animationCounter > _pattern.Count - _ringCount - 1) _animationCounter = 0;
		}
开发者ID:tomzorz,项目名称:Win2D_fun,代码行数:27,代码来源:MainPage.xaml.cs


示例3: Draw

        public void Draw(CanvasAnimatedDrawEventArgs args, Vector2 position, CanvasTextFormat font)
        {
            if (LastFont == null || LastFont.FontFamily != font.FontFamily || LastFont.FontSize != font.FontSize)
            {
                Widths.Clear();

                // recalculate widths
                for(int i = 0; i < Parts.Count; i++)
                {
                    CanvasTextLayout layoutTemp = new CanvasTextLayout(args.DrawingSession, Parts[i].String.Replace(' ', '.'), font, 0, 0);
                    Widths.Add((float)layoutTemp.LayoutBounds.Width);
                }

                LastFont = font;
            }

            float fOffsetX = 0.0f;
            for (int i = 0; i < Parts.Count; i++)
            {
                // draw string part
                args.DrawingSession.DrawText(Parts[i].String, new Vector2(position.X + fOffsetX, position.Y), Parts[i].Color, font);

                // add to offset
                fOffsetX += Widths[i];
            }
        }
开发者ID:flameeyez,项目名称:win2d_text_game,代码行数:26,代码来源:RichString.cs


示例4: Draw

 public static void Draw(CanvasAnimatedDrawEventArgs args)
 {
     DrawBackground(args);
     DrawTitle(args);
     DrawItemsBorder(args);
     DrawItems(args);
 }
开发者ID:flameeyez,项目名称:win2d_text_game_world_generator,代码行数:7,代码来源:ScreenMainMenu.cs


示例5: DrawTitleLayout

 public void DrawTitleLayout(CanvasAnimatedDrawEventArgs args, Vector2 position, Color color)
 {
     if (TitleLayout != null)
     {
         args.DrawingSession.DrawTextLayout(TitleLayout, position, color);
     }
 }
开发者ID:flameeyez,项目名称:win2d_rss,代码行数:7,代码来源:FeedItemLayoutData.cs


示例6: DrawSelected

 public void DrawSelected(CanvasAnimatedDrawEventArgs args)
 {
     if (Position != null)
     {
         args.DrawingSession.DrawTextLayout(TextLayout, Position, Colors.Yellow);
     }
 }
开发者ID:flameeyez,项目名称:win2d_text_game_world_generator,代码行数:7,代码来源:MenuItem.cs


示例7: drawClock

 // Draws a clock with given ray in the middle of a canvas
 private void drawClock(CanvasAnimatedDrawEventArgs canvas, Vector2 middle, float ray) {
     canvas.DrawingSession.DrawCircle(midScreen, ray, Colors.White);
     canvas.DrawingSession.DrawText("12", midScreen.X - 5, midScreen.Y - ray, Colors.White, font);
     canvas.DrawingSession.DrawText("3", midScreen.X + ray - 10, midScreen.Y - 5, Colors.White, font);
     canvas.DrawingSession.DrawText("6", midScreen.X - 2.5f, midScreen.Y + ray - 12, Colors.White, font);
     canvas.DrawingSession.DrawText("9", midScreen.X - ray + 5, midScreen.Y - 5, Colors.White, font);
 }
开发者ID:eugeniopacceli,项目名称:Win2d.clock,代码行数:8,代码来源:MainPage.xaml.cs


示例8: CanvasAnimatedControl_OnDraw

	    private void CanvasAnimatedControl_OnDraw(ICanvasAnimatedControl sender, CanvasAnimatedDrawEventArgs args)
	    {
			foreach (var waveParticle in _particles)
			{
				args.DrawingSession.DrawLine(waveParticle.DrawPosition, waveParticle.DrawVelocity, Colors.IndianRed, 3.0f);
				args.DrawingSession.FillCircle(waveParticle.DrawPosition, 3.0f, Colors.Aqua);
			}

		    foreach (var waveParticle in _particles) waveParticle.Tick();

			//?
		    var diff = new float[_particles.Count];
		    diff[0] = _particles[1].Position.Y - _particles[0].Position.Y;
		    for (int index = 1; index < _particles.Count - 1; index++)
		    {
			    var l = _particles[index - 1].Position.Y - _particles[index].Position.Y;
			    var r = _particles[index].Position.Y - _particles[index + 1].Position.Y;
			    diff[index] = (l - r)/2.0f;
		    }
		    diff[_particles.Count - 1] = _particles[_particles.Count - 1].Position.Y - _particles[_particles.Count - 2].Position.Y;

		    for (int index = 0; index < _particles.Count; index++)
		    {
			    //todo
		    }
	    }
开发者ID:tomzorz,项目名称:Win2D_fun,代码行数:26,代码来源:MainPage.xaml.cs


示例9: Tick

	    private void Tick(CanvasAnimatedDrawEventArgs args)
	    {
			//swipe
		    var leftN = new Vector2(_leftCenter.X + (float) Math.Sin(ToRad(_loopCounter))*_swiperLength,
			    _leftCenter.Y + (float) Math.Cos(ToRad(_loopCounter))*_swiperLength);
		    var rightN = new Vector2(_rightCenter.X + (float) Math.Sin(ToRad(-1*_loopCounter + 180))*_swiperLength,
			    _rightCenter.Y + (float) Math.Cos(ToRad(-1*_loopCounter + 180))*_swiperLength);
		    args.DrawingSession.DrawLine(_leftCenter, leftN, Colors.Black, 1.0f);
		    args.DrawingSession.DrawLine(_rightCenter, rightN, Colors.Black, 1.0f);

		    //cleanup
		    for (var i = _lines.Count - 1; i >= 0; i--)
		    {
			    if (_lines[i].Timeout == 0) _lines.Remove(_lines[i]);
		    }
		    //draw
		    foreach (var fadingLine in _lines)
		    {
			    args.DrawingSession.DrawLine(fadingLine.Start, fadingLine.End,
				    Color.FromArgb((byte) (80*((float) fadingLine.Timeout/FadeStart)), 0, 0, 0));
			    fadingLine.Timeout -= 1;
		    }
		    //add new
		    _lines.Add(new FadingLine {End = rightN, Start = leftN, Timeout = FadeStart});
		    _lines.Add(new FadingLine {End = rightN, Start = _rightCenter, Timeout = FadeStart});
		    _lines.Add(new FadingLine {End = leftN, Start = _leftCenter, Timeout = FadeStart});

		    //loop
		    _loopCounter += 0.5f;
		    if (_loopCounter > 360.0) _loopCounter = 0.5f;
	    }
开发者ID:tomzorz,项目名称:Win2D_fun,代码行数:31,代码来源:MainPage.xaml.cs


示例10: Draw

 public void Draw(Vector2 MapPosition, CanvasAnimatedDrawEventArgs args)
 {
     foreach(Region region in Regions)
     {
         region.Draw(MapPosition, args);
     }
 }
开发者ID:flameeyez,项目名称:Win2D_BattleRoyale,代码行数:7,代码来源:Faction.cs


示例11: Draw

 public void Draw(CanvasAnimatedDrawEventArgs args)
 {
     DrawBackground(args);
     DrawBorder(args);
     DrawFeedItemData(args);
     if (State == DISPLAYTILESTATE.ACTIVE || State == DISPLAYTILESTATE.FADING_IN) { DrawTimerBar(args); }
 }
开发者ID:flameeyez,项目名称:win2d_rss,代码行数:7,代码来源:DisplayTile.cs


示例12: Draw

 public void Draw(CanvasAnimatedDrawEventArgs args)
 {
     if (State == CURSOR_STATE.ON)
     {
         args.DrawingSession.DrawTextLayout(CursorCharacter, Position, Color);
     }
 }
开发者ID:flameeyez,项目名称:win2d_text_game_world_generator,代码行数:7,代码来源:win2d_TextboxCursor.cs


示例13: canvasMain_Draw

 private void canvasMain_Draw(ICanvasAnimatedControl sender, CanvasAnimatedDrawEventArgs args)
 {
     foreach(Room room in Rooms)
     {
         room.Draw(args);
     }
 }
开发者ID:flameeyez,项目名称:win2d_procedural_rooms,代码行数:7,代码来源:MainPage.xaml.cs


示例14: Draw

 public void Draw(CanvasAnimatedDrawEventArgs args)
 {
     if (Position != null)
     {
         args.DrawingSession.DrawTextLayout(TextLayout, Position, Colors.White);
     }
 }
开发者ID:flameeyez,项目名称:win2d_text_game_world_generator,代码行数:7,代码来源:MenuItem.cs


示例15: Canvas_Draw

		private void Canvas_Draw(
			ICanvasAnimatedControl sender,
			CanvasAnimatedDrawEventArgs args)
		{
			this.renderer.SetDrawingSession(args.DrawingSession);

			this.world.Draw(this.renderer);

			this.renderer.ClearDrawingSession();
		}
开发者ID:slanger,项目名称:Win2dFun,代码行数:10,代码来源:MainPage.xaml.cs


示例16: Draw

        public static void Draw(CanvasAnimatedDrawEventArgs args)
        {
            foreach (win2d_Control control in Controls)
            {
                control.Draw(args);
            }

            // START DEBUG
            DrawDebug(args);
            // END DEBUG
        }
开发者ID:flameeyez,项目名称:win2d_text_game,代码行数:11,代码来源:UI.cs


示例17: canvasMain_Draw

        private void canvasMain_Draw(ICanvasAnimatedControl sender, CanvasAnimatedDrawEventArgs args)
        {
            map.Draw(args);
            rlbProminent.Draw(args);
            rlbLeaderboard.Draw(args);

            // args.DrawingSession.DrawLine(Statics.ColumnDividerTop, Statics.ColumnDividerBottom, Colors.White);
            // Leaderboard.Draw(args);

            //DrawDebug(args);
        }
开发者ID:flameeyez,项目名称:Win2D_BattleRoyale,代码行数:11,代码来源:MainPage.xaml.cs


示例18: Draw

        public static void Draw(CanvasAnimatedDrawEventArgs args)
        {
            args.DrawingSession.FillRectangle(MapCreationScreenBackgroundRect, Colors.CornflowerBlue);

            if (ProgressPhaseTextLayout != null)
            {
                args.DrawingSession.DrawTextLayout(ProgressPhaseTextLayout, ProgressPhaseTextLayoutPosition, Colors.White);
                args.DrawingSession.FillRectangle(ProgressPercentageRect, Colors.White);
                args.DrawingSession.DrawRectangle(ProgressPercentageBorderRect, Colors.White);
            }
        }
开发者ID:flameeyez,项目名称:win2d_text_game_world_generator,代码行数:11,代码来源:ScreenMapCreationProgress.cs


示例19: Draw

        public override void Draw(CanvasAnimatedDrawEventArgs args)
        {
            args.DrawingSession.FillRectangle(Rect, Color);

            foreach (win2d_Control control in Controls)
            {
                control.Draw(args);
            }

            // border
            args.DrawingSession.DrawRectangle(Rect, Colors.White);
        }
开发者ID:flameeyez,项目名称:win2d_text_game_world_generator,代码行数:12,代码来源:win2d_Panel.cs


示例20: CanvasControl_Draw

        // Updates the Win2D canvas for each Draw operation, those are usually many times per second
        private void CanvasControl_Draw(ICanvasAnimatedControl sender, CanvasAnimatedDrawEventArgs args) {
            // Calculates the angles using using the time spent for each measure of time.    
            float secAngle = (float)(DateTime.Now.Second * 6.28) / 60 - polarFix;
            float minAngle = (float)(DateTime.Now.Minute * 6.28 + secAngle) / 60 - polarFix;
            float houAngle = (float)(DateTime.Now.Hour * 6.28 / 12) + (minAngle / 60) - polarFix;

            drawClock(args, midScreen, ray);

            drawClockPointer(args, midScreen, ray, secAngle, Colors.Red);
            drawClockPointer(args, midScreen, ray, minAngle, Colors.Blue);
            drawClockPointer(args, midScreen, ray, houAngle, Colors.Green);
        }
开发者ID:eugeniopacceli,项目名称:Win2d.clock,代码行数:13,代码来源:MainPage.xaml.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CanvasControl类代码示例发布时间:2022-05-24
下一篇:
C# Canvas类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap