本文整理汇总了C#中CanvasAnimatedDrawEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# CanvasAnimatedDrawEventArgs类的具体用法?C# CanvasAnimatedDrawEventArgs怎么用?C# CanvasAnimatedDrawEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CanvasAnimatedDrawEventArgs类属于命名空间,在下文中一共展示了CanvasAnimatedDrawEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例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;
}
示例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];
}
}
示例4: Draw
public static void Draw(CanvasAnimatedDrawEventArgs args)
{
DrawBackground(args);
DrawTitle(args);
DrawItemsBorder(args);
DrawItems(args);
}
示例5: DrawTitleLayout
public void DrawTitleLayout(CanvasAnimatedDrawEventArgs args, Vector2 position, Color color)
{
if (TitleLayout != null)
{
args.DrawingSession.DrawTextLayout(TitleLayout, position, color);
}
}
示例6: DrawSelected
public void DrawSelected(CanvasAnimatedDrawEventArgs args)
{
if (Position != null)
{
args.DrawingSession.DrawTextLayout(TextLayout, Position, Colors.Yellow);
}
}
示例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);
}
示例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
}
}
示例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;
}
示例10: Draw
public void Draw(Vector2 MapPosition, CanvasAnimatedDrawEventArgs args)
{
foreach(Region region in Regions)
{
region.Draw(MapPosition, args);
}
}
示例11: Draw
public void Draw(CanvasAnimatedDrawEventArgs args)
{
DrawBackground(args);
DrawBorder(args);
DrawFeedItemData(args);
if (State == DISPLAYTILESTATE.ACTIVE || State == DISPLAYTILESTATE.FADING_IN) { DrawTimerBar(args); }
}
示例12: Draw
public void Draw(CanvasAnimatedDrawEventArgs args)
{
if (State == CURSOR_STATE.ON)
{
args.DrawingSession.DrawTextLayout(CursorCharacter, Position, Color);
}
}
示例13: canvasMain_Draw
private void canvasMain_Draw(ICanvasAnimatedControl sender, CanvasAnimatedDrawEventArgs args)
{
foreach(Room room in Rooms)
{
room.Draw(args);
}
}
示例14: Draw
public void Draw(CanvasAnimatedDrawEventArgs args)
{
if (Position != null)
{
args.DrawingSession.DrawTextLayout(TextLayout, Position, Colors.White);
}
}
示例15: Canvas_Draw
private void Canvas_Draw(
ICanvasAnimatedControl sender,
CanvasAnimatedDrawEventArgs args)
{
this.renderer.SetDrawingSession(args.DrawingSession);
this.world.Draw(this.renderer);
this.renderer.ClearDrawingSession();
}