int pos = listColors.indexOfChild(v);
listColors.removeView(v);
- filters[i].setParameter(100);
+ filters[i].setParameter(filters[i].getMaxParameter());
if(v instanceof ImageButtonTitle)
filters[i].setName(((ImageButtonTitle) v).getText());
fView.setImageFilter(filters[i]);
};
ImagePreset preset = new ImagePreset(); // empty
+ preset.setImageLoader(mImageLoader);
ImageSmallFilter filter = new ImageSmallFilter(this);
filter.setSelected(true);
import com.android.gallery3d.filtershow.imageshow.ImageShow;
import com.android.gallery3d.filtershow.presets.ImagePreset;
import com.android.gallery3d.filtershow.tools.SaveCopyTask;
+import com.android.gallery3d.util.XmpUtilHelper;
import java.io.Closeable;
import java.io.File;
cache.prepare(preset);
cache.addObserver(caller);
}
+
+ public Object getXmpObject() {
+ try {
+ InputStream is = mContext.getContentResolver().openInputStream(getUri());
+ return XmpUtilHelper.extractXMPMeta(is);
+ } catch (FileNotFoundException e) {
+ return null;
+ }
+ }
}
import android.graphics.Bitmap;
+import com.android.gallery3d.filtershow.presets.ImagePreset;
+
public class ImageFilter implements Cloneable {
protected int mMaxParameter = 100;
protected int mMinParameter = -100;
protected int mDefaultParameter = 0;
protected int mParameter = 0;
+ private ImagePreset mImagePreset;
+
protected String mName = "Original";
private final String LOGTAG = "ImageFilter";
public static final byte TYPE_BORDER =1;
filter.setFilterType(filterType);
filter.mMaxParameter = mMaxParameter;
filter.mMinParameter = mMinParameter;
+ filter.mImagePreset = mImagePreset;
filter.mDefaultParameter = mDefaultParameter;
return filter;
}
return mDefaultParameter;
}
+ public ImagePreset getImagePreset() {
+ return mImagePreset;
+ }
+
+ public void setImagePreset(ImagePreset mPreset) {
+ this.mImagePreset = mPreset;
+ }
+
public boolean same(ImageFilter filter) {
if (!filter.getName().equalsIgnoreCase(getName())) {
return false;
import android.graphics.Paint.Align;
import android.util.Log;
+import com.android.gallery3d.filtershow.presets.ImagePreset;
+
public class ImageFilterTinyPlanet extends ImageFilter {
private static final String TAG = ImageFilterTinyPlanet.class.getSimpleName();
@Override
public Bitmap apply(Bitmap bitmap, float scaleFactor, boolean highQuality) {
Log.d(TAG, "Applying tiny planet.");
+ String str = "TinyPlanet";
+ ImagePreset preset = getImagePreset();
+ if (preset != null) {
+ if (!preset.isPanoramaSafe()) {
+ str = "NO TP";
+ } else {
+ Object xmp = preset.getImageLoader().getXmpObject();
+ str = "TP got Xmp";
+ }
+ }
int w = bitmap.getWidth();
int h = bitmap.getHeight();
paint.setColor(Color.RED);
paint.setTextSize((int) (((mParameter + 100) / 200f) * 100));
paint.setTextAlign(Align.CENTER);
- canvas.drawText("TinyPlanet", w / 2, h / 2, paint);
+ canvas.drawText(str, w / 2, h / 2, paint);
return super.apply(bitmap, scaleFactor, highQuality);
}
}
public void setImagePreset(ImagePreset preset, boolean addToHistory) {
mImagePreset = preset;
if (getImagePreset() != null) {
+ getImagePreset().setImageLoader(mImageLoader);
if (addToHistory) {
mHistoryAdapter.addHistoryItem(getImagePreset());
}
mImageLoader = loader;
if (mImageLoader != null) {
mImageLoader.addListener(this);
+ if (mImagePreset != null) {
+ mImagePreset.setImageLoader(mImageLoader);
+ }
}
}
mImageFilter = filter;
mImagePreset = new ImagePreset();
mImagePreset.setName(filter.getName());
+ filter.setImagePreset(mImagePreset);
mImagePreset.add(mImageFilter);
}
import android.util.Log;
import com.android.gallery3d.filtershow.ImageStateAdapter;
+import com.android.gallery3d.filtershow.cache.ImageLoader;
import com.android.gallery3d.filtershow.filters.ImageFilter;
import com.android.gallery3d.filtershow.imageshow.GeometryMetadata;
import com.android.gallery3d.filtershow.imageshow.ImageShow;
private ImageFilter mImageBorder = null;
private float mScaleFactor = 1.0f;
private boolean mIsHighQuality = false;
+ private ImageLoader mImageLoader = null;
protected Vector<ImageFilter> mFilters = new Vector<ImageFilter>();
protected String mName = "Original";
mImageBorder = source.mImageBorder.clone();
}
for (int i = 0; i < source.mFilters.size(); i++) {
- add(source.mFilters.elementAt(i).clone());
+ ImageFilter filter = source.mFilters.elementAt(i).clone();
+ filter.setImagePreset(this);
+ add(filter);
}
} catch (java.lang.CloneNotSupportedException e) {
Log.v(LOGTAG, "Exception trying to clone: " + e);
mName = source.name();
mHistoryName = source.name();
mIsFxPreset = source.isFx();
+ mImageLoader = source.getImageLoader();
mGeoData.set(source.mGeoData);
}
mHistoryName = name;
}
+ public ImageLoader getImageLoader() {
+ return mImageLoader;
+ }
+
+ public void setImageLoader(ImageLoader mImageLoader) {
+ this.mImageLoader = mImageLoader;
+ }
+
public boolean same(ImagePreset preset) {
if (preset.mFilters.size() != mFilters.size()) {
return false;
mFilters.add(filter);
setHistoryName(filter.getName());
}
-
+ filter.setImagePreset(this);
}
public void remove(String filterName) {