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


C# android.restoreToCount方法代码示例

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


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

示例1: draw

		public override void draw(android.graphics.Canvas canvas)
		{
			int saveCount = canvas.save();
			android.graphics.Rect bounds = mState.mDrawable.getBounds();
			int w = bounds.right - bounds.left;
			int h = bounds.bottom - bounds.top;
			android.graphics.drawable.RotateDrawable.RotateState st = mState;
			float px = st.mPivotXRel ? (w * st.mPivotX) : st.mPivotX;
			float py = st.mPivotYRel ? (h * st.mPivotY) : st.mPivotY;
			canvas.rotate(st.mCurrentDegrees, px + bounds.left, py + bounds.top);
			st.mDrawable.draw(canvas);
			canvas.restoreToCount(saveCount);
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:13,代码来源:RotateDrawable.cs

示例2: unlockCanvasAndPost

		/// <summary>Finish editing pixels in the surface.</summary>
		/// <remarks>
		/// Finish editing pixels in the surface. After this call, the surface's
		/// current pixels will be shown on the screen, but its content is lost,
		/// in particular there is no guarantee that the content of the Surface
		/// will remain unchanged when lockCanvas() is called again.
		/// </remarks>
		/// <param name="canvas">The Canvas previously returned by lockCanvas()</param>
		/// <seealso cref="lockCanvas()">lockCanvas()</seealso>
		/// <seealso cref="lockCanvas(android.graphics.Rect)"></seealso>
		public virtual void unlockCanvasAndPost(android.graphics.Canvas canvas)
		{
			if (mCanvas != null && canvas == mCanvas)
			{
				canvas.restoreToCount(mSaveCount);
				mSaveCount = 0;
				lock (mNativeWindowLock)
				{
					nUnlockCanvasAndPost(mNativeWindow, mCanvas);
				}
			}
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:22,代码来源:TextureView.cs

示例3: drawChild


//.........这里部分代码省略.........
			if (hasNoCache)
			{
				bool layerRendered = false;
				if (layerType == LAYER_TYPE_HARDWARE)
				{
					android.view.HardwareLayer layer = child.getHardwareLayer();
					if (layer != null && layer.isValid())
					{
						child.mLayerPaint.setAlpha((int)(alpha * 255));
						((android.view.HardwareCanvas)canvas).drawHardwareLayer(layer, 0, 0, child.mLayerPaint
							);
						layerRendered = true;
					}
					else
					{
						int scrollX = hasDisplayList ? 0 : sx;
						int scrollY = hasDisplayList ? 0 : sy;
						canvas.saveLayer(scrollX, scrollY, scrollX + cr - cl, scrollY + cb - ct, child.mLayerPaint
							, android.graphics.Canvas.HAS_ALPHA_LAYER_SAVE_FLAG | android.graphics.Canvas.CLIP_TO_LAYER_SAVE_FLAG
							);
					}
				}
				if (!layerRendered)
				{
					if (!hasDisplayList)
					{
						// Fast path for layouts with no backgrounds
						if ((child.mPrivateFlags & SKIP_DRAW) == SKIP_DRAW)
						{
							child.mPrivateFlags &= ~DIRTY_MASK;
							child.dispatchDraw(canvas);
						}
						else
						{
							child.draw(canvas);
						}
					}
					else
					{
						child.mPrivateFlags &= ~DIRTY_MASK;
						((android.view.HardwareCanvas)canvas).drawDisplayList(displayList, cr - cl, cb - 
							ct, null);
					}
				}
			}
			else
			{
				if (cache != null)
				{
					child.mPrivateFlags &= ~DIRTY_MASK;
					android.graphics.Paint cachePaint;
					if (layerType == LAYER_TYPE_NONE)
					{
						cachePaint = mCachePaint;
						if (alpha < 1.0f)
						{
							cachePaint.setAlpha((int)(alpha * 255));
							mGroupFlags |= FLAG_ALPHA_LOWER_THAN_ONE;
						}
						else
						{
							if ((flags & FLAG_ALPHA_LOWER_THAN_ONE) == FLAG_ALPHA_LOWER_THAN_ONE)
							{
								cachePaint.setAlpha(255);
								mGroupFlags &= ~FLAG_ALPHA_LOWER_THAN_ONE;
							}
						}
					}
					else
					{
						cachePaint = child.mLayerPaint;
						cachePaint.setAlpha((int)(alpha * 255));
					}
					canvas.drawBitmap(cache, 0.0f, 0.0f, cachePaint);
				}
			}
			canvas.restoreToCount(restoreTo);
			if (a != null && !more)
			{
				if (!hardwareAccelerated && !a.getFillAfter())
				{
					child.onSetAlpha(255);
				}
				finishAnimatingView(child, a);
			}
			if (more && hardwareAccelerated)
			{
				// invalidation is the trigger to recreate display lists, so if we're using
				// display lists to render, force an invalidate to allow the animation to
				// continue drawing another frame
				invalidate(true);
				if (a.hasAlpha() && (child.mPrivateFlags & ALPHA_SET) == ALPHA_SET)
				{
					// alpha animations should cause the child to recreate its display list
					child.invalidate(true);
				}
			}
			child.mRecreateDisplayList = false;
			return more;
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:101,代码来源:ViewGroup.cs

示例4: dispatchDraw

		protected internal override void dispatchDraw(android.graphics.Canvas canvas)
		{
			int count = mChildrenCount;
			android.view.View[] children = mChildren;
			int flags = mGroupFlags;
			if ((flags & FLAG_RUN_ANIMATION) != 0 && canAnimate())
			{
				bool cache = (mGroupFlags & FLAG_ANIMATION_CACHE) == FLAG_ANIMATION_CACHE;
				bool buildCache = !isHardwareAccelerated();
				{
					for (int i = 0; i < count; i++)
					{
						android.view.View child = children[i];
						if ((child.mViewFlags & VISIBILITY_MASK) == VISIBLE)
						{
							android.view.ViewGroup.LayoutParams @params = child.getLayoutParams();
							attachLayoutAnimationParameters(child, @params, i, count);
							bindLayoutAnimation(child);
							if (cache)
							{
								child.setDrawingCacheEnabled(true);
								if (buildCache)
								{
									child.buildDrawingCache(true);
								}
							}
						}
					}
				}
				android.view.animation.LayoutAnimationController controller = mLayoutAnimationController;
				if (controller.willOverlap())
				{
					mGroupFlags |= FLAG_OPTIMIZE_INVALIDATE;
				}
				controller.start();
				mGroupFlags &= ~FLAG_RUN_ANIMATION;
				mGroupFlags &= ~FLAG_ANIMATION_DONE;
				if (cache)
				{
					mGroupFlags |= FLAG_CHILDREN_DRAWN_WITH_CACHE;
				}
				if (mAnimationListener != null)
				{
					mAnimationListener.onAnimationStart(controller.getAnimation());
				}
			}
			int saveCount = 0;
			bool clipToPadding = (flags & CLIP_TO_PADDING_MASK) == CLIP_TO_PADDING_MASK;
			if (clipToPadding)
			{
				saveCount = canvas.save();
				canvas.clipRect(mScrollX + mPaddingLeft, mScrollY + mPaddingTop, mScrollX + mRight
					 - mLeft - mPaddingRight, mScrollY + mBottom - mTop - mPaddingBottom);
			}
			mPrivateFlags &= ~DRAW_ANIMATION;
			mGroupFlags &= ~FLAG_INVALIDATE_REQUIRED;
			bool more = false;
			long drawingTime = getDrawingTime();
			if ((flags & FLAG_USE_CHILD_DRAWING_ORDER) == 0)
			{
				{
					for (int i = 0; i < count; i++)
					{
						android.view.View child = children[i];
						if ((child.mViewFlags & VISIBILITY_MASK) == VISIBLE || child.getAnimation() != null)
						{
							more |= drawChild(canvas, child, drawingTime);
						}
					}
				}
			}
			else
			{
				{
					for (int i = 0; i < count; i++)
					{
						android.view.View child = children[getChildDrawingOrder(count, i)];
						if ((child.mViewFlags & VISIBILITY_MASK) == VISIBLE || child.getAnimation() != null)
						{
							more |= drawChild(canvas, child, drawingTime);
						}
					}
				}
			}
			if (mDisappearingChildren != null)
			{
				java.util.ArrayList<android.view.View> disappearingChildren = mDisappearingChildren;
				int disappearingCount = disappearingChildren.size() - 1;
				{
					for (int i = disappearingCount; i >= 0; i--)
					{
						android.view.View child = disappearingChildren.get(i);
						more |= drawChild(canvas, child, drawingTime);
					}
				}
			}
			if (clipToPadding)
			{
				canvas.restoreToCount(saveCount);
			}
//.........这里部分代码省略.........
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:101,代码来源:ViewGroup.cs

示例5: draw

		public override void draw(android.graphics.Canvas canvas)
		{
			android.graphics.Rect r = getBounds();
			android.graphics.Paint paint = mShapeState.mPaint;
			int prevAlpha = paint.getAlpha();
			paint.setAlpha(modulateAlpha(prevAlpha, mShapeState.mAlpha));
			if (mShapeState.mShape != null)
			{
				// need the save both for the translate, and for the (unknown) Shape
				int count = canvas.save();
				canvas.translate(r.left, r.top);
				onDraw(mShapeState.mShape, canvas, paint);
				canvas.restoreToCount(count);
			}
			else
			{
				canvas.drawRect(r, paint);
			}
			// restore
			paint.setAlpha(prevAlpha);
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:21,代码来源:ShapeDrawable.cs

示例6: onDraw

		protected internal override void onDraw(android.graphics.Canvas canvas)
		{
			if (mSelectorWheelState == SELECTOR_WHEEL_STATE_NONE)
			{
				return;
			}
			float x = (mRight - mLeft) / 2;
			float y = mCurrentScrollOffset;
			int restoreCount = canvas.save();
			if (mSelectorWheelState == SELECTOR_WHEEL_STATE_SMALL)
			{
				android.graphics.Rect clipBounds = canvas.getClipBounds();
				clipBounds.inset(0, mSelectorElementHeight);
				canvas.clipRect(clipBounds);
			}
			// draw the selector wheel
			int[] selectorIndices = mSelectorIndices;
			{
				for (int i = 0; i < selectorIndices.Length; i++)
				{
					int selectorIndex = selectorIndices[i];
					string scrollSelectorValue = mSelectorIndexToStringCache.get(selectorIndex);
					// Do not draw the middle item if input is visible since the input is shown only
					// if the wheel is static and it covers the middle item. Otherwise, if the user
					// starts editing the text via the IME he may see a dimmed version of the old
					// value intermixed with the new one.
					if (i != SELECTOR_MIDDLE_ITEM_INDEX || mInputText.getVisibility() != VISIBLE)
					{
						canvas.drawText(scrollSelectorValue, x, y, mSelectorWheelPaint);
					}
					y += mSelectorElementHeight;
				}
			}
			// draw the selection dividers (only if scrolling and drawable specified)
			if (mSelectionDivider != null)
			{
				// draw the top divider
				int topOfTopDivider = (getHeight() - mSelectorElementHeight - mSelectionDividerHeight
					) / 2;
				int bottomOfTopDivider = topOfTopDivider + mSelectionDividerHeight;
				mSelectionDivider.setBounds(0, topOfTopDivider, mRight, bottomOfTopDivider);
				mSelectionDivider.draw(canvas);
				// draw the bottom divider
				int topOfBottomDivider = topOfTopDivider + mSelectorElementHeight;
				int bottomOfBottomDivider = bottomOfTopDivider + mSelectorElementHeight;
				mSelectionDivider.setBounds(0, topOfBottomDivider, mRight, bottomOfBottomDivider);
				mSelectionDivider.draw(canvas);
			}
			canvas.restoreToCount(restoreCount);
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:50,代码来源:NumberPicker.cs

示例7: draw

		public override void draw(android.graphics.Canvas canvas)
		{
			base.draw(canvas);
			if (mEdgeGlowLeft != null)
			{
				int scrollX = mScrollX;
				if (!mEdgeGlowLeft.isFinished())
				{
					int restoreCount = canvas.save();
					int height = getHeight() - mPaddingTop - mPaddingBottom;
					canvas.rotate(270);
					canvas.translate(-height + mPaddingTop, System.Math.Min(0, scrollX));
					mEdgeGlowLeft.setSize(height, getWidth());
					if (mEdgeGlowLeft.draw(canvas))
					{
						invalidate();
					}
					canvas.restoreToCount(restoreCount);
				}
				if (!mEdgeGlowRight.isFinished())
				{
					int restoreCount = canvas.save();
					int width = getWidth();
					int height = getHeight() - mPaddingTop - mPaddingBottom;
					canvas.rotate(90);
					canvas.translate(-mPaddingTop, -(System.Math.Max(getScrollRange(), scrollX) + width
						));
					mEdgeGlowRight.setSize(height, width);
					if (mEdgeGlowRight.draw(canvas))
					{
						invalidate();
					}
					canvas.restoreToCount(restoreCount);
				}
			}
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:36,代码来源:HorizontalScrollView.cs

示例8: draw

		public override void draw(android.graphics.Canvas canvas)
		{
			base.draw(canvas);
			if (mEdgeGlowTop != null)
			{
				int scrollY = mScrollY;
				if (!mEdgeGlowTop.isFinished())
				{
					int restoreCount = canvas.save();
					int width = getWidth() - mPaddingLeft - mPaddingRight;
					canvas.translate(mPaddingLeft, System.Math.Min(0, scrollY));
					mEdgeGlowTop.setSize(width, getHeight());
					if (mEdgeGlowTop.draw(canvas))
					{
						invalidate();
					}
					canvas.restoreToCount(restoreCount);
				}
				if (!mEdgeGlowBottom.isFinished())
				{
					int restoreCount = canvas.save();
					int width = getWidth() - mPaddingLeft - mPaddingRight;
					int height = getHeight();
					canvas.translate(-width + mPaddingLeft, System.Math.Max(getScrollRange(), scrollY
						) + height);
					canvas.rotate(180, width, 0);
					mEdgeGlowBottom.setSize(width, height);
					if (mEdgeGlowBottom.draw(canvas))
					{
						invalidate();
					}
					canvas.restoreToCount(restoreCount);
				}
			}
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:35,代码来源:ScrollView.cs

示例9: onDraw

		protected internal override void onDraw(android.graphics.Canvas canvas)
		{
			base.onDraw(canvas);
			if (mDrawable == null)
			{
				return;
			}
			// couldn't resolve the URI
			if (mDrawableWidth == 0 || mDrawableHeight == 0)
			{
				return;
			}
			// nothing to draw (empty bounds)
			if (mDrawMatrix == null && mPaddingTop == 0 && mPaddingLeft == 0)
			{
				mDrawable.draw(canvas);
			}
			else
			{
				int saveCount = canvas.getSaveCount();
				canvas.save();
				if (mCropToPadding)
				{
					int scrollX = mScrollX;
					int scrollY = mScrollY;
					canvas.clipRect(scrollX + mPaddingLeft, scrollY + mPaddingTop, scrollX + mRight -
						 mLeft - mPaddingRight, scrollY + mBottom - mTop - mPaddingBottom);
				}
				canvas.translate(mPaddingLeft, mPaddingTop);
				if (mDrawMatrix != null)
				{
					canvas.concat(mDrawMatrix);
				}
				mDrawable.draw(canvas);
				canvas.restoreToCount(saveCount);
			}
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:37,代码来源:ImageView.cs


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