コード例 #1
0
 // 初始化滤镜
 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); 给可调节的滤镜选一个合适的值
             }
           }
         }
       });
 }
コード例 #2
0
  // 初始化贴图
  private void initStickerToolBar() {

    bottomToolBar.setAdapter(
        new StickerToolAdapter(PhotoProcessActivity.this, EffectUtil.addonList));
    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();
            Addon sticker = EffectUtil.addonList.get(arg2);
            EffectUtil.addStickerImage(
                mImageView,
                PhotoProcessActivity.this,
                sticker,
                new EffectUtil.StickerCallback() {
                  @Override
                  public void onRemoveSticker(Addon sticker) {
                    labelSelector.hide();
                  }
                });
          }
        });
    setCurrentBtn(stickerBtn);
  }