--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2013 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.
+-->
+
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:iconbutton="http://schemas.android.com/apk/res/com.android.gallery3d"
+ android:id="@+id/basicEditor"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1" >
+
+ <com.android.gallery3d.filtershow.imageshow.ImageZoom
+ android:id="@+id/imageZoom"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+ <com.android.gallery3d.filtershow.CenteredLinearLayout
+ xmlns:custom="http://schemas.android.com/apk/res/com.android.gallery3d"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal|bottom"
+ android:background="@android:color/transparent"
+ custom:max_width="600dip"
+ android:orientation="vertical">
+
+ <SeekBar
+ android:id="@+id/filterSeekBar"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="bottom"
+ android:padding="16dip"/>
+ </com.android.gallery3d.filtershow.CenteredLinearLayout>
+ </FrameLayout>
public static int ID = R.id.basicEditor;
private SeekBar mSeekBar;
private final String LOGTAG = "Editor";
+ private int mLayoutID = R.layout.filtershow_default_editor;
+ private int mViewID = R.id.basicEditor;
public BasicEditor() {
super(ID);
}
+ protected BasicEditor(int id) {
+ super(id);
+ }
+
+ protected BasicEditor(int id, int layoutID, int viewID) {
+ super(id);
+ int mLayoutID = layoutID;
+ int mViewID = viewID;
+ }
+
@Override
public void createEditor(Context context, FrameLayout frameLayout) {
super.createEditor(context, frameLayout);
- unpack(R.id.basicEditor, R.layout.filtershow_default_editor);
+ unpack(mViewID, mLayoutID);
mSeekBar = (SeekBar) mView.findViewById(R.id.filterSeekBar);
mSeekBar.setOnSeekBarChangeListener(this);
}
package com.android.gallery3d.filtershow.editors;
-import android.content.Context;
-import android.widget.FrameLayout;
-
import com.android.gallery3d.R;
-import com.android.gallery3d.filtershow.imageshow.ImageZoom;
-public class EditorZoom extends Editor {
+public class EditorZoom extends BasicEditor {
public static final int ID = R.id.imageZoom;
public EditorZoom() {
- super(ID);
- }
-
- @Override
- public void createEditor(Context context, FrameLayout frameLayout) {
- super.createEditor(context, frameLayout);
- mView = mImageShow = new ImageZoom(context);
+ super(ID, R.layout.filtershow_zoom_editor,R.id.imageZoom);
}
}
private static final String LOGTAG = "ImageFilterSharpen";
private ScriptC_convolve3x3 mScript;
+ float mScaleFactor;
public ImageFilterSharpen() {
mName = "Sharpen";
boolean highQuality) {
int w = mInPixelsAllocation.getType().getX();
int h = mInPixelsAllocation.getType().getY();
+ mScaleFactor = scaleFactor;
- float p1 = mParameter * scaleFactor;
+ if (mScript == null) {
+ mScript = new ScriptC_convolve3x3(getRenderScriptContext(), res, R.raw.convolve3x3);
+ }
+ mScript.set_gWidth(w);
+ mScript.set_gHeight(h);
+ }
+
+ private void computeKernel(){
+ float p1 = mParameter * mScaleFactor;
float value = p1 / 100.0f;
float f[] = new float[9];
float p = value;
f[6] = -p;
f[7] = -p;
f[8] = -p;
- if (mScript == null) {
- mScript = new ScriptC_convolve3x3(getRenderScriptContext(), res, R.raw.convolve3x3);
- }
mScript.set_gCoeffs(f);
- mScript.set_gWidth(w);
- mScript.set_gHeight(h);
}
@Override
public void runFilter() {
+ computeKernel();
mScript.set_gIn(mInPixelsAllocation);
mScript.bind_gPixels(mInPixelsAllocation);
mScript.forEach_root(mInPixelsAllocation, mOutPixelsAllocation);