android.graphics.Rect#scale ( )源码实例Demo

下面列出了android.graphics.Rect#scale ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: android_9.0.0_r45   文件: TaskSnapshotSurface.java
/**
 * Calculates the snapshot frame in window coordinate space from crop.
 *
 * @param crop rect that is in snapshot coordinate space.
 */
@VisibleForTesting
Rect calculateSnapshotFrame(Rect crop) {
    final Rect frame = new Rect(crop);
    final float scale = mSnapshot.getScale();

    // Rescale the frame from snapshot to window coordinate space
    frame.scale(1 / scale);

    // By default, offset it to to top/left corner
    frame.offsetTo((int) (-crop.left / scale), (int) (-crop.top / scale));

    // However, we also need to make space for the navigation bar on the left side.
    final int colorViewLeftInset = getColorViewLeftInset(mStableInsets.left,
            mContentInsets.left);
    frame.offset(colorViewLeftInset, 0);
    return frame;
}
 
public void getMagnifiedFrameInContentCoordsLocked(Rect rect) {
    MagnificationSpec spec = mMagnificationSpec;
    mMagnificationRegion.getBounds(rect);
    rect.offset((int) -spec.offsetX, (int) -spec.offsetY);
    rect.scale(1.0f / spec.scale);
}
 
源代码3 项目: android_9.0.0_r45   文件: CompatibilityInfo.java
/**
 * Translate the screen rect to the application frame.
 */
public void translateRectInScreenToAppWinFrame(Rect rect) {
    rect.scale(applicationInvertedScale);
}
 
源代码4 项目: android_9.0.0_r45   文件: CompatibilityInfo.java
/**
 * Translate a Rect in application's window to screen.
 */
public void translateRectInAppWindowToScreen(Rect rect) {
    rect.scale(applicationScale);
}
 
源代码5 项目: android_9.0.0_r45   文件: CompatibilityInfo.java
/**
 * Translate a Rect in screen coordinates into the app window's coordinates.
 */
public void translateRectInScreenToAppWindow(Rect rect) {
    rect.scale(applicationInvertedScale);
}
 
源代码6 项目: android_9.0.0_r45   文件: NumberPicker.java
private AccessibilityNodeInfo createAccessibilityNodeInfoForNumberPicker(int left, int top,
        int right, int bottom) {
    AccessibilityNodeInfo info = AccessibilityNodeInfo.obtain();
    info.setClassName(NumberPicker.class.getName());
    info.setPackageName(mContext.getPackageName());
    info.setSource(NumberPicker.this);

    if (hasVirtualDecrementButton()) {
        info.addChild(NumberPicker.this, VIRTUAL_VIEW_ID_DECREMENT);
    }
    info.addChild(NumberPicker.this, VIRTUAL_VIEW_ID_INPUT);
    if (hasVirtualIncrementButton()) {
        info.addChild(NumberPicker.this, VIRTUAL_VIEW_ID_INCREMENT);
    }

    info.setParent((View) getParentForAccessibility());
    info.setEnabled(NumberPicker.this.isEnabled());
    info.setScrollable(true);

    final float applicationScale =
        getContext().getResources().getCompatibilityInfo().applicationScale;

    Rect boundsInParent = mTempRect;
    boundsInParent.set(left, top, right, bottom);
    boundsInParent.scale(applicationScale);
    info.setBoundsInParent(boundsInParent);

    info.setVisibleToUser(isVisibleToUser());

    Rect boundsInScreen = boundsInParent;
    int[] locationOnScreen = mTempArray;
    getLocationOnScreen(locationOnScreen);
    boundsInScreen.offset(locationOnScreen[0], locationOnScreen[1]);
    boundsInScreen.scale(applicationScale);
    info.setBoundsInScreen(boundsInScreen);

    if (mAccessibilityFocusedView != View.NO_ID) {
        info.addAction(AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS);
    }
    if (mAccessibilityFocusedView == View.NO_ID) {
        info.addAction(AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS);
    }
    if (NumberPicker.this.isEnabled()) {
        if (getWrapSelectorWheel() || getValue() < getMaxValue()) {
            info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
        }
        if (getWrapSelectorWheel() || getValue() > getMinValue()) {
            info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
        }
    }

    return info;
}