use of com.android.gallery3d.filtershow.pipeline.ImagePreset in project android_packages_apps_Gallery2 by LineageOS.
the class Editor method getLocalRepresentation.
public FilterRepresentation getLocalRepresentation() {
if (mLocalRepresentation == null) {
ImagePreset preset = MasterImage.getImage().getPreset();
FilterRepresentation filterRepresentation = MasterImage.getImage().getCurrentFilterRepresentation();
mLocalRepresentation = preset.getFilterRepresentationCopyFrom(filterRepresentation);
if (mShowParameter == SHOW_VALUE_UNDEFINED && filterRepresentation != null) {
boolean show = filterRepresentation.showParameterValue();
mShowParameter = show ? SHOW_VALUE_INT : SHOW_VALUE_OFF;
}
}
return mLocalRepresentation;
}
use of com.android.gallery3d.filtershow.pipeline.ImagePreset in project android_packages_apps_Gallery2 by LineageOS.
the class FilterStackSource method getAllUserPresets.
public ArrayList<FilterUserPresetRepresentation> getAllUserPresets() {
ArrayList<FilterUserPresetRepresentation> ret = new ArrayList<FilterUserPresetRepresentation>();
Cursor c = null;
database.beginTransaction();
try {
c = database.query(FilterStack.TABLE, new String[] { FilterStack._ID, FilterStack.STACK_ID, FilterStack.FILTER_STACK }, null, null, null, null, null, null);
if (c != null) {
boolean loopCheck = c.moveToFirst();
while (loopCheck) {
int id = c.getInt(0);
String name = (c.isNull(1)) ? null : c.getString(1);
byte[] b = (c.isNull(2)) ? null : c.getBlob(2);
String json = new String(b);
ImagePreset preset = new ImagePreset();
preset.readJsonFromString(json);
FilterUserPresetRepresentation representation = new FilterUserPresetRepresentation(name, preset, id);
ret.add(representation);
loopCheck = c.moveToNext();
}
}
database.setTransactionSuccessful();
} finally {
if (c != null) {
c.close();
}
database.endTransaction();
}
return ret;
}
use of com.android.gallery3d.filtershow.pipeline.ImagePreset in project android_packages_apps_Gallery2 by LineageOS.
the class EditorChanSat method computeIcon.
@Override
public void computeIcon(int n, BitmapCaller caller) {
FilterChanSatRepresentation rep = getChanSatRep();
if (rep == null)
return;
rep = (FilterChanSatRepresentation) rep.copy();
ImagePreset preset = new ImagePreset();
preset.addFilter(rep);
Bitmap src = MasterImage.getImage().getThumbnailBitmap();
caller.available(src);
}
use of com.android.gallery3d.filtershow.pipeline.ImagePreset in project android_packages_apps_Gallery2 by LineageOS.
the class BaseFiltersManager method addLooks.
public void addLooks(Context context) {
int[] drawid = { R.drawable.filtershow_fx_0005_punch, R.drawable.filtershow_fx_0000_vintage, R.drawable.filtershow_fx_0004_bw_contrast, R.drawable.filtershow_fx_0002_bleach, R.drawable.filtershow_fx_0001_instant, R.drawable.filtershow_fx_0007_washout, R.drawable.filtershow_fx_0003_blue_crush, R.drawable.filtershow_fx_0008_washout_color, R.drawable.filtershow_fx_0006_x_process };
int[] fxNameid = { R.string.ffx_punch, R.string.ffx_vintage, R.string.ffx_bw_contrast, R.string.ffx_bleach, R.string.ffx_instant, R.string.ffx_washout, R.string.ffx_blue_crush, R.string.ffx_washout_color, R.string.ffx_x_process };
// Do not localize.
String[] serializationNames = { "LUT3D_PUNCH", "LUT3D_VINTAGE", "LUT3D_BW", "LUT3D_BLEACH", "LUT3D_INSTANT", "LUT3D_WASHOUT", "LUT3D_BLUECRUSH", "LUT3D_WASHOUT_COLOR", "LUT3D_XPROCESS" };
int[] colorId = { R.color.filtershow_color_none, R.color.filtershow_color_punch, R.color.filtershow_color_vintage, R.color.filtershow_color_bw, R.color.filtershow_color_bleach, R.color.filtershow_color_instant, R.color.filtershow_color_latte, R.color.filtershow_color_blue, R.color.filtershow_color_litho, R.color.filtershow_color_xprocess };
FilterFxRepresentation nullFx = new FilterFxRepresentation(context.getString(R.string.none), 0, R.string.none);
nullFx.setColorId(colorId[0]);
mLooks.add(nullFx);
for (int i = 0; i < drawid.length; i++) {
FilterFxRepresentation fx = new FilterFxRepresentation(context.getString(fxNameid[i]), drawid[i], fxNameid[i]);
fx.setSerializationName(serializationNames[i]);
fx.setColorId(colorId[i] + 1);
ImagePreset preset = new ImagePreset();
preset.addFilter(fx);
FilterUserPresetRepresentation rep = new FilterUserPresetRepresentation(context.getString(fxNameid[i]), preset, -1);
rep.setColorId(colorId[i] + 1);
mLooks.add(rep);
addRepresentation(fx);
}
}
use of com.android.gallery3d.filtershow.pipeline.ImagePreset in project android_packages_apps_Gallery2 by LineageOS.
the class BaseFiltersManager method addFilterPreset.
public void addFilterPreset(Context context) {
FilterPresetSource fp = new FilterPresetSource(context);
ArrayList<SaveOption> ret = fp.getAllUserPresets();
if (ret == null)
return;
for (int id = 0; id < ret.size(); id++) {
FilterPresetRepresentation representation = new FilterPresetRepresentation(ret.get(id).name, ret.get(id)._id, id + 1);
Uri filteredUri = Uri.parse(ret.get(id).Uri);
representation.setUri(filteredUri);
representation.setSerializationName("Custom");
mFilterPreset.add(representation);
ImagePreset preset = new ImagePreset();
preset.addFilter(representation);
addRepresentation(representation);
}
}
Aggregations