/// <summary> /// 进入绘画模式,整个对象将画到一张RenderTexture上,然后这种贴图将代替原有的显示内容。 /// 可以在onPaint回调里对这张纹理进行进一步操作,实现特殊效果。 /// 可能有多个地方要求进入绘画模式,这里用requestorId加以区别,取值是1、2、4、8、16以此类推。1024内内部保留。用户自定义的id从1024开始。 /// </summary> /// <param name="requestId">请求者id</param> /// <param name="margin">纹理四周的留空。如果特殊处理后的内容大于原内容,那么这里的设置可以使纹理扩大。</param> public void EnterPaintingMode(int requestorId, Margin?margin) { bool first = _paintingMode == 0; _paintingMode |= requestorId; if (first) { if (paintingGraphics == null) { paintingGraphics = new NGraphics(); } else { paintingGraphics.enabled = true; } _paintingMargin = new Margin(); _outlineChanged = true; } if (margin != null) { _paintingMargin = (Margin)margin; } _paintingFlag = 1; }
/// <summary> /// 进入绘画模式,整个对象将画到一张RenderTexture上,然后这种贴图将代替原有的显示内容。 /// 可以在onPaint回调里对这张纹理进行进一步操作,实现特殊效果。 /// 可能有多个地方要求进入绘画模式,这里用requestorId加以区别,取值是1、2、4、8、16以此类推。1024内内部保留。用户自定义的id从1024开始。 /// </summary> /// <param name="requestId">请求者id</param> /// <param name="margin">纹理四周的留空。如果特殊处理后的内容大于原内容,那么这里的设置可以使纹理扩大。</param> public void EnterPaintingMode(int requestorId, Margin?margin) { bool first = _paintingMode == 0; _paintingMode |= requestorId; if (first) { if (paintingGraphics == null) { if (graphics == null) { paintingGraphics = new NGraphics(this.gameObject); } else { GameObject go = new GameObject(this.gameObject.name + " (Painter)"); go.layer = this.gameObject.layer; ToolSet.SetParent(go.transform, cachedTransform); go.hideFlags = DisplayOptions.hideFlags; paintingGraphics = new NGraphics(go); } } else { paintingGraphics.enabled = true; } paintingGraphics.vertexMatrix = null; if (_paintingMaterial == null) { _paintingMaterial = new Material(ShaderConfig.GetShader(ShaderConfig.imageShader)); _paintingMaterial.hideFlags = DisplayOptions.hideFlags; } paintingGraphics.material = _paintingMaterial; if (this is Container) { ((Container)this).SetChildrenLayer(CaptureCamera.hiddenLayer); ((Container)this).UpdateBatchingFlags(); } else { this.InvalidateBatchingState(); } if (graphics != null) { this.gameObject.layer = CaptureCamera.hiddenLayer; } _paintingMargin = new Margin(); } if (margin != null) { _paintingMargin = (Margin)margin; } _paintingFlag = 1; }
private void UpdateThrottlerUnlocked() { // before measure every element in the chart // we copy the properties that might change while we are updating the chart // this call should be thread safe // ToDo: ensure it is thread safe... viewDrawMargin = chartView.DrawMargin; controlSize = chartView.ControlSize; yAxes = chartView.YAxes.Select(x => x.Copy()).ToArray(); xAxes = chartView.XAxes.Select(x => x.Copy()).ToArray(); measureWorker = new object(); series = chartView.Series.Select(series => { // a good implementation of ISeries<T> // must use the measureWorker to identify // if the points are already fetched. // this way no matter if the Series.Values collection changes // the fetch method will always return the same collection for the // current measureWorker instance series.Fetch(this); return(series); }).ToArray(); legendPosition = chartView.LegendPosition; legendOrientation = chartView.LegendOrientation; legend = chartView.Legend; // ... this is a reference type.. this has no sense tooltipPosition = chartView.TooltipPosition; tooltipFindingStrategy = chartView.TooltipFindingStrategy; tooltip = chartView.Tooltip; //... no sense again... animationsSpeed = chartView.AnimationsSpeed; easingFunction = chartView.EasingFunction; Measure(); }
public FormControlContextBuilder WithMargin(Margin?margin) { context.Margin = margin; return(this); }