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


Java RectF.height方法代码示例

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


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

示例1: pointToHue

import android.graphics.RectF; //导入方法依赖的package包/类
private float pointToHue(float y){

		final RectF rect = mHueRect;

		float height = rect.height();

		if (y < rect.top){
			y = 0f;
		}
		else if(y > rect.bottom){
			y = height;
		}
		else{
			y = y - rect.top;
		}

		return 360f - (y * 360f / height);
	}
 
开发者ID:Bregnet,项目名称:TextView_CustomEdit_CustomColor,代码行数:19,代码来源:ColorPickerView.java

示例2: center

import android.graphics.RectF; //导入方法依赖的package包/类
protected void center() {
    final Bitmap bitmap = bitmapDisplayed.getBitmap();
    if (bitmap == null) {
        return;
    }
    Matrix m = getImageViewMatrix();

    RectF rect = new RectF(0, 0, bitmap.getWidth(), bitmap.getHeight());
    m.mapRect(rect);

    float height = rect.height();
    float width  = rect.width();

    float deltaX = 0, deltaY = 0;

    deltaY = centerVertical(rect, height, deltaY);
    deltaX = centerHorizontal(rect, width, deltaX);

    postTranslate(deltaX, deltaY);
    setImageMatrix(getImageViewMatrix());
}
 
开发者ID:mityung,项目名称:XERUNG,代码行数:22,代码来源:ImageViewTouchBase.java

示例3: add

import android.graphics.RectF; //导入方法依赖的package包/类
public void add(MediaItem item, int faceIndex) {
    Path path = item.getPath();
    mPaths.add(path);
    Face[] faces = item.getFaces();
    if (faces != null) {
        Face face = faces[faceIndex];
        if (mCoverItem == null) {
            mCoverItem = item;
            mCoverRegion = face.getPosition();
            mCoverFaceIndex = faceIndex;
        } else {
            RectF region = face.getPosition();
            if (mCoverRegion.width() < region.width() &&
                    mCoverRegion.height() < region.height()) {
                mCoverItem = item;
                mCoverRegion = face.getPosition();
                mCoverFaceIndex = faceIndex;
            }
        }
    }
}
 
开发者ID:mayurkaul,项目名称:medialibrary,代码行数:22,代码来源:FaceClustering.java

示例4: fling

import android.graphics.RectF; //导入方法依赖的package包/类
public void fling(int viewWidth, int viewHeight, int velocityX,
                  int velocityY) {
    final RectF rect = getDisplayRect();
    if (rect == null) {
        return;
    }

    final int startX = Math.round(-rect.left);
    final int minX, maxX, minY, maxY;

    if (viewWidth < rect.width()) {
        minX = 0;
        maxX = Math.round(rect.width() - viewWidth);
    } else {
        minX = maxX = startX;
    }

    final int startY = Math.round(-rect.top);
    if (viewHeight < rect.height()) {
        minY = 0;
        maxY = Math.round(rect.height() - viewHeight);
    } else {
        minY = maxY = startY;
    }

    mCurrentX = startX;
    mCurrentY = startY;

    // If we actually can move, fling the scroller
    if (startX != maxX || startY != maxY) {
        mScroller.fling(startX, startY, velocityX, velocityY, minX,
                maxX, minY, maxY, 0, 0);
    }
}
 
开发者ID:Zyj163,项目名称:yyox,代码行数:35,代码来源:PhotoViewAttacher.java

示例5: pointToHue

import android.graphics.RectF; //导入方法依赖的package包/类
private float pointToHue(float y) {
    final RectF rect = mHueRect;
    float height = rect.height();

    if (y < rect.top) {
        y = 0f;
    } else if (y > rect.bottom) {
        y = height;
    } else {
        y = y - rect.top;
    }
    return 360f - (y * 360f / height);
}
 
开发者ID:ric96,项目名称:lineagex86,代码行数:14,代码来源:ColorPickerView.java

示例6: onSingleTapConfirmed

import android.graphics.RectF; //导入方法依赖的package包/类
@Override public boolean onSingleTapConfirmed(MotionEvent e) {

        if (mAttacher == null) {
            return false;
        }
        DraweeView<GenericDraweeHierarchy> draweeView = mAttacher.getDraweeView();
        if (draweeView == null) {
            return false;
        }

        if (mAttacher.getOnPhotoTapListener() != null) {
            final RectF displayRect = mAttacher.getDisplayRect();

            if (null != displayRect) {
                final float x = e.getX(), y = e.getY();
                if (displayRect.contains(x, y)) {
                    float xResult = (x - displayRect.left) / displayRect.width();
                    float yResult = (y - displayRect.top) / displayRect.height();
                    mAttacher.getOnPhotoTapListener().onPhotoTap(draweeView, xResult, yResult);
                    return true;
                }
            }
        }

        if (mAttacher.getOnViewTapListener() != null) {
            mAttacher.getOnViewTapListener().onViewTap(draweeView, e.getX(), e.getY());
            return true;
        }

        return false;
    }
 
开发者ID:lanyuanxiaoyao,项目名称:PicKing,代码行数:32,代码来源:DefaultOnDoubleTapListener.java

示例7: limitTransAndScale

import android.graphics.RectF; //导入方法依赖的package包/类
/**
 * limits the maximum scale and X translation of the given matrix
 *
 * @param matrix
 */
public void limitTransAndScale(Matrix matrix, RectF content) {

    matrix.getValues(matrixBuffer);

    float curTransX = matrixBuffer[Matrix.MTRANS_X];
    float curScaleX = matrixBuffer[Matrix.MSCALE_X];

    float curTransY = matrixBuffer[Matrix.MTRANS_Y];
    float curScaleY = matrixBuffer[Matrix.MSCALE_Y];

    // min scale-x is 1f
    mScaleX = Math.min(Math.max(mMinScaleX, curScaleX), mMaxScaleX);

    // min scale-y is 1f
    mScaleY = Math.min(Math.max(mMinScaleY, curScaleY), mMaxScaleY);

    float width = 0f;
    float height = 0f;

    if (content != null) {
        width = content.width();
        height = content.height();
    }

    float maxTransX = -width * (mScaleX - 1f);
    mTransX = Math.min(Math.max(curTransX, maxTransX - mTransOffsetX), mTransOffsetX);

    float maxTransY = height * (mScaleY - 1f);
    mTransY = Math.max(Math.min(curTransY, maxTransY + mTransOffsetY), -mTransOffsetY);

    matrixBuffer[Matrix.MTRANS_X] = mTransX;
    matrixBuffer[Matrix.MSCALE_X] = mScaleX;

    matrixBuffer[Matrix.MTRANS_Y] = mTransY;
    matrixBuffer[Matrix.MSCALE_Y] = mScaleY;

    matrix.setValues(matrixBuffer);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:44,代码来源:ViewPortHandler.java

示例8: getCenter

import android.graphics.RectF; //导入方法依赖的package包/类
protected RectF getCenter(Matrix supportMatrix, boolean horizontal, boolean vertical) {
    final Drawable drawable = getDrawable();

    if (drawable == null) {
        return new RectF(0, 0, 0, 0);
    }

    mCenterRect.set(0, 0, 0, 0);
    RectF rect = getBitmapRect(supportMatrix);
    float height = rect.height();
    float width = rect.width();
    float deltaX = 0, deltaY = 0;
    if (vertical) {
        if (height < mViewPort.height()) {
            deltaY = (mViewPort.height() - height) / 2 - (rect.top - mViewPort.top);
        } else if (rect.top > mViewPort.top) {
            deltaY = -(rect.top - mViewPort.top);
        } else if (rect.bottom < mViewPort.bottom) {
            deltaY = mViewPort.bottom - rect.bottom;
        }
    }
    if (horizontal) {
        if (width < mViewPort.width()) {
            deltaX = (mViewPort.width() - width) / 2 - (rect.left - mViewPort.left);
        } else if (rect.left > mViewPort.left) {
            deltaX = -(rect.left - mViewPort.left);
        } else if (rect.right < mViewPort.right) {
            deltaX = mViewPort.right - rect.right;
        }
    }
    mCenterRect.set(deltaX, deltaY, 0, 0);
    return mCenterRect;
}
 
开发者ID:StickyTolt,项目名称:ForeverLibrary,代码行数:34,代码来源:ImageViewTouchBase.java

示例9: onSingleTapConfirmed

import android.graphics.RectF; //导入方法依赖的package包/类
public final boolean onSingleTapConfirmed(MotionEvent e) {
	ImageView imageView = getImageView();

	if (null != imageView) {
		if (null != mPhotoTapListener) {
			final RectF displayRect = getDisplayRect();

			if (null != displayRect) {
				final float x = e.getX(), y = e.getY();

				// Check to see if the user tapped on the photo
				if (displayRect.contains(x, y)) {

					float xResult = (x - displayRect.left) / displayRect.width();
					float yResult = (y - displayRect.top) / displayRect.height();

					mPhotoTapListener.onPhotoTap(imageView, xResult, yResult);
					return true;
				}
			}
		}
		if (null != mViewTapListener) {
			mViewTapListener.onViewTap(imageView, e.getX(), e.getY());
		}
	}

	return false;
}
 
开发者ID:starn,项目名称:encdroidMC,代码行数:29,代码来源:PhotoViewAttacher.java

示例10: checkBorderAndCenterWhenScale

import android.graphics.RectF; //导入方法依赖的package包/类
/**
 * 在缩放时,进行图片显示范围的控制
 */
private void checkBorderAndCenterWhenScale() {

        RectF rect = getMatrixRectF();
        float deltaX = 0;
        float deltaY = 0;

        int width = getWidth();
        int height = getHeight();

        // 如果宽或高大于屏幕,则控制范围
        if (rect.width() >= width) {
                if (rect.left > 0) {
                        deltaX = -rect.left;
                }
                if (rect.right < width) {
                        deltaX = width - rect.right;
                }
        }
        if (rect.height() >= height) {
                if (rect.top > 0) {
                        deltaY = -rect.top;
                }
                if (rect.bottom < height) {
                        deltaY = height - rect.bottom;
                }
        }
        // 如果宽或高小于屏幕,则让其居中
        if (rect.width() < width) {
                deltaX = width * 0.5f - rect.right + 0.5f * rect.width();
        }
        if (rect.height() < height) {
                deltaY = height * 0.5f - rect.bottom + 0.5f * rect.height();
        }
        Log.e(TAG, "deltaX = " + deltaX + " , deltaY = " + deltaY);

        mScaleMatrix.postTranslate(deltaX, deltaY);

}
 
开发者ID:HelloChenJinJun,项目名称:TestChat,代码行数:42,代码来源:ZoomImageView.java

示例11: postScale

import android.graphics.RectF; //导入方法依赖的package包/类
@Override
protected void postScale(float scale, float centerX, float centerY) {
    if (mOverlayViews.size() > 0) {
        Iterator<MyHighlightView> iterator = mOverlayViews.iterator();

        Matrix oldMatrix = new Matrix(getImageViewMatrix());
        super.postScale(scale, centerX, centerY);

        while (iterator.hasNext()) {
            MyHighlightView view = iterator.next();
            if (view.isSelected() == false || view.isLock()) {
                continue;
            }
            if (!mScaleWithContent) {
                RectF cropRect = view.getCropRectF();
                RectF rect1 = view.getDisplayRect(oldMatrix, view.getCropRectF());
                RectF rect2 = view.getDisplayRect(getImageViewMatrix(), view.getCropRectF());

                float[] mvalues = new float[9];
                getImageViewMatrix().getValues(mvalues);
                final float currentScale = mvalues[Matrix.MSCALE_X];

                cropRect.offset((rect1.left - rect2.left) / currentScale, (rect1.top - rect2.top) / currentScale);
                cropRect.right += -(rect2.width() - rect1.width()) / currentScale;
                cropRect.bottom += -(rect2.height() - rect1.height()) / currentScale;

                view.getMatrix().set(getImageMatrix());
                view.getCropRectF().set(cropRect);
            } else {
                view.getMatrix().set(getImageMatrix());
            }
            view.invalidate();
        }
    } else {
        super.postScale(scale, centerX, centerY);
    }
}
 
开发者ID:junchenChow,项目名称:exciting-app,代码行数:38,代码来源:MyImageViewDrawableOverlay.java

示例12: calculateRectTranslateMatrix

import android.graphics.RectF; //导入方法依赖的package包/类
/**
 * 计算两个矩形之间的变换矩阵
 *
 * unknownMatrix.mapRect(to, from)
 * 已知from矩形和to矩形,求unknownMatrix
 *
 * @param from
 * @param to
 * @param result unknownMatrix
 */
public static void calculateRectTranslateMatrix(RectF from, RectF to, Matrix result) {
    if (from == null || to == null || result == null) {
        return;
    }
    if (from.width() == 0 || from.height() == 0) {
        return;
    }
    result.reset();
    result.postTranslate(-from.left, -from.top);
    result.postScale(to.width() / from.width(), to.height() / from.height());
    result.postTranslate(to.left, to.top);
}
 
开发者ID:wendyltan,项目名称:EasyTodo,代码行数:23,代码来源:PinchImageView.java

示例13: chooseDisplayModeGetter

import android.graphics.RectF; //导入方法依赖的package包/类
private IDisplayModeGetter chooseDisplayModeGetter(RectF pic) {
    final float aspectRatio = pic.width()/pic.height();
    if (aspectRatio<getOverHighAspectRatioThreshold())
        return highPicDisplayModeGetter;
    else if (aspectRatio>getOverWideAspectRatioThreshold())
        return widePicDisplayModeGetter;
    else
        return normalPicDisplayModeGetter;
}
 
开发者ID:leobert-lan,项目名称:UiLib,代码行数:10,代码来源:DisplayModeProxy.java

示例14: getStackScale

import android.graphics.RectF; //导入方法依赖的package包/类
private float getStackScale(RectF stackRect) {
    return mCurrentMode == Orientation.PORTRAIT
            ? stackRect.width() / mLayout.getWidth()
            : stackRect.height() / mLayout.getHeightMinusBrowserControls();
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:6,代码来源:Stack.java

示例15: checkMatrixBounds

import android.graphics.RectF; //导入方法依赖的package包/类
private boolean checkMatrixBounds() {
    final ImageView imageView = getImageView();
    if (null == imageView) {
        return false;
    }

    final RectF rect = getDisplayRect(getDrawMatrix());
    if (null == rect) {
        return false;
    }

    final float height = rect.height(), width = rect.width();
    float deltaX = 0, deltaY = 0;

    final int viewHeight = getImageViewHeight(imageView);
    if (height <= viewHeight) {
        switch (mScaleType) {
            case FIT_START:
                deltaY = -rect.top;
                break;
            case FIT_END:
                deltaY = viewHeight - height - rect.top;
                break;
            default:
                deltaY = (viewHeight - height) / 2 - rect.top;
                break;
        }
    } else if (rect.top > 0) {
        deltaY = -rect.top;
    } else if (rect.bottom < viewHeight) {
        deltaY = viewHeight - rect.bottom;
    }

    final int viewWidth = getImageViewWidth(imageView);
    if (width <= viewWidth) {
        switch (mScaleType) {
            case FIT_START:
                deltaX = -rect.left;
                break;
            case FIT_END:
                deltaX = viewWidth - width - rect.left;
                break;
            default:
                deltaX = (viewWidth - width) / 2 - rect.left;
                break;
        }
        mScrollEdge = EDGE_BOTH;
    } else if (rect.left > 0) {
        mScrollEdge = EDGE_LEFT;
        deltaX = -rect.left;
    } else if (rect.right < viewWidth) {
        deltaX = viewWidth - rect.right;
        mScrollEdge = EDGE_RIGHT;
    } else {
        mScrollEdge = EDGE_NONE;
    }

    // Finally actually translate the matrix
    mSuppMatrix.postTranslate(deltaX, deltaY);
    return true;
}
 
开发者ID:joelan,项目名称:ClouldReader,代码行数:62,代码来源:PhotoViewAttacher.java


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