Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d7940c89 authored by Tim Murray's avatar Tim Murray
Browse files

add filters from Gallery to ImageProcessing

Change-Id: Iaf90f4a9468adde4bc8d94ec3ceed41846f424d0
parent 43cdf6d6
Loading
Loading
Loading
Loading
+35 −0
Original line number Diff line number Diff line
/*
 * 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.
 */

package com.android.rs.image;

import java.lang.Math;

import android.renderscript.Allocation;

public class BWFilter extends TestBase {
    private ScriptC_bwfilter mScript;

    public void createTest(android.content.res.Resources res) {
        mScript = new ScriptC_bwfilter(mRS);
    }

    public void runTest() {
        mScript.invoke_prepareBwFilter(50, 50, 50);
        mScript.forEach_bwFilterKernel(mInPixelsAllocation, mOutPixelsAllocation);
    }

}
+35 −0
Original line number Diff line number Diff line
/*
 * 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.
 */

package com.android.rs.image;

import java.lang.Math;

import android.renderscript.Allocation;

public class Contrast extends TestBase {
    private ScriptC_contrast mScript;

    public void createTest(android.content.res.Resources res) {
        mScript = new ScriptC_contrast(mRS);
    }

    public void runTest() {
        mScript.set_bright(50.f);
        mScript.forEach_contrast(mInPixelsAllocation, mOutPixelsAllocation);
    }

}
+35 −0
Original line number Diff line number Diff line
/*
 * 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.
 */

package com.android.rs.image;

import java.lang.Math;

import android.renderscript.Allocation;

public class Exposure extends TestBase {
    private ScriptC_exposure mScript;

    public void createTest(android.content.res.Resources res) {
        mScript = new ScriptC_exposure(mRS);
    }

    public void runTest() {
        mScript.set_bright(50.f);
        mScript.forEach_exposure(mInPixelsAllocation, mOutPixelsAllocation);
    }

}
+25 −1
Original line number Diff line number Diff line
@@ -273,6 +273,24 @@ public class ImageProcessingActivity extends Activity
        case 29:
            mTest = new Blur25G();
            break;
        case 30:
            mTest = new Vibrance();
            break;
        case 31:
            mTest = new BWFilter();
            break;
        case 32:
            mTest = new Shadows();
            break;
        case 33:
            mTest = new Contrast();
            break;
        case 34:
            mTest = new Exposure();
            break;
        case 35:
            mTest = new WhiteBalance();
            break;
        }

        mTest.createBaseTest(this, mBitmapIn, mBitmapIn2);
@@ -284,7 +302,7 @@ public class ImageProcessingActivity extends Activity
    }

    void setupTests() {
        mTestNames = new String[30];
        mTestNames = new String[36];
        mTestNames[0] = "Levels Vec3 Relaxed";
        mTestNames[1] = "Levels Vec4 Relaxed";
        mTestNames[2] = "Levels Vec3 Full";
@@ -315,6 +333,12 @@ public class ImageProcessingActivity extends Activity
        mTestNames[27] = "Mandelbrot";
        mTestNames[28] = "Intrinsics Blend";
        mTestNames[29] = "Intrinsics Blur 25 uchar";
        mTestNames[30] = "Vibrance";
        mTestNames[31] = "BW Filter";
        mTestNames[32] = "Shadows";
        mTestNames[33] = "Contrast";
        mTestNames[34] = "Exposure";
        mTestNames[35] = "White Balance";

        mTestSpinner.setAdapter(new ArrayAdapter<String>(
            this, R.layout.spinner_layout, mTestNames));
+35 −0
Original line number Diff line number Diff line
/*
 * 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.
 */

package com.android.rs.image;

import java.lang.Math;

import android.renderscript.Allocation;

public class Shadows extends TestBase {
    private ScriptC_shadows mScript;

    public void createTest(android.content.res.Resources res) {
        mScript = new ScriptC_shadows(mRS);
    }

    public void runTest() {
        mScript.invoke_prepareShadows(50.f);
        mScript.forEach_shadowsKernel(mInPixelsAllocation, mOutPixelsAllocation);
    }

}
Loading