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


C# android.save方法代码示例

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


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

示例1: draw

		public override void draw(android.graphics.Canvas canvas, android.graphics.Paint 
			paint)
		{
			canvas.save();
			canvas.scale(mScaleX, mScaleY);
			canvas.drawPath(mPath, paint);
			canvas.restore();
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:8,代码来源:PathShape.cs

示例2: draw

		public override void draw(android.graphics.Canvas canvas)
		{
			if (mPicture != null)
			{
				android.graphics.Rect bounds = getBounds();
				canvas.save();
				canvas.clipRect(bounds);
				canvas.translate(bounds.left, bounds.top);
				canvas.drawPicture(mPicture);
				canvas.restore();
			}
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:12,代码来源:PictureDrawable.cs

示例3: 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

示例4: draw

		public virtual void draw(android.graphics.Canvas canvas)
		{
			if (mDrawable == null)
			{
				return;
			}
			canvas.save(android.graphics.Canvas.MATRIX_SAVE_FLAG);
			canvas.translate(mTranslationX, mTranslationY);
			canvas.scale(mScaleX, mScaleY);
			canvas.translate(-0.5f * getWidth(), -0.5f * getHeight());
			mDrawable.setAlpha((int)Sharpen.Util.Round(mAlpha * 255f));
			mDrawable.draw(canvas);
			canvas.restore();
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:14,代码来源:TargetDrawable.cs

示例5: onDraw

		protected internal override void onDraw(android.graphics.Canvas canvas)
		{
			lock (this)
			{
				base.onDraw(canvas);
				if (mThumb != null)
				{
					canvas.save();
					// Translate the padding. For the x, we need to allow the thumb to
					// draw in its extra space
					canvas.translate(mPaddingLeft - mThumbOffset, mPaddingTop);
					mThumb.draw(canvas);
					canvas.restore();
				}
			}
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:16,代码来源:AbsSeekBar.cs

示例6: drawChild


//.........这里部分代码省略.........
			{
				if (!hardwareAccelerated)
				{
					if (layerType != LAYER_TYPE_NONE)
					{
						layerType = LAYER_TYPE_SOFTWARE;
						child.buildDrawingCache(true);
					}
					cache = child.getDrawingCache(true);
				}
				else
				{
					switch (layerType)
					{
						case LAYER_TYPE_SOFTWARE:
						{
							child.buildDrawingCache(true);
							cache = child.getDrawingCache(true);
							break;
						}

						case LAYER_TYPE_NONE:
						{
							// Delay getting the display list until animation-driven alpha values are
							// set up and possibly passed on to the view
							hasDisplayList = child.canHaveDisplayList();
							break;
						}
					}
				}
			}
			bool hasNoCache = cache == null || hasDisplayList;
			bool offsetForScroll = cache == null && !hasDisplayList && layerType != LAYER_TYPE_HARDWARE;
			int restoreTo = canvas.save();
			if (offsetForScroll)
			{
				canvas.translate(cl - sx, ct - sy);
			}
			else
			{
				canvas.translate(cl, ct);
				if (scalingRequired)
				{
					// mAttachInfo cannot be null, otherwise scalingRequired == false
					float scale = 1.0f / mAttachInfo.mApplicationScale;
					canvas.scale(scale, scale);
				}
			}
			if (transformToApply != null || alpha < 1.0f || !child.hasIdentityMatrix())
			{
				if (transformToApply != null || !childHasIdentityMatrix)
				{
					int transX = 0;
					int transY = 0;
					if (offsetForScroll)
					{
						transX = -sx;
						transY = -sy;
					}
					if (transformToApply != null)
					{
						if (concatMatrix)
						{
							// Undo the scroll translation, apply the transformation matrix,
							// then redo the scroll translate to get the correct result.
							canvas.translate(-transX, -transY);
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:67,代码来源:ViewGroup.cs

示例7: 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

示例8: 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

示例9: draw

		public override void draw(android.graphics.Canvas canvas)
		{
			if (mClipState.mDrawable.getLevel() == 0)
			{
				return;
			}
			android.graphics.Rect r = mTmpRect;
			android.graphics.Rect bounds = getBounds();
			int level = getLevel();
			int w = bounds.width();
			int iw = 0;
			//mClipState.mDrawable.getIntrinsicWidth();
			if ((mClipState.mOrientation & HORIZONTAL) != 0)
			{
				w -= (w - iw) * (10000 - level) / 10000;
			}
			int h = bounds.height();
			int ih = 0;
			//mClipState.mDrawable.getIntrinsicHeight();
			if ((mClipState.mOrientation & VERTICAL) != 0)
			{
				h -= (h - ih) * (10000 - level) / 10000;
			}
			int layoutDirection = getResolvedLayoutDirectionSelf();
			android.view.Gravity.apply(mClipState.mGravity, w, h, bounds, r, layoutDirection);
			if (w > 0 && h > 0)
			{
				canvas.save();
				canvas.clipRect(r);
				mClipState.mDrawable.draw(canvas);
				canvas.restore();
			}
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:33,代码来源:ClipDrawable.cs

示例10: draw

		/// <summary>Draw this object to the canvas using the properties defined in this class.
		/// 	</summary>
		/// <remarks>Draw this object to the canvas using the properties defined in this class.
		/// 	</remarks>
		/// <param name="canvas">canvas to draw into</param>
		public virtual void draw(android.graphics.Canvas canvas)
		{
			float threshold = 1.0f / 256.0f;
			// contribution less than 1 LSB of RGB byte
			if (mAlpha <= threshold)
			{
				// don't bother if it won't show up
				return;
			}
			canvas.save(android.graphics.Canvas.MATRIX_SAVE_FLAG);
			canvas.translate(mX, mY);
			canvas.scale(mScaleX, mScaleY);
			canvas.translate(-0.5f * getWidth(), -0.5f * getHeight());
			mDrawable.setAlpha((int)Sharpen.Util.Round(mAlpha * 255f));
			mDrawable.draw(canvas);
			canvas.restore();
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:22,代码来源:DrawableHolder.cs

示例11: onDraw

		protected internal override void onDraw(android.graphics.Canvas canvas)
		{
			base.onDraw(canvas);
			bool changed = mChanged;
			if (changed)
			{
				mChanged = false;
			}
			int availableWidth = mRight - mLeft;
			int availableHeight = mBottom - mTop;
			int x = availableWidth / 2;
			int y = availableHeight / 2;
			android.graphics.drawable.Drawable dial = mDial;
			int w = dial.getIntrinsicWidth();
			int h = dial.getIntrinsicHeight();
			bool scaled = false;
			if (availableWidth < w || availableHeight < h)
			{
				scaled = true;
				float scale = System.Math.Min((float)availableWidth / (float)w, (float)availableHeight
					 / (float)h);
				canvas.save();
				canvas.scale(scale, scale, x, y);
			}
			if (changed)
			{
				dial.setBounds(x - (w / 2), y - (h / 2), x + (w / 2), y + (h / 2));
			}
			dial.draw(canvas);
			canvas.save();
			canvas.rotate(mHour / 12.0f * 360.0f, x, y);
			android.graphics.drawable.Drawable hourHand = mHourHand;
			if (changed)
			{
				w = hourHand.getIntrinsicWidth();
				h = hourHand.getIntrinsicHeight();
				hourHand.setBounds(x - (w / 2), y - (h / 2), x + (w / 2), y + (h / 2));
			}
			hourHand.draw(canvas);
			canvas.restore();
			canvas.save();
			canvas.rotate(mMinutes / 60.0f * 360.0f, x, y);
			android.graphics.drawable.Drawable minuteHand = mMinuteHand;
			if (changed)
			{
				w = minuteHand.getIntrinsicWidth();
				h = minuteHand.getIntrinsicHeight();
				minuteHand.setBounds(x - (w / 2), y - (h / 2), x + (w / 2), y + (h / 2));
			}
			minuteHand.draw(canvas);
			canvas.restore();
			if (scaled)
			{
				canvas.restore();
			}
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:56,代码来源:AnalogClock.cs

示例12: 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

示例13: 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

示例14: dispatchDraw

		protected internal override void dispatchDraw(android.graphics.Canvas canvas)
		{
			bool expandClipRegion = false;
			canvas.getClipBounds(stackInvalidateRect);
			int childCount = getChildCount();
			{
				for (int i = 0; i < childCount; i++)
				{
					android.view.View child = getChildAt(i);
					android.widget.StackView.LayoutParams lp = (android.widget.StackView.LayoutParams
						)child.getLayoutParams();
					if ((lp.horizontalOffset == 0 && lp.verticalOffset == 0) || child.getAlpha() == 0f
						 || child.getVisibility() != VISIBLE)
					{
						lp.resetInvalidateRect();
					}
					android.graphics.Rect childInvalidateRect = lp.getInvalidateRect();
					if (!childInvalidateRect.isEmpty())
					{
						expandClipRegion = true;
						stackInvalidateRect.union(childInvalidateRect);
					}
				}
			}
			// We only expand the clip bounds if necessary.
			if (expandClipRegion)
			{
				canvas.save(android.graphics.Canvas.CLIP_SAVE_FLAG);
				canvas.clipRect(stackInvalidateRect, android.graphics.Region.Op.UNION);
				base.dispatchDraw(canvas);
				canvas.restore();
			}
			else
			{
				base.dispatchDraw(canvas);
			}
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:37,代码来源:StackView.cs

示例15: 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


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