當前位置: 首頁>>代碼示例>>Java>>正文


Java TextureView.getHeight方法代碼示例

本文整理匯總了Java中android.view.TextureView.getHeight方法的典型用法代碼示例。如果您正苦於以下問題:Java TextureView.getHeight方法的具體用法?Java TextureView.getHeight怎麽用?Java TextureView.getHeight使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.view.TextureView的用法示例。


在下文中一共展示了TextureView.getHeight方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: configureTransform

import android.view.TextureView; //導入方法依賴的package包/類
private void configureTransform(TextureView textureView) {
    if (null == textureView || null == mPreviewSize || null == mActivity) {
        return;
    }
    int rotation = mActivity.getWindowManager().getDefaultDisplay().getRotation();
    Matrix matrix = new Matrix();
    RectF viewRect = new RectF(0, 0, textureView.getWidth(), textureView.getHeight());
    RectF bufferRect = new RectF(0, 0, mPreviewSize.y, mPreviewSize.x);
    float centerX = viewRect.centerX();
    float centerY = viewRect.centerY();
    if (Surface.ROTATION_90 == rotation || Surface.ROTATION_270 == rotation) {
        bufferRect.offset(centerX - bufferRect.centerX(), centerY - bufferRect.centerY());
        matrix.setRectToRect(viewRect, bufferRect, Matrix.ScaleToFit.FILL);
        float scale = Math.max(
                (float) textureView.getHeight() / mPreviewSize.y,
                (float) textureView.getWidth() / mPreviewSize.x);
        matrix.postScale(scale, scale, centerX, centerY);
    }
    matrix.postRotate(-90 * rotation, centerX, centerY);
    textureView.setTransform(matrix);
}
 
開發者ID:vbier,項目名稱:habpanelviewer,代碼行數:22,代碼來源:MotionDetectorCamera2.java

示例2: scale

import android.view.TextureView; //導入方法依賴的package包/類
/**
 * Performs the requested scaling on the <code>view</code>'s matrix
 *
 * @param view The TextureView to alter the matrix to achieve the requested scale type
 * @param scaleType The type of scaling to use for the specified view
 * @return True if the scale was applied
 */
public boolean scale(@NonNull TextureView view, @NonNull ScaleType scaleType) {
    if (!ready()) {
        requestedScaleType = scaleType;
        requestedModificationView = new WeakReference<>(view);
        return false;
    }

    if (view.getHeight() == 0 || view.getWidth() == 0) {
        Log.d(TAG, "Unable to apply scale with a view size of (" + view.getWidth() + ", " + view.getHeight() + ")");
        return false;
    }

    currentScaleType = scaleType;
    switch (scaleType) {
        case CENTER:
            applyCenter(view);
            break;
        case CENTER_CROP:
            applyCenterCrop(view);
            break;
        case CENTER_INSIDE:
            applyCenterInside(view);
            break;
        case FIT_CENTER:
            applyFitCenter(view);
            break;
        case NONE:
            setScale(view, 1, 1);
            break;
    }

    return true;
}
 
開發者ID:ayaseruri,項目名稱:luxunPro,代碼行數:41,代碼來源:MatrixManager.java

示例3: applyCenterCrop

import android.view.TextureView; //導入方法依賴的package包/類
/**
 * Applies the {@link ScaleType#CENTER_CROP} to the specified matrix.  This will
 * make sure the smallest side fits the parent container, cropping the other
 *
 * @param view The view to apply the transformation to
 */
protected void applyCenterCrop(@NonNull TextureView view) {
    float xScale = (float)view.getWidth() / intrinsicVideoSize.x;
    float yScale = (float)view.getHeight() / intrinsicVideoSize.y;

    float scale = Math.max(xScale, yScale);
    xScale = scale / xScale;
    yScale = scale / yScale;

    setScale(view, xScale, yScale);
}
 
開發者ID:ayaseruri,項目名稱:luxunPro,代碼行數:17,代碼來源:MatrixManager.java

示例4: applyCenterInside

import android.view.TextureView; //導入方法依賴的package包/類
/**
 * Applies the {@link ScaleType#CENTER_INSIDE} to the specified matrix.  This will
 * only perform scaling if the video is too large to fit completely in the <code>view</code>
 * in which case it will be scaled to fit
 *
 * @param view The view to apply the transformation to
 */
protected void applyCenterInside(@NonNull TextureView view) {
    if(intrinsicVideoSize.x <= view.getWidth() && intrinsicVideoSize.y <= view.getHeight()) {
        applyCenter(view);
    } else {
        applyFitCenter(view);
    }
}
 
開發者ID:ayaseruri,項目名稱:luxunPro,代碼行數:15,代碼來源:MatrixManager.java

示例5: applyFitCenter

import android.view.TextureView; //導入方法依賴的package包/類
/**
 * Applies the {@link ScaleType#FIT_CENTER} to the specified matrix.  This will
 * scale the video so that the largest side will always match the <code>view</code>
 *
 * @param view The view to apply the transformation to
 */
protected void applyFitCenter(@NonNull TextureView view) {
    float xScale = (float)view.getWidth() / intrinsicVideoSize.x;
    float yScale = (float)view.getHeight() / intrinsicVideoSize.y;

    float scale = Math.min(xScale, yScale);
    xScale = scale / xScale;
    yScale = scale / yScale;
    setScale(view, xScale, yScale);
}
 
開發者ID:ayaseruri,項目名稱:luxunPro,代碼行數:16,代碼來源:MatrixManager.java

示例6: setScale

import android.view.TextureView; //導入方法依賴的package包/類
/**
 * Applies the specified scale modification to the view
 *
 * @param view The view to scale
 * @param xScale The scale to apply to the x axis
 * @param yScale The scale to apply to the y axis
 */
protected void setScale(@NonNull TextureView view, float xScale, float yScale) {
    //If the width and height have been swapped, we need to re-calculate the scales based on the swapped sizes
    boolean currentWidthHeightSwapped = ((currentRotation / QUARTER_ROTATION) % 2) == 1;
    if (currentWidthHeightSwapped){
        float scaleTemp = xScale;
        xScale = yScale *  view.getHeight() / view.getWidth();
        yScale = scaleTemp *  view.getWidth() / view.getHeight();
    }

    view.setScaleX(xScale);
    view.setScaleY(yScale);
}
 
開發者ID:ayaseruri,項目名稱:luxunPro,代碼行數:20,代碼來源:MatrixManager.java

示例7: applyCenter

import android.view.TextureView; //導入方法依賴的package包/類
/**
 * Applies the {@link ScaleType#CENTER} to the specified matrix.  This will
 * perform no scaling as this just indicates that the video should be centered
 * in the View
 *
 * @param view The view to apply the transformation to
 */
protected void applyCenter(@NonNull TextureView view) {
    float xScale = (float) intrinsicVideoSize.x / view.getWidth();
    float yScale = (float) intrinsicVideoSize.y / view.getHeight();

    setScale(view, xScale, yScale);
}
 
開發者ID:ayaseruri,項目名稱:luxunPro,代碼行數:14,代碼來源:MatrixManager.java


注:本文中的android.view.TextureView.getHeight方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。