Search in sources :

Example 56 with FilterRepresentation

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

the class ImagePreset method readJson.

/**
 * populates preset from JSON stream
 *
 * @param sreader a JSON string
 * @return true on success if false ImagePreset is undefined
 */
public boolean readJson(JsonReader sreader) throws IOException {
    sreader.beginObject();
    while (sreader.hasNext()) {
        String name = sreader.nextName();
        FilterRepresentation filter = creatFilterFromName(name);
        if (filter == null) {
            Log.w(LOGTAG, "UNKNOWN FILTER! " + name);
            return false;
        }
        filter.deSerializeRepresentation(sreader);
        addFilter(filter);
    }
    sreader.endObject();
    return true;
}
Also used : FilterRepresentation(com.android.gallery3d.filtershow.filters.FilterRepresentation)

Example 57 with FilterRepresentation

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

the class StateView method delete.

@Override
public void delete() {
    FilterShowActivity activity = (FilterShowActivity) getContext();
    FilterRepresentation representation = getState().getFilterRepresentation();
    activity.removeFilterRepresentation(representation);
}
Also used : FilterShowActivity(com.android.gallery3d.filtershow.FilterShowActivity) FilterRepresentation(com.android.gallery3d.filtershow.filters.FilterRepresentation)

Example 58 with FilterRepresentation

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

the class CacheProcessing method displayFilters.

private void displayFilters(Vector<FilterRepresentation> filters) {
    Log.v(LOGTAG, "------>>> Filters received");
    for (int i = 0; i < filters.size(); i++) {
        FilterRepresentation filter = filters.elementAt(i);
        Log.v(LOGTAG, "[" + i + "] - " + filter.getName());
    }
    Log.v(LOGTAG, "<<<------");
}
Also used : FilterRepresentation(com.android.gallery3d.filtershow.filters.FilterRepresentation)

Example 59 with FilterRepresentation

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

the class ImageSavingTask method doInBackground.

public Result doInBackground(Request message) {
    SaveRequest request = (SaveRequest) message;
    Uri sourceUri = request.sourceUri;
    Uri selectedUri = request.selectedUri;
    File destinationFile = request.destinationFile;
    Bitmap previewImage = request.previewImage;
    ImagePreset preset = request.preset;
    boolean flatten = request.flatten;
    final boolean exit = request.exit;
    // We create a small bitmap showing the result that we can
    // give to the notification
    UpdateBitmap updateBitmap = new UpdateBitmap();
    updateBitmap.bitmap = createNotificationBitmap(previewImage, sourceUri, preset);
    postUpdate(updateBitmap);
    SaveImage saveImage = new SaveImage(mProcessingService, sourceUri, selectedUri, destinationFile, previewImage, new SaveImage.Callback() {

        @Override
        public void onPreviewSaved(Uri uri) {
            UpdatePreviewSaved previewSaved = new UpdatePreviewSaved();
            previewSaved.uri = uri;
            previewSaved.exit = exit;
            postUpdate(previewSaved);
        }

        @Override
        public void onProgress(int max, int current) {
            UpdateProgress updateProgress = new UpdateProgress();
            updateProgress.max = max;
            updateProgress.current = current;
            postUpdate(updateProgress);
        }
    });
    Uri uri = saveImage.processAndSaveImage(preset, flatten, request.quality, request.sizeFactor, request.exit);
    if (uri != null) {
        FilterRepresentation rep = preset.getFilterRepresentation(0);
        if (rep != null) {
            Log.d(GalleryActivity.QSST, "edited image saved successfully " + rep.getName());
        }
    }
    URIResult result = new URIResult();
    result.uri = uri;
    result.exit = request.exit;
    result.requestId = request.requsetId;
    return result;
}
Also used : FilterRepresentation(com.android.gallery3d.filtershow.filters.FilterRepresentation) SaveImage(com.android.gallery3d.filtershow.tools.SaveImage) Uri(android.net.Uri) Bitmap(android.graphics.Bitmap) File(java.io.File)

Example 60 with FilterRepresentation

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

the class CachingPipeline method compute.

public void compute(SharedBuffer buffer, ImagePreset preset, int type) {
    if (getRenderScriptContext() == null) {
        return;
    }
    setupEnvironment(preset, false);
    Vector<FilterRepresentation> filters = preset.getFilters();
    Bitmap result = mCachedProcessing.process(mOriginalBitmap, filters, mEnvironment);
    buffer.setProducer(result);
    mEnvironment.cache(result);
}
Also used : Bitmap(android.graphics.Bitmap) FilterRepresentation(com.android.gallery3d.filtershow.filters.FilterRepresentation)

Aggregations

FilterRepresentation (com.android.gallery3d.filtershow.filters.FilterRepresentation)78 Action (com.android.gallery3d.filtershow.category.Action)12 FiltersManager (com.android.gallery3d.filtershow.filters.FiltersManager)12 CategoryAdapter (com.android.gallery3d.filtershow.category.CategoryAdapter)11 Point (android.graphics.Point)8 ImagePreset (com.android.gallery3d.filtershow.pipeline.ImagePreset)8 Bitmap (android.graphics.Bitmap)7 FilterUserPresetRepresentation (com.android.gallery3d.filtershow.filters.FilterUserPresetRepresentation)6 FilterShowActivity (com.android.gallery3d.filtershow.FilterShowActivity)5 FilterDualCamFusionRepresentation (com.android.gallery3d.filtershow.filters.FilterDualCamFusionRepresentation)5 FilterMirrorRepresentation (com.android.gallery3d.filtershow.filters.FilterMirrorRepresentation)5 MasterImage (com.android.gallery3d.filtershow.imageshow.MasterImage)5 FilterGradRepresentation (com.android.gallery3d.filtershow.filters.FilterGradRepresentation)4 FilterRotateRepresentation (com.android.gallery3d.filtershow.filters.FilterRotateRepresentation)4 ArrayList (java.util.ArrayList)4 Uri (android.net.Uri)3 LayoutInflater (android.view.LayoutInflater)3 View (android.view.View)3 OnClickListener (android.view.View.OnClickListener)3 FilterCropRepresentation (com.android.gallery3d.filtershow.filters.FilterCropRepresentation)3