From f19e1870a01aab99529fc28a586f5190556d302c Mon Sep 17 00:00:00 2001 From: John Hoford Date: Wed, 10 Oct 2012 14:17:30 -0700 Subject: add White balance & disable UI elements bug:7234321 Change-Id: Ic44bfe30b5d25e7d4442c4e6d4fd9e0e8410c7af --- .../gallery3d/filtershow/FilterShowActivity.java | 12 ++--------- .../gallery3d/filtershow/PanelController.java | 13 +++++++++++- .../filtershow/filters/ImageFilterWBalance.java | 24 ++++++++++++++++++++++ 3 files changed, 38 insertions(+), 11 deletions(-) create mode 100644 src/com/android/gallery3d/filtershow/filters/ImageFilterWBalance.java diff --git a/src/com/android/gallery3d/filtershow/FilterShowActivity.java b/src/com/android/gallery3d/filtershow/FilterShowActivity.java index 505f4608e..aca7f4280 100644 --- a/src/com/android/gallery3d/filtershow/FilterShowActivity.java +++ b/src/com/android/gallery3d/filtershow/FilterShowActivity.java @@ -206,10 +206,10 @@ public class FilterShowActivity extends Activity implements OnItemClickListener, mPanelController.addComponent(mColorsButton, findViewById(R.id.vibranceButton)); mPanelController.addComponent(mColorsButton, findViewById(R.id.contrastButton)); mPanelController.addComponent(mColorsButton, findViewById(R.id.saturationButton)); - mPanelController.addComponent(mColorsButton, findViewById(R.id.tintButton)); + mPanelController.addComponent(mColorsButton, findViewById(R.id.wbalanceButton)); + mPanelController.addComponent(mColorsButton, findViewById(R.id.hueButton)); mPanelController.addComponent(mColorsButton, findViewById(R.id.exposureButton)); mPanelController.addComponent(mColorsButton, findViewById(R.id.shadowRecoveryButton)); - mPanelController.addComponent(mColorsButton, findViewById(R.id.redEyeButton)); mPanelController.addView(findViewById(R.id.resetEffect)); mPanelController.addView(findViewById(R.id.applyEffect)); @@ -431,14 +431,6 @@ public class FilterShowActivity extends Activity implements OnItemClickListener, preset[p++] = new ImagePresetFX(b, getString(fxNameid[i])); } - preset[p++] = new ImagePresetSaturated(); - preset[p++] = new ImagePresetOld(); - preset[p++] = new ImagePresetXProcessing(); - preset[p++] = new ImagePresetBW(); - preset[p++] = new ImagePresetBWRed(); - preset[p++] = new ImagePresetBWGreen(); - preset[p++] = new ImagePresetBWBlue(); - ImageSmallFilter previousFilter = null; for (int i = 0; i < p; i++) { ImageSmallFilter filter = new ImageSmallFilter(this); diff --git a/src/com/android/gallery3d/filtershow/PanelController.java b/src/com/android/gallery3d/filtershow/PanelController.java index 0c50046df..8da762559 100644 --- a/src/com/android/gallery3d/filtershow/PanelController.java +++ b/src/com/android/gallery3d/filtershow/PanelController.java @@ -19,6 +19,7 @@ import com.android.gallery3d.filtershow.filters.ImageFilterShadows; import com.android.gallery3d.filtershow.filters.ImageFilterSharpen; import com.android.gallery3d.filtershow.filters.ImageFilterVibrance; import com.android.gallery3d.filtershow.filters.ImageFilterVignette; +import com.android.gallery3d.filtershow.filters.ImageFilterWBalance; import com.android.gallery3d.filtershow.imageshow.ImageShow; import com.android.gallery3d.filtershow.presets.ImagePreset; import com.android.gallery3d.filtershow.ui.ImageCurves; @@ -372,6 +373,9 @@ public class PanelController implements OnClickListener { if (filter == null && name.equalsIgnoreCase("Redeye")) { filter = setImagePreset(new ImageFilterRedEye(), name); } + if (filter == null && name.equalsIgnoreCase("WBalance")) { + filter = setImagePreset(new ImageFilterWBalance(), name); + } mMasterImage.setCurrentFilter(filter); } @@ -456,7 +460,14 @@ public class PanelController implements OnClickListener { ensureFilter("Saturated"); break; } - case R.id.tintButton: { + case R.id.wbalanceButton: { + mCurrentImage = showImageView(R.id.imageShow).setShowControls(false); + mUtilityPanel.setEffectName("White Balance"); + mUtilityPanel.setGeometryEffect(true); + ensureFilter("WBalance"); + break; + } + case R.id.hueButton: { mCurrentImage = showImageView(R.id.imageShow).setShowControls(true); mUtilityPanel.setEffectName("Hue"); mUtilityPanel.setGeometryEffect(false); diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterWBalance.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterWBalance.java new file mode 100644 index 000000000..163ed0c65 --- /dev/null +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterWBalance.java @@ -0,0 +1,24 @@ + +package com.android.gallery3d.filtershow.filters; + +import android.graphics.Bitmap; +import android.util.Log; + +public class ImageFilterWBalance extends ImageFilter { + private static final String TAG = "ImageFilterWBalance"; + + public ImageFilterWBalance() { + mName = "WBalance"; + } + + native protected void nativeApplyFilter(Bitmap bitmap, int w, int h, int locX, int locY); + + @Override + public Bitmap apply(Bitmap bitmap, float scaleFactor, boolean highQuality) { + int w = bitmap.getWidth(); + int h = bitmap.getHeight(); + Log.v(TAG,"White Balance Call"); + nativeApplyFilter(bitmap, w, h, -1,-1); + return bitmap; + } +} -- cgit v1.2.3