filters/hsv.c \
filters/vibrance.c \
filters/geometry.c \
+ filters/negative.c \
filters/vignette.c \
filters/redEyeMath.c \
filters/fx.c \
--- /dev/null
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "filters.h"
+
+void JNIFUNCF(ImageFilterNegative, nativeApplyFilter, jobject bitmap, jint width, jint height)
+{
+ char* destination = 0;
+ AndroidBitmap_lockPixels(env, bitmap, (void**) &destination);
+
+ int tot_len = height * width * 4;
+ int i;
+ char * dst = destination;
+ for (i = 0; i < tot_len; i+=4) {
+ dst[RED] = 255 - dst[RED];
+ dst[GREEN] = 255 - dst[GREEN];
+ dst[BLUE] = 255 - dst[BLUE];
+ }
+ AndroidBitmap_unlockPixels(env, bitmap);
+}
<item type="id" name="shadowRecoveryButton" />
<item type="id" name="sharpenButton" />
<item type="id" name="curvesButtonRGB" />
+ <item type="id" name="negativeButton" />
</resources>
<string name="rotate" msgid="460017689320955494">Rotate</string>
<!-- Label for the image flip effect [CHAR LIMIT=15] -->
<string name="mirror">Mirror</string>
+ <!-- Name for the photo effect that inverts photo to negative images. [CHAR LIMIT=10] -->
+ <string name="negative">Negative</string>
<!-- Label for having no filters applied to the image [CHAR LIMIT=10] -->
<string name="none" msgid="3601545724573307541">None</string>
import com.android.gallery3d.filtershow.filters.ImageFilterExposure;
import com.android.gallery3d.filtershow.filters.ImageFilterFx;
import com.android.gallery3d.filtershow.filters.ImageFilterHue;
+import com.android.gallery3d.filtershow.filters.ImageFilterNegative;
import com.android.gallery3d.filtershow.filters.ImageFilterParametricBorder;
import com.android.gallery3d.filtershow.filters.ImageFilterRS;
import com.android.gallery3d.filtershow.filters.ImageFilterSaturated;
new ImageFilterCurves(),
new ImageFilterHue(),
new ImageFilterSaturated(),
- new ImageFilterBwFilter()
+ new ImageFilterBwFilter(),
+ new ImageFilterNegative()
};
for (int i = 0; i < filters.length; i++) {
import com.android.gallery3d.filtershow.filters.ImageFilterCurves;
import com.android.gallery3d.filtershow.filters.ImageFilterExposure;
import com.android.gallery3d.filtershow.filters.ImageFilterHue;
+import com.android.gallery3d.filtershow.filters.ImageFilterNegative;
import com.android.gallery3d.filtershow.filters.ImageFilterRedEye;
import com.android.gallery3d.filtershow.filters.ImageFilterSaturated;
import com.android.gallery3d.filtershow.filters.ImageFilterShadows;
if (view.getId() == R.id.curvesButtonRGB) {
// TODO: delegate to the filter / editing view the management of the
// panel accessory view
- mUtilityPanel.setShowParameter(false);
mUtilityPanel.showCurvesButtons();
}
+ mUtilityPanel.setShowParameter(filter.showParameterValue());
ensureFilter(ename);
mCurrentImage.select();
}
return true;
}
+ public boolean showParameterValue() {
+ return true;
+ }
+
@Override
public ImageFilter clone() throws CloneNotSupportedException {
ImageFilter filter = (ImageFilter) super.clone();
}
@Override
+ public boolean showParameterValue() {
+ return false;
+ }
+
+ @Override
public ImageFilter clone() throws CloneNotSupportedException {
ImageFilterCurves filter = (ImageFilterCurves) super.clone();
for (int i = 0; i < 4; i++) {
--- /dev/null
+package com.android.gallery3d.filtershow.filters;
+
+import android.graphics.Bitmap;
+
+import com.android.gallery3d.R;
+
+public class ImageFilterNegative extends ImageFilter {
+
+ public ImageFilterNegative() {
+ mName = "Negative";
+ }
+
+ @Override
+ public int getButtonId() {
+ return R.id.negativeButton;
+ }
+
+ @Override
+ public int getTextId() {
+ return R.string.negative;
+ }
+
+ @Override
+ public boolean isNil() {
+ return false;
+ }
+
+ @Override
+ public boolean showEditingControls() {
+ return false;
+ }
+
+ @Override
+ public boolean showParameterValue() {
+ return false;
+ }
+
+ native protected void nativeApplyFilter(Bitmap bitmap, int w, int h);
+
+ @Override
+ public Bitmap apply(Bitmap bitmap, float scaleFactor, boolean highQuality) {
+ int w = bitmap.getWidth();
+ int h = bitmap.getHeight();
+ nativeApplyFilter(bitmap, w, h);
+ return bitmap;
+ }
+}