protected virtual void DrawParticle() { using (DrawingContext dc = DVisual.RenderOpen()) { // todo not threadsafe Threadsafe: .Radius ((BlurEffect)DVisual.Effect).Radius = _blurEffectRadius; dc.PushTransform(new TranslateTransform(Position.X + DrawingOffset.X, Position.Y + DrawingOffset.Y)); SolidColorBrush brush = new SolidColorBrush(ParticleColor); dc.DrawEllipse(brush, null, new Point(0, 0), SizeV.X, SizeV.Y); dc.Pop(); } }
protected virtual void DrawParticle() { using (DrawingContext dc = DVisual.RenderOpen()) { if (_config.Bmp != null) { ((BlurEffect)DVisual.Effect).Radius = _blurEffectRadius; dc.PushTransform(new TranslateTransform(Position.X + (DrawingOffset.X), Position.Y + DrawingOffset.Y)); dc.PushTransform(new RotateTransform(Angle)); dc.DrawImage(_config.Bmp, new Rect((Point)(-_centerOfMassAbs), SizeV)); dc.Pop(); dc.Pop(); } } }
public override void Frame_Update(object sender, FrameUpdateEventArgs e) { TimeAlive += e.ElapsedMilliseconds; mixupProperties(); if (IsAlive) { if (TimeAlive > ThisLifetime) { IsAlive = false; TimeAlive = 0; using (DrawingContext dc = DVisual.RenderOpen()) { } } else { DrawParticle(); } } }
//public override void Frame_Update(object sender, FrameUpdateEventArgs e) //{ // base.Frame_Update(sender, e); // if (IsAlive) // { // DrawParticle(); // } //} protected override void DrawParticle() { using (DrawingContext dc = DVisual.RenderOpen()) { Vector _offs; foreach (var offset in PositionOffsets) // diese zeile ist auch nicht threadsafe { _offs = offset; if (_offs.Length > 0) { _offs.Normalize(); } _offs *= _spreadPos; // nicht Threadsafe ((BlurEffect)DVisual.Effect).Radius = _blurEffectRadius; //dc.PushTransform(new TranslateTransform(_position.X, _position.Y)); SolidColorBrush brush = new SolidColorBrush(ParticleColor); dc.DrawEllipse(brush, null, (Point)(Position + (_offs) + DrawingOffset), SizeV.X, SizeV.Y); //dc.DrawEllipse(Brushes.Beige, null, new Point(0, 0), 20, 20); //dc.Pop(); } } }