protected override void OnUpdate(RenderContext2D context) { base.OnUpdate(context); if (_opacityMaskChanged) { (SceneNode as PathNode2D).OpacityMask = OpacityMask.ToD2DBrush(SceneNode.RenderSize, context.DeviceContext); _opacityMaskChanged = false; } }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { ComboBox here = (ComboBox)sender; switch (here.SelectedIndex) { case 0: useMask = null; break; case 1: useMask = OpacityMask.CircleMask(70); break; } count(); }
public override void Render(RenderContext parentRenderContext) { if (OpacityMask == null && (TotalHeight > ActualHeight || TotalWidth > ActualWidth)) { SolidColorBrush brush = new SolidColorBrush { Color = Color.Black }; OpacityMask = brush; _forcedOpacityMask = true; } else if (_forcedOpacityMask && TotalHeight <= ActualHeight && TotalWidth <= ActualWidth && OpacityMask != null) { OpacityMask.Dispose(); OpacityMask = null; _opacityMaskContext.Dispose(); _opacityMaskContext = null; _forcedOpacityMask = false; } base.Render(parentRenderContext); }
/// <summary> /// Required to clip any items that are partially within the panel's bounds /// </summary> /// <param name="parentRenderContext"></param> public override void Render(RenderContext parentRenderContext) { if (OpacityMask == null && _actualPhysicalOffset != 0) { SolidColorBrush brush = new SolidColorBrush { Color = Color.Black }; OpacityMask = brush; _forcedOpacityMask = true; } else if (_forcedOpacityMask && _actualPhysicalOffset == 0 && OpacityMask != null) { OpacityMask.Dispose(); OpacityMask = null; _opacityMaskContext.Dispose(); _opacityMaskContext = null; _forcedOpacityMask = false; } base.Render(parentRenderContext); }