当前位置: 首页>>代码示例>>C#>>正文


C# Stroke.ClearUpdateInfo方法代码示例

本文整理汇总了C#中Stroke.ClearUpdateInfo方法的典型用法代码示例。如果您正苦于以下问题:C# Stroke.ClearUpdateInfo方法的具体用法?C# Stroke.ClearUpdateInfo怎么用?C# Stroke.ClearUpdateInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Stroke的用法示例。


在下文中一共展示了Stroke.ClearUpdateInfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReceivedAllUpdatesForStroke

		void ReceivedAllUpdatesForStroke (Stroke stroke)
		{
			cgView.SetNeedsDisplay (stroke);
			stroke.ClearUpdateInfo ();
		}
开发者ID:xamarin,项目名称:monotouch-samples,代码行数:5,代码来源:CanvasMainViewController.cs

示例2: Draw

		// Note: this is not a particularily efficient way to draw a great stroke path
		// with CoreGraphics.It is just a way to produce an interesting looking result.
		// For a real world example you would reuse and cache CGPaths and draw longer
		// paths instead of an aweful lot of tiny ones, etc.You would also respect the
		// draw rect to cull your draw requests.And you would use bezier paths to
		// interpolate between the points to get a smooother curve.
		void Draw (Stroke stroke)
		{
			var updateRanges = stroke.UpdatedRanges ();
			if (DisplayOptions == StrokeViewDisplayOptions.Debug) {
				for (int index = 0; index < DirtyRectViews.Count; index++) {
					var dirtyRectView = DirtyRectViews [index];
					dirtyRectView.Alpha = 0;
					if (index < updateRanges.Length) {
						dirtyRectView.Alpha = 1;
						var range = updateRanges [index];
						var strokes = stroke.Samples.Skip (range.LowerBound)
											.Take (range.UpperBound - range.LowerBound + 1);
						dirtyRectView.Frame = DirtyRectForSampleStride (strokes);
					}
				}
			}

			lastEstimatedSample = null;
			stroke.ClearUpdateInfo ();
			var sampleCount = stroke.Samples.Count;
			if (sampleCount <= 0)
				return;
			var context = UIGraphics.GetCurrentContext ();
			if (context == null)
				return;
			var strokeColor = UIColor.Black;

			Action lineSettings;
			Action forceEstimatedLineSettings;
			if (displayOptions == StrokeViewDisplayOptions.Debug) {
				lineSettings = () => {
					context.SetLineWidth (0.5f);
					context.SetStrokeColor (UIColor.White.CGColor);
				};
				forceEstimatedLineSettings = () => {
					context.SetLineWidth (0.5f);
					context.SetStrokeColor (UIColor.Blue.CGColor);
				};
			} else {
				lineSettings = () => {
					context.SetLineWidth (0.25f);
					context.SetStrokeColor (strokeColor.CGColor);
				};
				forceEstimatedLineSettings = lineSettings;
			}

			Action azimuthSettings = () => {
				context.SetLineWidth (1.5f);
				context.SetStrokeColor (UIColor.Orange.CGColor);
			};

			Action altitudeSettings = () => {
				context.SetLineWidth (0.5f);
				context.SetStrokeColor (strokeColor.CGColor);
			};
			var forceMultiplier = 2f;
			var forceOffset = 0.1f;

			var fillColorRegular = UIColor.Black.CGColor;
			var fillColorCoalesced = UIColor.LightGray.CGColor;
			var fillColorPredicted = UIColor.Red.CGColor;

			CGVector? lockedAzimuthUnitVector = null;
			var azimuthLockAltitudeThreshold = NMath.PI / 2 * 0.8f; // locking azimuth at 80% altitude

			lineSettings ();

			Func<StrokeSample, nfloat> forceAccessBlock = sample => {
				return sample.ForceWithDefault ();
			};

			if (DisplayOptions == StrokeViewDisplayOptions.Ink) {
				forceAccessBlock = sample => {
					return sample.PerpendicularForce ();
				};
			}

			// Make the force influence less pronounced for the calligraphy pen.
			if (DisplayOptions == StrokeViewDisplayOptions.Calligraphy) {
				var prevGetter = forceAccessBlock;
				forceAccessBlock = sample => {
					return NMath.Max (prevGetter (sample), 1);
				};
				// make force value less pronounced
				forceMultiplier = 1;
				forceOffset = 10;
			}

			var previousGetter = forceAccessBlock;
			forceAccessBlock = sample => {
				return previousGetter (sample) * forceMultiplier + forceOffset;
			};

			StrokeSample heldFromSample = null;
//.........这里部分代码省略.........
开发者ID:xamarin,项目名称:monotouch-samples,代码行数:101,代码来源:CGDrawingEngine.cs


注:本文中的Stroke.ClearUpdateInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。