use of com.android.gallery3d.filtershow.filters.FilterDualCamFusionRepresentation 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);
}
use of com.android.gallery3d.filtershow.filters.FilterDualCamFusionRepresentation in project android_packages_apps_Gallery2 by LineageOS.
the class EditorDualCamFusion method reflectCurrentFilter.
@Override
public void reflectCurrentFilter() {
super.reflectCurrentFilter();
FilterRepresentation rep = getLocalRepresentation();
if (rep != null && rep instanceof FilterDualCamFusionRepresentation) {
FilterDualCamFusionRepresentation dualRep = (FilterDualCamFusionRepresentation) rep;
mImageFusion.setRepresentation(dualRep);
}
}
use of com.android.gallery3d.filtershow.filters.FilterDualCamFusionRepresentation in project android_packages_apps_Gallery2 by LineageOS.
the class EditorDualCamFusion method setUnderlayImageUri.
public void setUnderlayImageUri(Uri uri) {
mUnderlayUri = uri;
FilterRepresentation filter = getLocalRepresentation();
if (filter instanceof FilterDualCamFusionRepresentation) {
mImageFusion.setUnderlay(uri);
commitLocalRepresentation();
// save fusion underlay uri
GalleryUtils.setStringPref(mContext, mContext.getString(R.string.pref_dualcam_fusion_underlay_key), (uri != null) ? uri.toString() : null);
}
}
use of com.android.gallery3d.filtershow.filters.FilterDualCamFusionRepresentation in project android_packages_apps_Gallery2 by LineageOS.
the class SaveImage method findFusionRepresentation.
private FilterFusionRepresentation findFusionRepresentation(ImagePreset preset) {
FilterDualCamFusionRepresentation dcRepresentation = (FilterDualCamFusionRepresentation) preset.getFilterWithSerializationName(FilterDualCamFusionRepresentation.SERIALIZATION_NAME);
FilterTruePortraitFusionRepresentation tpRepresentation = (FilterTruePortraitFusionRepresentation) preset.getFilterWithSerializationName(FilterTruePortraitFusionRepresentation.SERIALIZATION_NAME);
FilterFusionRepresentation fusionRep = null;
if (dcRepresentation != null)
fusionRep = (FilterFusionRepresentation) dcRepresentation;
else if (tpRepresentation != null)
fusionRep = (FilterFusionRepresentation) tpRepresentation;
return fusionRep;
}
use of com.android.gallery3d.filtershow.filters.FilterDualCamFusionRepresentation in project android_packages_apps_Gallery2 by LineageOS.
the class MasterImage method hasFusionApplied.
public synchronized boolean hasFusionApplied() {
FilterRepresentation dcRepresentation = mPreset.getFilterWithSerializationName(FilterDualCamFusionRepresentation.SERIALIZATION_NAME);
FilterRepresentation tpRepresentation = mPreset.getFilterWithSerializationName(FilterTruePortraitFusionRepresentation.SERIALIZATION_NAME);
if (dcRepresentation instanceof FilterDualCamFusionRepresentation || tpRepresentation instanceof FilterTruePortraitFusionRepresentation) {
return true;
}
return false;
}
Aggregations