Exemple #1
0
		/// <summary>Return true if the shader has a non-identity local matrix.</summary>
		/// <remarks>Return true if the shader has a non-identity local matrix.</remarks>
		/// <param name="localM">If not null, it is set to the shader's local matrix.</param>
		/// <returns>true if the shader has a non-identity local matrix</returns>
		public virtual bool getLocalMatrix(android.graphics.Matrix localM)
		{
			if (mLocalMatrix != null)
			{
				localM.set(mLocalMatrix);
				return !mLocalMatrix.isIdentity();
			}
			return false;
		}
		public override bool getPadding(android.graphics.Rect padding)
		{
			android.graphics.Rect r = mDrawableContainerState.getConstantPadding();
			if (r != null)
			{
				padding.set(r);
				return true;
			}
			if (mCurrDrawable != null)
			{
				return mCurrDrawable.getPadding(padding);
			}
			else
			{
				return base.getPadding(padding);
			}
		}
Exemple #3
0
		/// <summary>
		/// Return in padding the insets suggested by this Drawable for placing
		/// content inside the drawable's bounds.
		/// </summary>
		/// <remarks>
		/// Return in padding the insets suggested by this Drawable for placing
		/// content inside the drawable's bounds. Positive values move toward the
		/// center of the Drawable (set Rect.inset). Returns true if this drawable
		/// actually has a padding, else false. When false is returned, the padding
		/// is always set to 0.
		/// </remarks>
		public virtual bool getPadding(android.graphics.Rect padding)
		{
			padding.set(0, 0, 0, 0);
			return false;
		}
Exemple #4
0
		/// <summary>
		/// Return a copy of the drawable's bounds in the specified Rect (allocated
		/// by the caller).
		/// </summary>
		/// <remarks>
		/// Return a copy of the drawable's bounds in the specified Rect (allocated
		/// by the caller). The bounds specify where this will draw when its draw()
		/// method is called.
		/// </remarks>
		/// <param name="bounds">
		/// Rect to receive the drawable's bounds (allocated by the
		/// caller).
		/// </param>
		public void copyBounds(android.graphics.Rect bounds)
		{
			bounds.set(mBounds);
		}
Exemple #5
0
		public virtual android.view.ViewParent invalidateChildInParent(int[] location, android.graphics.Rect
			 dirty)
		{
			if ((mPrivateFlags & DRAWN) == DRAWN || (mPrivateFlags & DRAWING_CACHE_VALID) == 
				DRAWING_CACHE_VALID)
			{
				if ((mGroupFlags & (FLAG_OPTIMIZE_INVALIDATE | FLAG_ANIMATION_DONE)) != FLAG_OPTIMIZE_INVALIDATE)
				{
					dirty.offset(location[CHILD_LEFT_INDEX] - mScrollX, location[CHILD_TOP_INDEX] - mScrollY
						);
					int left = mLeft;
					int top = mTop;
					if ((mGroupFlags & FLAG_CLIP_CHILDREN) != FLAG_CLIP_CHILDREN || dirty.intersect(0
						, 0, mRight - left, mBottom - top) || (mPrivateFlags & DRAW_ANIMATION) == DRAW_ANIMATION)
					{
						mPrivateFlags &= ~DRAWING_CACHE_VALID;
						location[CHILD_LEFT_INDEX] = left;
						location[CHILD_TOP_INDEX] = top;
						if (mLayerType != LAYER_TYPE_NONE)
						{
							mLocalDirtyRect.union(dirty);
						}
						return mParent;
					}
				}
				else
				{
					mPrivateFlags &= ~DRAWN & ~DRAWING_CACHE_VALID;
					location[CHILD_LEFT_INDEX] = mLeft;
					location[CHILD_TOP_INDEX] = mTop;
					if ((mGroupFlags & FLAG_CLIP_CHILDREN) == FLAG_CLIP_CHILDREN)
					{
						dirty.set(0, 0, mRight - mLeft, mBottom - mTop);
					}
					else
					{
						// in case the dirty rect extends outside the bounds of this container
						dirty.union(0, 0, mRight - mLeft, mBottom - mTop);
					}
					if (mLayerType != LAYER_TYPE_NONE)
					{
						mLocalDirtyRect.union(dirty);
					}
					return mParent;
				}
			}
			return null;
		}
Exemple #6
0
		public virtual void invalidateChild(android.view.View child, android.graphics.Rect
			 dirty)
		{
			android.view.ViewParent parent = this;
			android.view.View.AttachInfo attachInfo = mAttachInfo;
			if (attachInfo != null)
			{
				// If the child is drawing an animation, we want to copy this flag onto
				// ourselves and the parent to make sure the invalidate request goes
				// through
				bool drawAnimation = (child.mPrivateFlags & DRAW_ANIMATION) == DRAW_ANIMATION;
				if (dirty == null)
				{
					if (child.mLayerType != LAYER_TYPE_NONE)
					{
						mPrivateFlags |= INVALIDATED;
						mPrivateFlags &= ~DRAWING_CACHE_VALID;
						child.mLocalDirtyRect.setEmpty();
					}
					do
					{
						android.view.View view = null;
						if (parent is android.view.View)
						{
							view = (android.view.View)parent;
							if (view.mLayerType != LAYER_TYPE_NONE)
							{
								view.mLocalDirtyRect.setEmpty();
								if (view.getParent() is android.view.View)
								{
									android.view.View grandParent = (android.view.View)view.getParent();
									grandParent.mPrivateFlags |= INVALIDATED;
									grandParent.mPrivateFlags &= ~DRAWING_CACHE_VALID;
								}
							}
							if ((view.mPrivateFlags & DIRTY_MASK) != 0)
							{
								// already marked dirty - we're done
								break;
							}
						}
						if (drawAnimation)
						{
							if (view != null)
							{
								view.mPrivateFlags |= DRAW_ANIMATION;
							}
							else
							{
								if (parent is android.view.ViewRootImpl)
								{
									((android.view.ViewRootImpl)parent).mIsAnimating = true;
								}
							}
						}
						if (parent is android.view.ViewRootImpl)
						{
							((android.view.ViewRootImpl)parent).invalidate();
							parent = null;
						}
						else
						{
							if (view != null)
							{
								if ((view.mPrivateFlags & DRAWN) == DRAWN || (view.mPrivateFlags & DRAWING_CACHE_VALID
									) == DRAWING_CACHE_VALID)
								{
									view.mPrivateFlags &= ~DRAWING_CACHE_VALID;
									view.mPrivateFlags |= DIRTY;
									parent = view.mParent;
								}
								else
								{
									parent = null;
								}
							}
						}
					}
					while (parent != null);
				}
				else
				{
					// Check whether the child that requests the invalidate is fully opaque
					bool isOpaque_1 = child.isOpaque() && !drawAnimation && child.getAnimation() == null;
					// Mark the child as dirty, using the appropriate flag
					// Make sure we do not set both flags at the same time
					int opaqueFlag = isOpaque_1 ? DIRTY_OPAQUE : DIRTY;
					if (child.mLayerType != LAYER_TYPE_NONE)
					{
						mPrivateFlags |= INVALIDATED;
						mPrivateFlags &= ~DRAWING_CACHE_VALID;
						child.mLocalDirtyRect.union(dirty);
					}
					int[] location = attachInfo.mInvalidateChildLocation;
					location[CHILD_LEFT_INDEX] = child.mLeft;
					location[CHILD_TOP_INDEX] = child.mTop;
					android.graphics.Matrix childMatrix = child.getMatrix();
					if (!childMatrix.isIdentity())
					{
						android.graphics.RectF boundingRect = attachInfo.mTmpTransformRect;
						boundingRect.set(dirty);
						//boundingRect.inset(-0.5f, -0.5f);
						childMatrix.mapRect(boundingRect);
						dirty.set((int)(boundingRect.left - 0.5f), (int)(boundingRect.top - 0.5f), (int)(
							boundingRect.right + 0.5f), (int)(boundingRect.bottom + 0.5f));
					}
					do
					{
						android.view.View view = null;
						if (parent is android.view.View)
						{
							view = (android.view.View)parent;
							if (view.mLayerType != LAYER_TYPE_NONE && view.getParent() is android.view.View)
							{
								android.view.View grandParent = (android.view.View)view.getParent();
								grandParent.mPrivateFlags |= INVALIDATED;
								grandParent.mPrivateFlags &= ~DRAWING_CACHE_VALID;
							}
						}
						if (drawAnimation)
						{
							if (view != null)
							{
								view.mPrivateFlags |= DRAW_ANIMATION;
							}
							else
							{
								if (parent is android.view.ViewRootImpl)
								{
									((android.view.ViewRootImpl)parent).mIsAnimating = true;
								}
							}
						}
						// If the parent is dirty opaque or not dirty, mark it dirty with the opaque
						// flag coming from the child that initiated the invalidate
						if (view != null)
						{
							if ((view.mViewFlags & FADING_EDGE_MASK) != 0 && view.getSolidColor() == 0)
							{
								opaqueFlag = DIRTY;
							}
							if ((view.mPrivateFlags & DIRTY_MASK) != DIRTY)
							{
								view.mPrivateFlags = (view.mPrivateFlags & ~DIRTY_MASK) | opaqueFlag;
							}
						}
						parent = parent.invalidateChildInParent(location, dirty);
						if (view != null)
						{
							// Account for transform on current parent
							android.graphics.Matrix m = view.getMatrix();
							if (!m.isIdentity())
							{
								android.graphics.RectF boundingRect = attachInfo.mTmpTransformRect;
								boundingRect.set(dirty);
								m.mapRect(boundingRect);
								dirty.set((int)boundingRect.left, (int)boundingRect.top, (int)(boundingRect.right
									 + 0.5f), (int)(boundingRect.bottom + 0.5f));
							}
						}
					}
					while (parent != null);
				}
			}
		}
Exemple #7
0
		/// <summary>
		/// Returns true if a child view contains the specified point when transformed
		/// into its coordinate space.
		/// </summary>
		/// <remarks>
		/// Returns true if a child view contains the specified point when transformed
		/// into its coordinate space.
		/// Child must not be null.
		/// </remarks>
		/// <hide></hide>
		protected internal virtual bool isTransformedTouchPointInView(float x, float y, android.view.View
			 child, android.graphics.PointF outLocalPoint)
		{
			float localX = x + mScrollX - child.mLeft;
			float localY = y + mScrollY - child.mTop;
			if (!child.hasIdentityMatrix() && mAttachInfo != null)
			{
				float[] localXY = mAttachInfo.mTmpTransformLocation;
				localXY[0] = localX;
				localXY[1] = localY;
				child.getInverseMatrix().mapPoints(localXY);
				localX = localXY[0];
				localY = localXY[1];
			}
			bool isInView = child.pointInView(localX, localY);
			if (isInView && outLocalPoint != null)
			{
				outLocalPoint.set(localX, localY);
			}
			return isInView;
		}
Exemple #8
0
		public override bool getPadding(android.graphics.Rect padding)
		{
			if (mShapeState.mPadding != null)
			{
				padding.set(mShapeState.mPadding);
				return true;
			}
			else
			{
				return base.getPadding(padding);
			}
		}
		public override bool getPadding(android.graphics.Rect padding)
		{
			padding.set(mPadding);
			return true;
		}
Exemple #10
0
		/// <summary>Gets the size of the display as a rectangle, in pixels.</summary>
		/// <remarks>Gets the size of the display as a rectangle, in pixels.</remarks>
		/// <param name="outSize">
		/// A
		/// <see cref="android.graphics.Rect">android.graphics.Rect</see>
		/// object to receive the size information.
		/// </param>
		/// <seealso cref="getSize(android.graphics.Point)">getSize(android.graphics.Point)</seealso>
		public virtual void getRectSize(android.graphics.Rect outSize)
		{
			lock (mTmpPoint)
			{
				getSizeInternal(mTmpPoint, true);
				outSize.set(0, 0, mTmpPoint.x, mTmpPoint.y);
			}
		}