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


Java GPUImage类代码示例

本文整理汇总了Java中jp.co.cyberagent.android.gpuimage.GPUImage的典型用法代码示例。如果您正苦于以下问题:Java GPUImage类的具体用法?Java GPUImage怎么用?Java GPUImage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: transform

import jp.co.cyberagent.android.gpuimage.GPUImage; //导入依赖的package包/类
@Override
public Resource<Bitmap> transform(Resource<Bitmap> resource, int outWidth, int outHeight) {
  Bitmap source = resource.get();
  GPUImage gpuImage = new GPUImage(mContext);
  gpuImage.setImage(source);
  gpuImage.setFilter(mFilter);

  Bitmap bitmap = gpuImage.getBitmapWithFilterApplied();

  return BitmapResource.obtain(bitmap, mBitmapPool);
}
 
开发者ID:open-android,项目名称:Glide-transformations,代码行数:12,代码来源:GPUFilterTransformation.java

示例2: onCreate

import jp.co.cyberagent.android.gpuimage.GPUImage; //导入依赖的package包/类
@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_camera);
    ((SeekBar) findViewById(R.id.seekBar)).setOnSeekBarChangeListener(this);
    findViewById(R.id.button_choose_filter).setOnClickListener(this);
    findViewById(R.id.button_capture).setOnClickListener(this);

    mGPUImage = new GPUImage(this);
    mGPUImage.setGLSurfaceView((GLSurfaceView) findViewById(R.id.surfaceView));

    mCameraHelper = new CameraHelper(this);
    mCamera = new CameraLoader();

    View cameraSwitchView = findViewById(R.id.img_switch_camera);
    cameraSwitchView.setOnClickListener(this);
    if (!mCameraHelper.hasFrontCamera() || !mCameraHelper.hasBackCamera()) {
        cameraSwitchView.setVisibility(View.GONE);
    }
}
 
开发者ID:hajunho,项目名称:AndroidCamera,代码行数:21,代码来源:ActivityCamera.java

示例3: generateVideoFilterTheme

import jp.co.cyberagent.android.gpuimage.GPUImage; //导入依赖的package包/类
public static void generateVideoFilterTheme(String filterImagePath) {
  List<FilterData> filterDataList = FilterTools.getFilterDataList();
  String parentPath = new File(filterImagePath).getParent();
  for (int i = 0; i < filterDataList.size(); i++) {
    FilterData filterData = filterDataList.get(i);
    String filterName =
        FilterTools.getFilterName(MikuApplication.context,
            filterData.getFilterThemeType());
    ThreadPool.getInstance().execute(() -> {
      GPUImage gpuImage = new GPUImage(MikuApplication.context);
      gpuImage.setFilter(FilterTools.getFilter(filterData.getFilterThemeType()));
      Bitmap bitmap =
          gpuImage
              .getBitmapWithFilterApplied(BitmapFactory.decodeFile(filterImagePath));
      FileUtils.saveBitmapToFile(bitmap, parentPath, filterName, 10);
    });
  }
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:19,代码来源:VideoUtils.java

示例4: filterPhoto

import jp.co.cyberagent.android.gpuimage.GPUImage; //导入依赖的package包/类
public static Bitmap filterPhoto(Context context, Bitmap bitmap, String key) {
    if (bitmap == null) {
        return null;
    }


    // 实现图片过滤处理
    GPUImageFilter filter = null;

    if (!TextUtils.isEmpty(key)) {
        try {
            filter = FILTERS.get(key).newInstance();
        } catch (Exception e) {
        }
    }

    if (filter != null) {
        GPUImage gpuImage = new GPUImage(context);
        gpuImage.setFilter(filter);
        bitmap = gpuImage.getBitmapWithFilterApplied(bitmap);
        gpuImage.deleteImage();
    }
    return bitmap;
}
 
开发者ID:ImKarl,项目名称:PictureBeautify,代码行数:25,代码来源:PhotoUtils.java

示例5: onCreate

import jp.co.cyberagent.android.gpuimage.GPUImage; //导入依赖的package包/类
@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ((SeekBar) findViewById(R.id.seekBar)).setOnSeekBarChangeListener(this);
    findViewById(R.id.button_choose_filter).setOnClickListener(this);
    findViewById(R.id.button_capture).setOnClickListener(this);

    mGPUImage = new GPUImage(this);
    mGPUImage.setGLSurfaceView((GLSurfaceView) findViewById(R.id.surfaceView));

    mCameraHelper = new CameraHelper(this);
    mCamera = new CameraLoader();

    View cameraSwitchView = findViewById(R.id.img_switch_camera);
    cameraSwitchView.setOnClickListener(this);
    if (!mCameraHelper.hasFrontCamera() || !mCameraHelper.hasBackCamera()) {
        cameraSwitchView.setVisibility(View.GONE);
    }
}
 
开发者ID:yokmama,项目名称:honki_android,代码行数:21,代码来源:MainActivity.java

示例6: onFilterClick

import jp.co.cyberagent.android.gpuimage.GPUImage; //导入依赖的package包/类
@Override public void onFilterClick(FilterModel filter) {
    Bitmap bitmap = homeModel.getBitmap();
    if (bitmap == null) {
        homeModel.onError(homeModel.getContext().getString(R.string.no_image));
        return;
    }
    GPUImage gpuFilter = getGpuImage();
    gpuFilter.setImage(homeModel.getBitmap());
    if (filter.isAdjustable()) {
        gpuFilter.setFilter(filter.getFilter());
        helper = new FilterAdjuster(filter.getFilter());
        homeModel.showSeekBar(helper);
    } else {
        gpuFilter.setFilter(filter.getFilter());
        homeModel.hideSeekBar();
    }
    homeModel.onFilterApplied(gpuFilter.getBitmapWithFilterApplied());

}
 
开发者ID:k0shk0sh,项目名称:Filtra-StyleMe-,代码行数:20,代码来源:HomePresenter.java

示例7: transform

import jp.co.cyberagent.android.gpuimage.GPUImage; //导入依赖的package包/类
@Override public Bitmap transform(Bitmap source) {
  GPUImage gpuImage = new GPUImage(mContext);
  gpuImage.setImage(source);
  gpuImage.setFilter(mFilter);

  Bitmap bitmap = gpuImage.getBitmapWithFilterApplied();
  source.recycle();

  return bitmap;
}
 
开发者ID:open-android,项目名称:Picasso-transformations,代码行数:11,代码来源:GPUFilterTransformation.java

示例8: setFilterTheme

import jp.co.cyberagent.android.gpuimage.GPUImage; //导入依赖的package包/类
public void setFilterTheme(FilterTheme filterTheme) {
  this.filterTheme = filterTheme;
  String parentPath = new File(filterTheme.getThumbFilePath()).getParent();
  String filterName = FilterTools.getFilterName(getContext(), filterTheme.getFilterData()
      .getFilterThemeType());
  String filterThumbPath = parentPath.endsWith(File.separator) ? parentPath
      + filterName : parentPath + File.separator + filterName;
  themeName.setText(filterName);
  if (new File(filterThumbPath).isFile()) {
    showImage("file://" + filterThumbPath, imageView);
  } else {
    ThreadPool
        .getInstance().execute(() -> {
          GPUImage gpuImage = new GPUImage(getContext());
          gpuImage.setFilter(FilterTools.getFilter(filterTheme.getFilterData()
              .getFilterThemeType()));
          Bitmap bitmap =
              gpuImage
                  .getBitmapWithFilterApplied(BitmapFactory.decodeFile(filterTheme
                      .getThumbFilePath()));
          String filterFilePath = FileUtils.saveBitmapToFile(bitmap, parentPath, filterName, 50);
          new Handler(Looper.getMainLooper()).post(() -> {
            showImage("file://" + filterFilePath, imageView);
          });
        });
  }
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:28,代码来源:NewFilterThemeItemView.java

示例9: process

import jp.co.cyberagent.android.gpuimage.GPUImage; //导入依赖的package包/类
@Override public void process(Bitmap dest, Bitmap source) {
  GPUImage gpuImage = new GPUImage(context);
  gpuImage.setImage(source);
  gpuImage.setFilter(filter);
  Bitmap bitmap = gpuImage.getBitmapWithFilterApplied();

  super.process(dest, bitmap);
}
 
开发者ID:CarGuo,项目名称:FrescoUtils,代码行数:9,代码来源:GPUFilterPostprocessor.java

示例10: transform

import jp.co.cyberagent.android.gpuimage.GPUImage; //导入依赖的package包/类
@Override protected Bitmap transform(@NonNull Context context, @NonNull BitmapPool pool,
    @NonNull Bitmap toTransform, int outWidth, int outHeight) {
  GPUImage gpuImage = new GPUImage(context);
  gpuImage.setImage(toTransform);
  gpuImage.setFilter(gpuImageFilter);

  return gpuImage.getBitmapWithFilterApplied();
}
 
开发者ID:wasabeef,项目名称:glide-transformations,代码行数:9,代码来源:GPUFilterTransformation.java

示例11: onCreate

import jp.co.cyberagent.android.gpuimage.GPUImage; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    setContentView(R.layout.activity_realtime_camera_preview);

    mSurfaceView = (GLSurfaceView) findViewById(R.id.gl_surface_view);
    mGPUImage = new GPUImage(this);
    mGPUImage.setGLSurfaceView(mSurfaceView);

    mSeekBar = (SeekBar) findViewById(R.id.seekBar1);
    mSeekBar.setMax(100);
    mSeekBar.setEnabled(false);
    mSeekBar.setOnSeekBarChangeListener(this);

    // セピア
    mSepia = new GPUImageSepiaFilter();
    // 白黒
    mGray = new GPUImageGrayscaleFilter();
    // シャープ
    // -4.0 to 4.0
    mSharp = new GPUImageSharpenFilter();
    // エッジ
    // 0.0 to 5.0
    mEdge = new GPUImageSobelEdgeDetection();

    findViewById(R.id.sepia).setOnClickListener(this);
    findViewById(R.id.gray).setOnClickListener(this);
    findViewById(R.id.sharp).setOnClickListener(this);
    findViewById(R.id.edge).setOnClickListener(this);
}
 
开发者ID:android-opensource-library-56,项目名称:android-opensource-library-56,代码行数:35,代码来源:RealtimeCameraPreviewActivity.java

示例12: getBitmapWithFilterApplied

import jp.co.cyberagent.android.gpuimage.GPUImage; //导入依赖的package包/类
public Bitmap getBitmapWithFilterApplied(Bitmap originalBitmap,
        Context context) {
    GPUImage gpuImage = new GPUImage(context);
    gpuImage.setFilter(mFilter);
    return gpuImage.getBitmapWithFilterApplied(originalBitmap);

}
 
开发者ID:cuipengpeng,项目名称:p1-android,代码行数:8,代码来源:AbstractFilter.java

示例13: setScaleType

import jp.co.cyberagent.android.gpuimage.GPUImage; //导入依赖的package包/类
public void setScaleType(GPUImage.ScaleType scaleType) {
    mScaleType = scaleType;
}
 
开发者ID:Piasy,项目名称:CameraCompat,代码行数:4,代码来源:GLRender.java

示例14: adjustImageScaling

import jp.co.cyberagent.android.gpuimage.GPUImage; //导入依赖的package包/类
private void adjustImageScaling() {
    float outputWidth = mOutputWidth;
    float outputHeight = mOutputHeight;
    if (mRotation == Rotation.ROTATION_270 || mRotation == Rotation.ROTATION_90) {
        outputWidth = mOutputHeight;
        outputHeight = mOutputWidth;
    }

    float ratio1 = outputWidth / mImageWidth;
    float ratio2 = outputHeight / mImageHeight;
    float ratioMax = Math.max(ratio1, ratio2);
    int imageWidthNew = Math.round(mImageWidth * ratioMax);
    int imageHeightNew = Math.round(mImageHeight * ratioMax);

    float ratioWidth = imageWidthNew / outputWidth;
    float ratioHeight = imageHeightNew / outputHeight;

    float[] cube = CUBE;
    float[] textureCords =
            TextureRotationUtil.getRotation(mRotation, mFlipHorizontal, mFlipVertical);
    if (mScaleType == GPUImage.ScaleType.CENTER_CROP) {
        float distHorizontal = (1 - 1 / ratioWidth) / 2;
        float distVertical = (1 - 1 / ratioHeight) / 2;
        textureCords = new float[] {
                addDistance(textureCords[0], distHorizontal),
                addDistance(textureCords[1], distVertical),
                addDistance(textureCords[2], distHorizontal),
                addDistance(textureCords[3], distVertical),
                addDistance(textureCords[4], distHorizontal),
                addDistance(textureCords[5], distVertical),
                addDistance(textureCords[6], distHorizontal),
                addDistance(textureCords[7], distVertical),
        };
    } else {
        cube = new float[] {
                CUBE[0] / ratioHeight, CUBE[1] / ratioWidth, CUBE[2] / ratioHeight,
                CUBE[3] / ratioWidth, CUBE[4] / ratioHeight, CUBE[5] / ratioWidth,
                CUBE[6] / ratioHeight, CUBE[7] / ratioWidth,
        };
    }

    mGLCubeBuffer.clear();
    mGLCubeBuffer.put(cube).position(0);
    mGLTextureBuffer.clear();
    mGLTextureBuffer.put(textureCords).position(0);
}
 
开发者ID:Piasy,项目名称:CameraCompat,代码行数:47,代码来源:GLRender.java

示例15: overlayBorder

import jp.co.cyberagent.android.gpuimage.GPUImage; //导入依赖的package包/类
public void overlayBorder (){
	GPUImageAlphaBlendFilter border=new GPUImageAlphaBlendFilter(opacity);
	Bitmap bm = BitmapFactory.decodeResource(getResources(),imageID);
	border.setBitmap(bm);
	
	GPUImage mGPUImage = new GPUImage(this);
	mGPUImage.setFilter(border);
	mGPUImage.setImage(bitmap);
	bitmapresult=mGPUImage.getBitmapWithFilterApplied();
	
	bm.recycle();
}
 
开发者ID:buithuyet,项目名称:BeautyCamera,代码行数:13,代码来源:ImgView.java


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