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;
}
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);
}
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, "<<<------");
}
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;
}
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);
}
Aggregations