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); }
internal RotateState(android.graphics.drawable.RotateDrawable.RotateState source, android.graphics.drawable.RotateDrawable owner, android.content.res.Resources res ) { if (source != null) { if (res != null) { mDrawable = source.mDrawable.getConstantState().newDrawable(res); } else { mDrawable = source.mDrawable.getConstantState().newDrawable(); } mDrawable.setCallback(owner); mPivotXRel = source.mPivotXRel; mPivotX = source.mPivotX; mPivotYRel = source.mPivotYRel; mPivotY = source.mPivotY; mFromDegrees = mCurrentDegrees = source.mFromDegrees; mToDegrees = source.mToDegrees; mCanConstantState = mCheckedConstantState = true; } }
/// <summary><p>Create a new rotating drawable with the specified state.</summary> /// <remarks> /// <p>Create a new rotating drawable with the specified state. A copy of /// this state is used as the internal state for the newly created /// drawable.</p> /// </remarks> /// <param name="rotateState">the state for this drawable</param> internal RotateDrawable(android.graphics.drawable.RotateDrawable.RotateState rotateState , android.content.res.Resources res) { mState = new android.graphics.drawable.RotateDrawable.RotateState(rotateState, this , res); }
/// <summary><p>Create a new rotating drawable with the specified state.</summary> /// <remarks> /// <p>Create a new rotating drawable with the specified state. A copy of /// this state is used as the internal state for the newly created /// drawable.</p> /// </remarks> /// <param name="rotateState">the state for this drawable</param> internal RotateDrawable(android.graphics.drawable.RotateDrawable.RotateState rotateState , android.content.res.Resources res) { mState = new android.graphics.drawable.RotateDrawable.RotateState(rotateState, this , res); }