public override BitmapBase Apply(RenderTask renderTask, BitmapBase layer) { Tank tank = renderTask.Tank; var outline = new BitmapRam(layer.Width, layer.Height); layer.GetOutline(outline, Color.GetColorWpf(tank), Threshold, Inside); if (KeepImage) { layer.DrawImage(outline); return(layer); } else { return(outline); } }
public override BitmapBase Apply(RenderTask renderTask, BitmapBase layer) { Tank tank = renderTask.Tank; if (_blur == null || _blur.Radius != Radius) { lock (this) if (_blur == null || _blur.Radius != Radius) { _blur = new GaussianBlur(Radius); } } BitmapBase shadow = layer.ToBitmapRam(); var color = Color.GetColorWpf(tank); shadow.ReplaceColor(color); shadow.Blur(_blur, BlurEdgeMode.Transparent); shadow.ScaleOpacity(Spread, OpacityStyle.Additive); shadow.Transparentize(color.A); layer.DrawImage(shadow, below: true); return(layer); }
public override BitmapBase Apply(Tank tank, BitmapBase layer) { if (_blur == null || _blur.Radius != Radius) lock (this) if (_blur == null || _blur.Radius != Radius) _blur = new GaussianBlur(Radius); BitmapBase shadow = layer.ToBitmapRam(); var color = Color.GetColorWpf(tank); shadow.ReplaceColor(color); shadow.Blur(_blur, BlurEdgeMode.Transparent); shadow.ScaleOpacity(Spread, OpacityStyle.Additive); shadow.Transparentize(color.A); layer.DrawImage(shadow, below: true); return layer; }
public override BitmapBase Apply(Tank tank, BitmapBase layer) { var outline = new BitmapRam(layer.Width, layer.Height); layer.GetOutline(outline, Color.GetColorWpf(tank), Threshold, Inside); if (KeepImage) { layer.DrawImage(outline); return layer; } else return outline; }