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


Java GPUImageFilter类代码示例

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


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

示例1: getView

import jp.co.cyberagent.android.gpuimage.GPUImageFilter; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    EffectHolder holder = null;
    if (convertView == null) {
        LayoutInflater layoutInflater = LayoutInflater.from(mContext);
        convertView = layoutInflater.inflate(R.layout.item_bottom_filter, null);
        holder = new EffectHolder();
        holder.filteredImg = (GPUImageView) convertView.findViewById(R.id.small_filter);
        holder.filterName = (TextView) convertView.findViewById(R.id.filter_name);
        convertView.setTag(holder);
    } else {
        holder = (EffectHolder) convertView.getTag();
    }

    final FilterEffect effect = (FilterEffect) getItem(position);

    holder.filteredImg.setImage(background);
    holder.filterName.setText(effect.getTitle());
    //if (!effect.isOri() && effect.getType() != null) {
    GPUImageFilter filter = GPUImageFilterTools.createFilterForType(mContext, effect.getType());
    holder.filteredImg.setFilter(filter);

    return convertView;
}
 
开发者ID:macyuan,项目名称:TAG,代码行数:25,代码来源:FilterAdapter.java

示例2: FilterAdjuster

import jp.co.cyberagent.android.gpuimage.GPUImageFilter; //导入依赖的package包/类
public FilterAdjuster(final GPUImageFilter filter) {
    if (filter instanceof GPUImageSharpenFilter) {
        adjuster = new SharpnessAdjuster().filter(filter);
    } else if (filter instanceof GPUImageSepiaFilter) {
        adjuster = new SepiaAdjuster().filter(filter);
    } else if (filter instanceof GPUImageContrastFilter) {
        adjuster = new ContrastAdjuster().filter(filter);
    } else if (filter instanceof GPUImageGammaFilter) {
        adjuster = new GammaAdjuster().filter(filter);
    } else if (filter instanceof GPUImageBrightnessFilter) {
        adjuster = new BrightnessAdjuster().filter(filter);
    } else if (filter instanceof GPUImageSobelEdgeDetection) {
        adjuster = new SobelAdjuster().filter(filter);
    } else if (filter instanceof GPUImageEmbossFilter) {
        adjuster = new EmbossAdjuster().filter(filter);
    } else if (filter instanceof GPUImage3x3TextureSamplingFilter) {
        adjuster = new GPU3x3TextureAdjuster().filter(filter);
    } else if (filter instanceof GPUImageHueFilter) {
        adjuster = new HueAdjuster().filter(filter);
    } else if (filter instanceof GPUImagePosterizeFilter) {
        adjuster = new PosterizeAdjuster().filter(filter);
    } else if (filter instanceof GPUImagePixelationFilter) {
        adjuster = new PixelationAdjuster().filter(filter);
    } else if (filter instanceof GPUImageSaturationFilter) {
        adjuster = new SaturationAdjuster().filter(filter);
    } else if (filter instanceof GPUImageExposureFilter) {
        adjuster = new ExposureAdjuster().filter(filter);
    } else if (filter instanceof GPUImageHighlightShadowFilter) {
        adjuster = new HighlightShadowAdjuster().filter(filter);
    } else if (filter instanceof GPUImageMonochromeFilter) {
        adjuster = new MonochromeAdjuster().filter(filter);
    } else if (filter instanceof GPUImageOpacityFilter) {
        adjuster = new OpacityAdjuster().filter(filter);
    } else if (filter instanceof GPUImageRGBFilter) {
        adjuster = new RGBAdjuster().filter(filter);
    } else if (filter instanceof GPUImageWhiteBalanceFilter) {
        adjuster = new WhiteBalanceAdjuster().filter(filter);
    } else if (filter instanceof GPUImageVignetteFilter) {
        adjuster = new VignetteAdjuster().filter(filter);
    } else if (filter instanceof GPUImageDissolveBlendFilter) {
        adjuster = new DissolveBlendAdjuster().filter(filter);
    } else if (filter instanceof GPUImageGaussianBlurFilter) {
        adjuster = new GaussianBlurAdjuster().filter(filter);
    } else if (filter instanceof GPUImageCrosshatchFilter) {
        adjuster = new CrosshatchBlurAdjuster().filter(filter);
    } else if (filter instanceof GPUImageBulgeDistortionFilter) {
        adjuster = new BulgeDistortionAdjuster().filter(filter);
    } else if (filter instanceof GPUImageGlassSphereFilter) {
        adjuster = new GlassSphereAdjuster().filter(filter);
    } else if (filter instanceof GPUImageHazeFilter) {
        adjuster = new HazeAdjuster().filter(filter);
    } else if (filter instanceof GPUImageSphereRefractionFilter) {
        adjuster = new SphereRefractionAdjuster().filter(filter);
    } else if (filter instanceof GPUImageSwirlFilter) {
        adjuster = new SwirlAdjuster().filter(filter);
    } else if (filter instanceof GPUImageColorBalanceFilter) {
        adjuster = new ColorBalanceAdjuster().filter(filter);
    } else if (filter instanceof GPUImageLevelsFilter) {
        adjuster = new LevelsMinMidAdjuster().filter(filter);
    } else if (filter instanceof GPUImageBilateralFilter) {
        adjuster = new BilateralAdjuster().filter(filter);
    } else if (filter instanceof GPUImageTransformFilter) {
        adjuster = new RotateAdjuster().filter(filter);
    }
    else {

        adjuster = null;
    }
}
 
开发者ID:ChillingVan,项目名称:android-openGL-canvas,代码行数:70,代码来源:FilterAdjuster.java

示例3: initFilterToolBar

import jp.co.cyberagent.android.gpuimage.GPUImageFilter; //导入依赖的package包/类
private void initFilterToolBar() {
    final List<FilterEffect> filters = EffectService.getInst().getLocalFilters();
    final FilterAdapter adapter = new FilterAdapter(PhotoProcessActivity.this, filters, smallImageBackgroud);
    bottomToolBar.setAdapter(adapter);
    bottomToolBar.setOnItemClickListener(new it.sephiroth.android.library.widget.AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(it.sephiroth.android.library.widget.AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            labelSelector.hide();
            if (adapter.getSelectFilter() != arg2) {
                adapter.setSelectFilter(arg2);
                GPUImageFilter filter = GPUImageFilterTools.createFilterForType(
                        PhotoProcessActivity.this, filters.get(arg2).getType());
                mGPUImageView.setFilter(filter);
                GPUImageFilterTools.FilterAdjuster mFilterAdjuster = new GPUImageFilterTools.FilterAdjuster(filter);
                //可调节颜色的滤镜
                if (mFilterAdjuster.canAdjust()) {
                    //mFilterAdjuster.adjust(100); 给可调节的滤镜选一个合适的值
                }
            }
        }
    });
}
 
开发者ID:macyuan,项目名称:TAG,代码行数:23,代码来源:PhotoProcessActivity.java

示例4: onClick

import jp.co.cyberagent.android.gpuimage.GPUImageFilter; //导入依赖的package包/类
@Override
public void onClick(final View v) {
    switch (v.getId()) {
        case R.id.button_choose_filter:
            GPUImageFilterTools.showDialog(this, new OnGpuImageFilterChosenListener() {

                @Override
                public void onGpuImageFilterChosenListener(final GPUImageFilter filter) {
                    switchFilterTo(filter);
                    mGPUImageView.requestRender();
                }

            });
            break;
        case R.id.button_save:
            saveImage();
            break;

        default:
            break;
    }

}
 
开发者ID:hajunho,项目名称:AndroidCamera,代码行数:24,代码来源:ActivityGallery.java

示例5: getBitmapForMultipleFilters

import jp.co.cyberagent.android.gpuimage.GPUImageFilter; //导入依赖的package包/类
/**
 * Gets the images for multiple filters on a image. This can be used to
 * quickly get thumbnail images for filters. <br>
 * Whenever a new Bitmap is ready, the listener will be called with the
 * bitmap. The order of the calls to the listener will be the same as the
 * filter order.
 *
 * @param bitmap the bitmap on which the filters will be applied
 * @param filters the filters which will be applied on the bitmap
 * @param listener the listener on which the results will be notified
 */
public static void getBitmapForMultipleFilters(final Bitmap bitmap,
                                               final List<GPUImageFilter> filters, final ResponseListener<Bitmap> listener) {
  if (filters.isEmpty()) {
    return;
  }
  GPUImageRenderer renderer = new GPUImageRenderer(filters.get(0));
  renderer.setImageBitmap(bitmap, false);
  PixelBuffer buffer = new PixelBuffer(bitmap.getWidth(), bitmap.getHeight());
  buffer.setRenderer(renderer);

  for (GPUImageFilter filter : filters) {
    renderer.setFilter(filter);
    listener.response(buffer.getBitmap());
    filter.destroy();
  }
  renderer.deleteImage();
  buffer.destroy();
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:30,代码来源:GPUImage.java

示例6: setFilter

import jp.co.cyberagent.android.gpuimage.GPUImageFilter; //导入依赖的package包/类
public void setFilter(final GPUImageFilter filter) {
  runOnDraw(new Runnable() {

    @Override
    public void run() {
      final GPUImageFilter oldFilter = mFilter;
      mFilter = filter;
      if (oldFilter != null) {
        oldFilter.destroy();
      }
      mFilter.init();
      GLES20.glUseProgram(mFilter.getProgram());
      mFilter.onOutputSizeChanged(mOutputWidth, mOutputHeight);
    }
  });
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:17,代码来源:GPUImageRenderer.java

示例7: filterPhoto

import jp.co.cyberagent.android.gpuimage.GPUImageFilter; //导入依赖的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

示例8: initSurface

import jp.co.cyberagent.android.gpuimage.GPUImageFilter; //导入依赖的package包/类
@Override
public void initSurface(Context context) {
    List<GPUImageFilter> filters = new ArrayList<>();
    for (Processor processor : mProcessors) {
        filters.addAll(processor.getFilters());
    }
    filters.add(new GPUImageFilter());
    GLFilterGroup filterGroup = new GLFilterGroup(filters);
    filterGroup.setImageDumpedListener(this);
    mGLRender = new GLRender(filterGroup, mDefaultFilterEnabled, this, mProfiler);

    if (GLUtil.isSupportOpenGLES2(context)) {
        mGLSurfaceView.setEGLContextClientVersion(2);
    }
    mGLSurfaceView.setEGLConfigChooser(8, 8, 8, 8, 16, 0);
    mGLSurfaceView.getHolder().setFormat(PixelFormat.RGBA_8888);
    mGLSurfaceView.setRenderer(mGLRender);
    mGLSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
    mGLSurfaceView.requestRender();
}
 
开发者ID:Piasy,项目名称:CameraCompat,代码行数:21,代码来源:GPUImageChain.java

示例9: GLRender

import jp.co.cyberagent.android.gpuimage.GPUImageFilter; //导入依赖的package包/类
public GLRender(final GLFilterGroup filter, boolean enableFilter,
        VideoSizeChangedListener videoSizeChangedListener, Profiler profiler) {
    mVideoSizeChangedListener = videoSizeChangedListener;
    mProfiler = profiler;
    mIdleFilterGroup = new GLFilterGroup(Collections.singletonList(new GPUImageFilter()));
    mDesiredFilter = filter;
    mEnableFilter = enableFilter;
    mFilter = enableFilter ? mDesiredFilter : mIdleFilterGroup;
    mRunOnDraw = new LinkedList<>();
    mRunOnDrawEnd = new LinkedList<>();

    mGLCubeBuffer = ByteBuffer.allocateDirect(CUBE.length * 4)
            .order(ByteOrder.nativeOrder())
            .asFloatBuffer();
    mGLCubeBuffer.put(CUBE).position(0);

    mGLTextureBuffer = ByteBuffer.allocateDirect(TEXTURE_NO_ROTATION.length * 4)
            .order(ByteOrder.nativeOrder())
            .asFloatBuffer();
    setRotation(Rotation.NORMAL, false, false);
}
 
开发者ID:Piasy,项目名称:CameraCompat,代码行数:22,代码来源:GLRender.java

示例10: GLFilterGroup

import jp.co.cyberagent.android.gpuimage.GPUImageFilter; //导入依赖的package包/类
/**
 * Instantiates a new GPUImageFilterGroup with the given filters.
 *
 * @param filters the filters which represent this filter
 */
public GLFilterGroup(List<GPUImageFilter> filters) {
    mFilters = filters;
    if (mFilters == null) {
        mFilters = new ArrayList<>();
    } else {
        updateMergedFilters();
    }

    mGLCubeBuffer = ByteBuffer.allocateDirect(GLRender.CUBE.length * 4)
            .order(ByteOrder.nativeOrder())
            .asFloatBuffer();
    mGLCubeBuffer.put(GLRender.CUBE).position(0);

    mGLTextureBuffer = ByteBuffer.allocateDirect(TEXTURE_NO_ROTATION.length * 4)
            .order(ByteOrder.nativeOrder())
            .asFloatBuffer();
    mGLTextureBuffer.put(TEXTURE_NO_ROTATION).position(0);

    float[] flipTexture = TextureRotationUtil.getRotation(Rotation.NORMAL, false, true);
    mGLTextureFlipBuffer = ByteBuffer.allocateDirect(flipTexture.length * 4)
            .order(ByteOrder.nativeOrder())
            .asFloatBuffer();
    mGLTextureFlipBuffer.put(flipTexture).position(0);
}
 
开发者ID:Piasy,项目名称:CameraCompat,代码行数:30,代码来源:GLFilterGroup.java

示例11: updateMergedFilters

import jp.co.cyberagent.android.gpuimage.GPUImageFilter; //导入依赖的package包/类
public void updateMergedFilters() {
    if (mFilters == null) {
        return;
    }

    if (mMergedFilters == null) {
        mMergedFilters = new ArrayList<>();
    } else {
        mMergedFilters.clear();
    }

    List<GPUImageFilter> filters;
    for (GPUImageFilter filter : mFilters) {
        if (filter instanceof GLFilterGroup) {
            ((GLFilterGroup) filter).updateMergedFilters();
            filters = ((GLFilterGroup) filter).getMergedFilters();
            if (filters == null || filters.isEmpty()) continue;
            mMergedFilters.addAll(filters);
            continue;
        }
        mMergedFilters.add(filter);
    }
}
 
开发者ID:Piasy,项目名称:CameraCompat,代码行数:24,代码来源:GLFilterGroup.java

示例12: getFilterFactories

import jp.co.cyberagent.android.gpuimage.GPUImageFilter; //导入依赖的package包/类
private static Map<String, Func<GPUImageFilter>> getFilterFactories() {
    if (sFilterFactories != null) {
        return sFilterFactories;
    }

    sFilterFactories = new HashMap<>();

    sFilterFactories.put(CROP_FILTER_ID, new Func<GPUImageFilter>() {
        @Override
        public GPUImageFilter func() {
            return new GPUImageCropFilter();
        }
    });

    sFilterFactories.put(HUE_FILTER_ID, new Func<GPUImageFilter>() {
        @Override
        public GPUImageFilter func() {
            return new GPUImageHueFilter();
        }
    });

    return sFilterFactories;
}
 
开发者ID:Reaction-Framework,项目名称:react-native-gpuimage,代码行数:24,代码来源:GPUFilterUtils.java

示例13: initFilter

import jp.co.cyberagent.android.gpuimage.GPUImageFilter; //导入依赖的package包/类
@Override
protected GPUImageFilter initFilter(Context context) {
    PointF[] redControlPoints = new PointF[] { new PointF(0.0f, 0.078f),
            new PointF(0.341f, 0.475f), new PointF(0.835f, 0.882f),
            new PointF(1.0f, 0.949f) };

    PointF[] greenControlPoints = new PointF[] { new PointF(0.0f, 0.0f),
            new PointF(0.243f, 0.282f), new PointF(0.580f, 0.698f),
            new PointF(0.831f, 0.882f), new PointF(1.0f, 1.0f) };

    PointF[] blueControlPoints = new PointF[] { new PointF(0.0f, 0.067f),
            new PointF(0.490f, 0.565f), new PointF(0.761f, 0.773f),
            new PointF(1.0f, 0.910f) };

    return new FilterBuilder.Builder().toneCurve(redControlPoints,
            greenControlPoints, blueControlPoints).build();
}
 
开发者ID:cuipengpeng,项目名称:p1-android,代码行数:18,代码来源:SummerFilter.java

示例14: initFilter

import jp.co.cyberagent.android.gpuimage.GPUImageFilter; //导入依赖的package包/类
@Override
protected GPUImageFilter initFilter(Context context) {
    List<GPUImageFilter> filterList = new ArrayList<GPUImageFilter>();

    GPUImageOverlayBlendFilter blendFilter = new GPUImageOverlayBlendFilter();
    blendFilter.setBitmap(BitmapFactory.decodeResource(
            context.getResources(), R.drawable.filter_serenity_vignette2));
    filterList.add(blendFilter);

    GPUImageLookupFilter lookup = new GPUImageLookupFilter();
    lookup.setBitmap(BitmapFactory.decodeResource(context.getResources(),
            R.drawable.lookup_serenity));
    filterList.add(lookup);

    return new GPUImageFilterGroup(filterList);
}
 
开发者ID:cuipengpeng,项目名称:p1-android,代码行数:17,代码来源:SerenityFilter.java

示例15: initFilter

import jp.co.cyberagent.android.gpuimage.GPUImageFilter; //导入依赖的package包/类
@Override
protected GPUImageFilter initFilter(Context context) {
    List<GPUImageFilter> filterList = new ArrayList<GPUImageFilter>();

    GPUImageLookupFilter lookup = new GPUImageLookupFilter();
    lookup.setBitmap(BitmapFactory.decodeResource(context.getResources(),
            R.drawable.lookup_luminance));
    filterList.add(lookup);

    GPUImageSoftLightBlendFilter blendFilter = new GPUImageSoftLightBlendFilter();
    blendFilter.setBitmap(BitmapFactory.decodeResource(
            context.getResources(), R.drawable.filter_luminance_vignette));
    filterList.add(blendFilter);

    return new GPUImageFilterGroup(filterList);
}
 
开发者ID:cuipengpeng,项目名称:p1-android,代码行数:17,代码来源:LuminanceFilter.java


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