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


Java Options类代码示例

本文整理汇总了Java中com.google.vr.sdk.widgets.pano.VrPanoramaView.Options的典型用法代码示例。如果您正苦于以下问题:Java Options类的具体用法?Java Options怎么用?Java Options使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Options类属于com.google.vr.sdk.widgets.pano.VrPanoramaView包,在下文中一共展示了Options类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: calculateInSampleSize

import com.google.vr.sdk.widgets.pano.VrPanoramaView.Options; //导入依赖的package包/类
private int calculateInSampleSize(
        BitmapFactory.Options options, int reqWidth, int reqHeight) {
    // Raw height and width of image
    final int height = options.outHeight;
    final int width = options.outWidth;
    int inSampleSize = 1;

    if (height > reqHeight || width > reqWidth) {

        final int halfHeight = height / 2;
        final int halfWidth = width / 2;

        // Calculate the largest inSampleSize value that is a power of 2 and keeps both
        // height and width larger than the requested height and width.
        while ((halfHeight / inSampleSize) > reqHeight
                && (halfWidth / inSampleSize) > reqWidth) {
            inSampleSize *= 2;
        }
    }

    return inSampleSize;
}
 
开发者ID:XebiaStudio,项目名称:react-native-google-vr-panorama,代码行数:23,代码来源:RNGoogleVRPanoramaView.java

示例2: decodeSampledBitmap

import com.google.vr.sdk.widgets.pano.VrPanoramaView.Options; //导入依赖的package包/类
private Bitmap decodeSampledBitmap(InputStream inputStream) throws IOException {
    final byte[] bytes = getBytesFromInputStream(inputStream);
    BitmapFactory.Options options = new BitmapFactory.Options();

    if(imageWidth != 0 && imageHeight != 0) {
        options.inJustDecodeBounds = true;
        BitmapFactory.decodeByteArray(bytes, 0, bytes.length, options);

        options.inSampleSize = calculateInSampleSize(options, imageWidth, imageHeight);
        options.inJustDecodeBounds = false;
    }

    return BitmapFactory.decodeByteArray(bytes, 0, bytes.length, options);
}
 
开发者ID:XebiaStudio,项目名称:react-native-google-vr-panorama,代码行数:15,代码来源:RNGoogleVRPanoramaView.java

示例3: handleIntent

import com.google.vr.sdk.widgets.pano.VrPanoramaView.Options; //导入依赖的package包/类
/**
 * Load custom images based on the Intent or load the default image. See the Javadoc for this
 * class for information on generating a custom intent via adb.
 */
private void handleIntent(Intent intent) {
  // Determine if the Intent contains a file to load.
  if (Intent.ACTION_VIEW.equals(intent.getAction())) {
    Log.i(TAG, "ACTION_VIEW Intent recieved");

    fileUri = intent.getData();
    if (fileUri == null) {
      Log.w(TAG, "No data uri specified. Use \"-d /path/filename\".");
    } else {
      Log.i(TAG, "Using file " + fileUri.toString());
    }

    panoOptions.inputType = intent.getIntExtra("inputType", Options.TYPE_MONO);
    Log.i(TAG, "Options.inputType = " + panoOptions.inputType);
  } else {
    Log.i(TAG, "Intent is not ACTION_VIEW. Using default pano image.");
    fileUri = null;
    panoOptions.inputType = Options.TYPE_MONO;
  }

  // Load the bitmap in a background thread to avoid blocking the UI thread. This operation can
  // take 100s of milliseconds.
  if (backgroundImageLoaderTask != null) {
    // Cancel any task from a previous intent sent to this activity.
    backgroundImageLoaderTask.cancel(true);
  }
  backgroundImageLoaderTask = new ImageLoaderTask();
  backgroundImageLoaderTask.execute(Pair.create(fileUri, panoOptions));
}
 
开发者ID:codedavid,项目名称:PanoramaGL,代码行数:34,代码来源:SimpleVrPanoramaActivity.java


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