Search in sources :

Example 1 with FilterCropRepresentation

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

the class EditorCrop method reflectCurrentFilter.

@Override
public void reflectCurrentFilter() {
    MasterImage master = MasterImage.getImage();
    master.setCurrentFilterRepresentation(master.getPreset().getFilterWithSerializationName(FilterCropRepresentation.SERIALIZATION_NAME));
    super.reflectCurrentFilter();
    FilterRepresentation rep = getLocalRepresentation();
    if (rep == null || rep instanceof FilterCropRepresentation) {
        mImageCrop.setFilterCropRepresentation((FilterCropRepresentation) rep);
    } else {
        Log.w(TAG, "Could not reflect current filter, not of type: " + FilterCropRepresentation.class.getSimpleName());
    }
    mImageCrop.invalidate();
}
Also used : MasterImage(com.android.gallery3d.filtershow.imageshow.MasterImage) FilterRepresentation(com.android.gallery3d.filtershow.filters.FilterRepresentation) FilterCropRepresentation(com.android.gallery3d.filtershow.filters.FilterCropRepresentation)

Example 2 with FilterCropRepresentation

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

the class ImagePreset method equals.

public boolean equals(ImagePreset preset) {
    if (preset == null) {
        return false;
    }
    if (preset.mFilters.size() != mFilters.size()) {
        return false;
    }
    if (mDoApplyGeometry != preset.mDoApplyGeometry) {
        return false;
    }
    if (mDoApplyFilters != preset.mDoApplyFilters) {
        if (mFilters.size() > 0 || preset.mFilters.size() > 0) {
            return false;
        }
    }
    for (int i = 0; i < preset.mFilters.size(); i++) {
        FilterRepresentation a = preset.mFilters.elementAt(i);
        FilterRepresentation b = mFilters.elementAt(i);
        boolean isGeometry = false;
        if (a instanceof FilterRotateRepresentation || a instanceof FilterMirrorRepresentation || a instanceof FilterCropRepresentation || a instanceof FilterStraightenRepresentation) {
            isGeometry = true;
        }
        boolean evaluate = true;
        if (!isGeometry && mDoApplyGeometry && !mDoApplyFilters) {
            evaluate = false;
        } else if (isGeometry && !mDoApplyGeometry && mDoApplyFilters) {
            evaluate = false;
        }
        if (evaluate && !a.equals(b)) {
            return false;
        }
    }
    return true;
}
Also used : FilterMirrorRepresentation(com.android.gallery3d.filtershow.filters.FilterMirrorRepresentation) FilterStraightenRepresentation(com.android.gallery3d.filtershow.filters.FilterStraightenRepresentation) FilterRepresentation(com.android.gallery3d.filtershow.filters.FilterRepresentation) FilterCropRepresentation(com.android.gallery3d.filtershow.filters.FilterCropRepresentation) FilterRotateRepresentation(com.android.gallery3d.filtershow.filters.FilterRotateRepresentation)

Example 3 with FilterCropRepresentation

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

the class ImageStraighten method getFinalRepresentation.

public Collection<FilterRepresentation> getFinalRepresentation() {
    ArrayList<FilterRepresentation> reps = new ArrayList<FilterRepresentation>(2);
    reps.add(mLocalRep);
    if (mInitialAngle != mLocalRep.getStraighten()) {
        reps.add(new FilterCropRepresentation(mCrop));
    }
    return reps;
}
Also used : ArrayList(java.util.ArrayList) FilterRepresentation(com.android.gallery3d.filtershow.filters.FilterRepresentation) FilterCropRepresentation(com.android.gallery3d.filtershow.filters.FilterCropRepresentation)

Aggregations

FilterCropRepresentation (com.android.gallery3d.filtershow.filters.FilterCropRepresentation)3 FilterRepresentation (com.android.gallery3d.filtershow.filters.FilterRepresentation)3 FilterMirrorRepresentation (com.android.gallery3d.filtershow.filters.FilterMirrorRepresentation)1 FilterRotateRepresentation (com.android.gallery3d.filtershow.filters.FilterRotateRepresentation)1 FilterStraightenRepresentation (com.android.gallery3d.filtershow.filters.FilterStraightenRepresentation)1 MasterImage (com.android.gallery3d.filtershow.imageshow.MasterImage)1 ArrayList (java.util.ArrayList)1