Search in sources :

Example 1 with FilterDualCamBasicRepresentation

use of com.android.gallery3d.filtershow.filters.FilterDualCamBasicRepresentation in project android_packages_apps_Gallery2 by LineageOS.

the class FilterShowActivity method showRepresentation.

public void showRepresentation(FilterRepresentation representation) {
    if (representation == null) {
        return;
    }
    Fragment currentPanel = getSupportFragmentManager().findFragmentByTag(MainPanel.FRAGMENT_TAG);
    if (currentPanel instanceof MainPanel && ((MainPanel) currentPanel).hasEditorPanel()) {
        if (representation.equals(MasterImage.getImage().getCurrentFilterRepresentation())) {
            return;
        }
        // cancel previous filter.
        cancelCurrentFilter();
        showDefaultImageView();
        removeSeekBarPanel();
    }
    if (representation instanceof FilterRotateRepresentation) {
        FilterRotateRepresentation r = (FilterRotateRepresentation) representation;
        r.rotateCW();
    }
    if (representation instanceof FilterMirrorRepresentation) {
        FilterMirrorRepresentation r = (FilterMirrorRepresentation) representation;
        r.cycle();
    }
    if (representation.isBooleanFilter()) {
        ImagePreset preset = MasterImage.getImage().getPreset();
        if (preset.getRepresentation(representation) != null) {
            // remove
            ImagePreset copy = new ImagePreset(preset);
            copy.removeFilter(representation);
            FilterRepresentation filterRepresentation = representation.copy();
            MasterImage.getImage().setPreset(copy, filterRepresentation, true);
            MasterImage.getImage().setCurrentFilterRepresentation(null);
            setActionBar();
            showActionBar(true);
            return;
        }
    }
    if (representation.getFilterType() == FilterRepresentation.TYPE_DUALCAM) {
        DisplayMetrics dm = getResources().getDisplayMetrics();
        float[] mTmpPoint = new float[2];
        mTmpPoint[0] = dm.widthPixels / 2;
        mTmpPoint[1] = dm.heightPixels / 2;
        Matrix m = MasterImage.getImage().getScreenToImageMatrix(true);
        m.mapPoints(mTmpPoint);
        if (representation instanceof FilterDualCamBasicRepresentation) {
            ((FilterDualCamBasicRepresentation) representation).setPoint((int) mTmpPoint[0], (int) mTmpPoint[1]);
        }
        if (representation instanceof FilterDualCamFusionRepresentation) {
            ((FilterDualCamFusionRepresentation) representation).setPoint((int) mTmpPoint[0], (int) mTmpPoint[1]);
        }
    }
    if (representation.getFilterType() == FilterRepresentation.TYPE_WATERMARK) {
        if (MasterImage.getImage().getCurrentFilterRepresentation() != null && representation.getSerializationName().equals(MasterImage.getImage().getCurrentFilterRepresentation().getSerializationName())) {
            return;
        }
        showWaterMark(representation);
    }
    if (TrueScannerActs.SERIALIZATION_NAME.equals(representation.getSerializationName())) {
        Bitmap b = MasterImage.getImage().getOriginalBitmapHighres();
        int w = b.getWidth();
        int h = b.getHeight();
        if (w < h) {
            w = h;
            h = b.getWidth();
        }
        if (w <= TrueScannerActs.MIN_WIDTH || h <= TrueScannerActs.MIN_HEIGHT) {
            Toast.makeText(this, getString(R.string.image_size_too_small), Toast.LENGTH_SHORT).show();
            return;
        }
    }
    useFilterRepresentation(representation);
    loadEditorPanel(representation);
}
Also used : FilterMirrorRepresentation(com.android.gallery3d.filtershow.filters.FilterMirrorRepresentation) FilterDualCamFusionRepresentation(com.android.gallery3d.filtershow.filters.FilterDualCamFusionRepresentation) ImagePreset(com.android.gallery3d.filtershow.pipeline.ImagePreset) FilterRepresentation(com.android.gallery3d.filtershow.filters.FilterRepresentation) Fragment(android.support.v4.app.Fragment) MediaPickerFragment(com.android.gallery3d.filtershow.mediapicker.MediaPickerFragment) DialogFragment(android.support.v4.app.DialogFragment) DisplayMetrics(android.util.DisplayMetrics) FilterDualCamBasicRepresentation(com.android.gallery3d.filtershow.filters.FilterDualCamBasicRepresentation) Point(android.graphics.Point) Bitmap(android.graphics.Bitmap) Matrix(android.graphics.Matrix) MainPanel(com.android.gallery3d.filtershow.category.MainPanel) FilterRotateRepresentation(com.android.gallery3d.filtershow.filters.FilterRotateRepresentation)

Example 2 with FilterDualCamBasicRepresentation

use of com.android.gallery3d.filtershow.filters.FilterDualCamBasicRepresentation in project android_packages_apps_Gallery2 by LineageOS.

the class EditorDualCamSketch method reflectCurrentFilter.

@Override
public void reflectCurrentFilter() {
    super.reflectCurrentFilter();
    FilterRepresentation rep = getLocalRepresentation();
    if (rep != null && rep instanceof FilterDualCamBasicRepresentation) {
        FilterDualCamBasicRepresentation dualRep = (FilterDualCamBasicRepresentation) rep;
        mImageDualCam.setRepresentation(dualRep);
    }
}
Also used : FilterRepresentation(com.android.gallery3d.filtershow.filters.FilterRepresentation) FilterDualCamBasicRepresentation(com.android.gallery3d.filtershow.filters.FilterDualCamBasicRepresentation)

Example 3 with FilterDualCamBasicRepresentation

use of com.android.gallery3d.filtershow.filters.FilterDualCamBasicRepresentation in project android_packages_apps_Gallery2 by LineageOS.

the class EditorDualCamera method reflectCurrentFilter.

@Override
public void reflectCurrentFilter() {
    super.reflectCurrentFilter();
    FilterRepresentation rep = getLocalRepresentation();
    if (rep != null && rep instanceof FilterDualCamBasicRepresentation) {
        FilterDualCamBasicRepresentation dualRep = (FilterDualCamBasicRepresentation) rep;
        mImageDualCam.setRepresentation(dualRep);
    }
}
Also used : FilterRepresentation(com.android.gallery3d.filtershow.filters.FilterRepresentation) FilterDualCamBasicRepresentation(com.android.gallery3d.filtershow.filters.FilterDualCamBasicRepresentation)

Aggregations

FilterDualCamBasicRepresentation (com.android.gallery3d.filtershow.filters.FilterDualCamBasicRepresentation)3 FilterRepresentation (com.android.gallery3d.filtershow.filters.FilterRepresentation)3 Bitmap (android.graphics.Bitmap)1 Matrix (android.graphics.Matrix)1 Point (android.graphics.Point)1 DialogFragment (android.support.v4.app.DialogFragment)1 Fragment (android.support.v4.app.Fragment)1 DisplayMetrics (android.util.DisplayMetrics)1 MainPanel (com.android.gallery3d.filtershow.category.MainPanel)1 FilterDualCamFusionRepresentation (com.android.gallery3d.filtershow.filters.FilterDualCamFusionRepresentation)1 FilterMirrorRepresentation (com.android.gallery3d.filtershow.filters.FilterMirrorRepresentation)1 FilterRotateRepresentation (com.android.gallery3d.filtershow.filters.FilterRotateRepresentation)1 MediaPickerFragment (com.android.gallery3d.filtershow.mediapicker.MediaPickerFragment)1 ImagePreset (com.android.gallery3d.filtershow.pipeline.ImagePreset)1