Search in sources :

Example 1 with ImageFilter

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

the class FilterEnvironment method applyRepresentation.

public void applyRepresentation(FilterRepresentation representation, Allocation in, Allocation out) {
    ImageFilter filter = mFiltersManager.getFilterForRepresentation(representation);
    filter.useRepresentation(representation);
    filter.setEnvironment(this);
    if (filter.supportsAllocationInput()) {
        filter.apply(in, out);
    }
    filter.setGeneralParameters();
    filter.setEnvironment(null);
}
Also used : ImageFilter(com.android.gallery3d.filtershow.filters.ImageFilter)

Example 2 with ImageFilter

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

the class FilterEnvironment method applyRepresentation.

public Bitmap applyRepresentation(FilterRepresentation representation, Bitmap bitmap) {
    if (representation instanceof FilterUserPresetRepresentation) {
        // applied directly they do not themselves need to do any kind of filtering.
        return bitmap;
    }
    ImageFilter filter = mFiltersManager.getFilterForRepresentation(representation);
    if (filter == null) {
        Log.e(LOGTAG, "No ImageFilter for " + representation.getSerializationName());
        return bitmap;
    }
    filter.useRepresentation(representation);
    filter.setEnvironment(this);
    Bitmap ret = filter.apply(bitmap, mScaleFactor, mQuality);
    if (bitmap != ret) {
        cache(bitmap);
    }
    filter.setGeneralParameters();
    filter.setEnvironment(null);
    return ret;
}
Also used : Bitmap(android.graphics.Bitmap) ImageFilter(com.android.gallery3d.filtershow.filters.ImageFilter) FilterUserPresetRepresentation(com.android.gallery3d.filtershow.filters.FilterUserPresetRepresentation)

Example 3 with ImageFilter

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

the class ImagePreset method getUsedFilters.

public Vector<ImageFilter> getUsedFilters(BaseFiltersManager filtersManager) {
    Vector<ImageFilter> usedFilters = new Vector<ImageFilter>();
    for (int i = 0; i < mFilters.size(); i++) {
        FilterRepresentation representation = mFilters.elementAt(i);
        ImageFilter filter = filtersManager.getFilterForRepresentation(representation);
        usedFilters.add(filter);
    }
    return usedFilters;
}
Also used : ImageFilter(com.android.gallery3d.filtershow.filters.ImageFilter) FilterRepresentation(com.android.gallery3d.filtershow.filters.FilterRepresentation) Vector(java.util.Vector)

Aggregations

ImageFilter (com.android.gallery3d.filtershow.filters.ImageFilter)3 Bitmap (android.graphics.Bitmap)1 FilterRepresentation (com.android.gallery3d.filtershow.filters.FilterRepresentation)1 FilterUserPresetRepresentation (com.android.gallery3d.filtershow.filters.FilterUserPresetRepresentation)1 Vector (java.util.Vector)1