private void OnChanged(object sender, IPaintable p) { if (p.Infreez) { AddToPaint(p); } }
protected void Repaint(IPaintable sender) { if (repaint != null) { repaint(this, sender); } }
private void AddToPaint(IPaintable p) { queue.Enqueue(p); readyToUpdate = true; if (queue.Count > Form1.WORLD_SIZE * Form1.WORLD_SIZE) { queue.Dequeue(); } }
public PaintMouseArgs(MouseEventArgs MouseEventArgs, IPaintable Paintable) { this.Button = MouseEventArgs.Button; this.Clicks = MouseEventArgs.Clicks; this.X = MouseEventArgs.X; this.Y = MouseEventArgs.Y; this.Delta = MouseEventArgs.Delta; this.Location = MouseEventArgs.Location; this.Paintable = Paintable; }
/// <inheritdoc cref="IPaint{TDrawingContext}.RestoreOpacityMask(TDrawingContext, IPaintable{TDrawingContext})" /> public override void RestoreOpacityMask(SkiaSharpDrawingContext context, IPaintable <SkiaSharpDrawingContext> geometry) { if (context.PaintTask is null || context.Paint is null) { return; } var baseColor = context.PaintTask.Color; context.Paint.Color = baseColor; }
/// <inheritdoc cref="IPaint{TDrawingContext}.ApplyOpacityMask(TDrawingContext, IPaintable{TDrawingContext})" /> public override void ApplyOpacityMask(SkiaSharpDrawingContext context, IPaintable <SkiaSharpDrawingContext> geometry) { if (context.PaintTask is null || context.Paint is null) { return; } var baseColor = context.PaintTask.Color; context.Paint.Color = new SKColor(baseColor.Red, baseColor.Green, baseColor.Blue, unchecked ((byte)(255 * geometry.Opacity))); }
public void Paint(IPaintable paintable) { IDecalPaintable decalPaintable = paintable as IDecalPaintable; if (decalPaintable != null) { Paint(decalPaintable); } else { paintable.ApplyBaseLayer(Color.Red); } }
private void HandleLink(IPaintable paintable) { if (FirstClicked == null || FirstClicked == paintable) { FirstClicked = paintable; return; } else { SecondClicked = paintable; if (IsLinkValid()) { CreateLink(); } SecondClicked.Parent.PaintablesLoseFocus(); SecondClicked.Parent.Invalidate(); FirstClicked = null; SecondClicked = null; } }
public override bool Paint(float dt, IPaintable canvas, IGridManager gridManager, Painter.InputState inputState, float minVal, float maxVal, Rect rect, Matrix4x4 TRS) { bool dirty = false; var pos = inputState.GridPosition; var baseCell = gridManager.GetCell(pos); int stealCells = 2; float stolenValue = 0; for (var i = -stealCells; i <= stealCells; i += 1) { for (var j = -stealCells; j <= stealCells; j += 1) { if (i == 0 && j == 0) { continue; } var offset = gridManager.GetOffset(i, j); var value = canvas.GetValue(baseCell + offset); if (value <= 0) { continue; } var stealAmount = Mathf.Min(value, Strength); stolenValue += stealAmount; canvas.SetValue(baseCell + offset, value - stealAmount); dirty = true; } } canvas.SetValue(baseCell, canvas.GetValue(baseCell) + stolenValue); return(dirty); }
/// <inheritdoc cref="IPaint{TDrawingContext}.ApplyOpacityMask(TDrawingContext, IPaintable{TDrawingContext})" /> public void ApplyOpacityMask(TDrawingContext context, IPaintable <TDrawingContext> geometry) { }
/// <inheritdoc cref="IPaint{TDrawingContext}.RestoreOpacityMask(TDrawingContext, IPaintable{TDrawingContext})" /> public void RestoreOpacityMask(TDrawingContext context, IPaintable <TDrawingContext> geometry) { }
public PaintableEventArgs(IPaintable paintable) { this.IPaintable = paintable; }
public void Paint(IPaintable paintable, Color color) { paintable.ChangeColor(color); }
public override bool Paint(float dt, IPaintable canvas, IGridManager gridManager, Painter.InputState inputState, float minVal, float maxVal, Rect rect, Matrix4x4 TRS) { var dirty = false; var scaledRad = gridManager.GetGridSize() * Radius; for (var i = -scaledRad; i <= scaledRad; i += gridManager.GetGridSize()) { for (var j = -scaledRad; j <= scaledRad; j += gridManager.GetGridSize()) { var pos = inputState.GridPosition + new Vector3(i, 0, j); var cell = gridManager.GetCell(pos); if (rect.size.magnitude > 0 && !rect.Contains(pos.xz())) { canvas.RemoveCell(cell); continue; } var normalisedDist = 1f; if (BrushShape == EBrushShape.Circle) { var circleDist = Vector2.Distance(inputState.GridPosition.xz(), pos.xz()); if (circleDist > scaledRad) { continue; } normalisedDist = circleDist / scaledRad; } else { normalisedDist = Mathf.Abs(inputState.GridPosition.x - pos.x) + Mathf.Abs(inputState.GridPosition.y - pos.y); normalisedDist /= scaledRad; } var falloff = 1f; if (!float.IsNaN(normalisedDist)) { falloff = Falloff.Evaluate(normalisedDist); } var val = Strength * falloff; //var existingVal = canvas.GetValue(cell); var sum = 0f; for (var iter = 0; iter < Iterations; ++iter) { for (var u = -1; u <= 1; ++u) { for (var v = -1; v <= 1; ++v) { var neighbourPos = inputState.GridPosition + new Vector3(i + u * gridManager.GetGridSize(), 0, j + v * gridManager.GetGridSize()); var neighbourCell = gridManager.GetCell(neighbourPos); sum += canvas.GetValue(neighbourCell); } } } val = Mathf.Lerp(sum / 9, val, Strength * Flow * dt); val = Mathf.Clamp(val, minVal, maxVal); canvas.SetValue(cell, val); dirty = true; } } return(dirty); }
static void PaintIPaint(IPaintable paintable) { paintable.Paint(); }
private void OnChanged(object sender, IPaintable p) { AddToPaint(p); }
public DragCore(IPaintable paintable) { this.paintable = paintable; Bind(); }
public abstract bool Paint(float dt, IPaintable canvas, IGridManager gridManager, Painter.InputState inputState, float maxValue, float maxVal, Rect rect, Matrix4x4 TRS);
public void Paint(Color paint, IPaintable p) { p.Paint(paint); Console.WriteLine("Painter is used"); }
public void Update(object sender, IPaintable e) { temp.Value = (int)(270 * ((IBrightness)Map[0, 0].Height).Brightness); }
public void Add(IPaintable figure) { Figures.Add(figure); }
/// <inheritdoc cref="IPaint{TDrawingContext}.ApplyOpacityMask(TDrawingContext, IPaintable{TDrawingContext})" /> public override void ApplyOpacityMask(SkiaSharpDrawingContext context, IPaintable <SkiaSharpDrawingContext> geometry) { throw new System.NotImplementedException(); }
public FortyLinker(T link, IPaintable Start, IPaintable Finish) : base(Start, Finish, link) { this.Start = Start; this.Finish = Finish; Init(); }
private void OnChanged(object sender, EventArgs e) { IPaintable p = (IPaintable)sender; p.Paint(Bitmap); }
public void ClickedOnPaintable(MouseEventArgs a, IPaintable paintable) { HandleLink(paintable); ClickedUsingTool?.Invoke(this, new PaintMouseArgs(a, paintable)); }
public void ClickedOnPaintable(MouseEventArgs a, IPaintable paintable) { paintable.Focus(); ClickedUsingTool?.Invoke(this, new PaintMouseArgs(a, paintable)); }