Search in sources :

Example 21 with ImagePreset

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;
}
Also used : ImagePreset(com.android.gallery3d.filtershow.pipeline.ImagePreset) FilterRepresentation(com.android.gallery3d.filtershow.filters.FilterRepresentation)

Example 22 with ImagePreset

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;
}
Also used : ArrayList(java.util.ArrayList) ImagePreset(com.android.gallery3d.filtershow.pipeline.ImagePreset) Cursor(android.database.Cursor) FilterUserPresetRepresentation(com.android.gallery3d.filtershow.filters.FilterUserPresetRepresentation)

Example 23 with ImagePreset

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);
}
Also used : Bitmap(android.graphics.Bitmap) ImagePreset(com.android.gallery3d.filtershow.pipeline.ImagePreset) FilterChanSatRepresentation(com.android.gallery3d.filtershow.filters.FilterChanSatRepresentation)

Example 24 with ImagePreset

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);
    }
}
Also used : ImagePreset(com.android.gallery3d.filtershow.pipeline.ImagePreset)

Example 25 with ImagePreset

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);
    }
}
Also used : FilterPresetSource(com.android.gallery3d.filtershow.data.FilterPresetSource) ImagePreset(com.android.gallery3d.filtershow.pipeline.ImagePreset) Uri(android.net.Uri) SaveOption(com.android.gallery3d.filtershow.data.FilterPresetSource.SaveOption)

Aggregations

ImagePreset (com.android.gallery3d.filtershow.pipeline.ImagePreset)28 FilterRepresentation (com.android.gallery3d.filtershow.filters.FilterRepresentation)8 Bitmap (android.graphics.Bitmap)7 Matrix (android.graphics.Matrix)4 Point (android.graphics.Point)4 FilterUserPresetRepresentation (com.android.gallery3d.filtershow.filters.FilterUserPresetRepresentation)4 RectF (android.graphics.RectF)3 Uri (android.net.Uri)3 FilterMirrorRepresentation (com.android.gallery3d.filtershow.filters.FilterMirrorRepresentation)3 FilterRotateRepresentation (com.android.gallery3d.filtershow.filters.FilterRotateRepresentation)3 Canvas (android.graphics.Canvas)2 Paint (android.graphics.Paint)2 Rect (android.graphics.Rect)2 XMPMeta (com.adobe.xmp.XMPMeta)2 Action (com.android.gallery3d.filtershow.category.Action)2 FilterPresetSource (com.android.gallery3d.filtershow.data.FilterPresetSource)2 SaveOption (com.android.gallery3d.filtershow.data.FilterPresetSource.SaveOption)2 HistoryItem (com.android.gallery3d.filtershow.history.HistoryItem)2 GeometryHolder (com.android.gallery3d.filtershow.imageshow.GeometryMathUtils.GeometryHolder)2 MasterImage (com.android.gallery3d.filtershow.imageshow.MasterImage)2