Search in sources :

Example 21 with FilterRepresentation

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

the class EditorVignette method calculateUserMessage.

@Override
public String calculateUserMessage(Context context, String effectName, Object parameterValue) {
    FilterRepresentation rep = getLocalRepresentation();
    if (rep == null || !(rep instanceof FilterVignetteRepresentation)) {
        return "";
    }
    FilterVignetteRepresentation csrep = (FilterVignetteRepresentation) rep;
    int mode = csrep.getParameterMode();
    String paramString;
    paramString = mContext.getString(mMenuStrings[mode]);
    int val = csrep.getCurrentParameter();
    return paramString + ((val > 0) ? " +" : " ") + val;
}
Also used : FilterRepresentation(com.android.gallery3d.filtershow.filters.FilterRepresentation) FilterVignetteRepresentation(com.android.gallery3d.filtershow.filters.FilterVignetteRepresentation)

Example 22 with FilterRepresentation

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

the class EditorVignette method reflectCurrentFilter.

@Override
public void reflectCurrentFilter() {
    if (useCompact(mContext)) {
        super.reflectCurrentFilter();
        FilterRepresentation rep = getLocalRepresentation();
        if (rep != null && getLocalRepresentation() instanceof FilterVignetteRepresentation) {
            FilterVignetteRepresentation drawRep = (FilterVignetteRepresentation) rep;
            mImageVignette.setRepresentation(drawRep);
        }
        updateText();
        return;
    }
    mLocalRepresentation = null;
    if (getLocalRepresentation() != null && getLocalRepresentation() instanceof FilterVignetteRepresentation) {
        FilterVignetteRepresentation rep = (FilterVignetteRepresentation) getLocalRepresentation();
        int min;
        int[] mode = { FilterVignetteRepresentation.MODE_VIGNETTE, FilterVignetteRepresentation.MODE_EXPOSURE, FilterVignetteRepresentation.MODE_SATURATION, FilterVignetteRepresentation.MODE_CONTRAST, FilterVignetteRepresentation.MODE_FALLOFF };
        SeekBar[] sliders = { mVignetteBar, mExposureBar, mSaturationBar, mContrastBar, mFalloffBar };
        TextView[] label = { mVignetteValue, mExposureValue, mSaturationValue, mContrastValue, mFalloffValue };
        for (int i = 0; i < mode.length; i++) {
            BasicParameterInt p = (BasicParameterInt) rep.getFilterParameter(mode[i]);
            int value = p.getValue();
            sliders[i].setMax(p.getMaximum() - p.getMinimum());
            sliders[i].setProgress(value - p.getMinimum());
            label[i].setText("" + value);
        }
        mImageVignette.setRepresentation(rep);
        super.reflectCurrentFilter();
        updateText();
    }
}
Also used : SeekBar(android.widget.SeekBar) BasicParameterInt(com.android.gallery3d.filtershow.controller.BasicParameterInt) FilterRepresentation(com.android.gallery3d.filtershow.filters.FilterRepresentation) TextView(android.widget.TextView) FilterVignetteRepresentation(com.android.gallery3d.filtershow.filters.FilterVignetteRepresentation)

Example 23 with FilterRepresentation

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

the class ParametricEditor method setEditPanelUI.

@Override
public void setEditPanelUI(View editControl) {
    mEditControl = editControl;
    FilterRepresentation rep = getLocalRepresentation();
    Parameter param = getParameterToEdit(rep);
    if (param != null) {
        control(param, editControl);
    } else {
        mSeekBar = (SeekBar) editControl.findViewById(R.id.primarySeekBar);
        if (mSeekBar != null && showsSeekBar()) {
            mSeekBar.setVisibility(View.VISIBLE);
        }
        mSeekBar.setOnSeekBarChangeListener(this);
    }
}
Also used : Parameter(com.android.gallery3d.filtershow.controller.Parameter) FilterRepresentation(com.android.gallery3d.filtershow.filters.FilterRepresentation)

Example 24 with FilterRepresentation

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

the class StatePanelTrack method onTouchEvent.

@Override
public boolean onTouchEvent(MotionEvent event) {
    if (mCurrentView == null) {
        return false;
    }
    if (mTouchTime == 0) {
        mTouchTime = System.currentTimeMillis();
    }
    mGestureDetector.onTouchEvent(event);
    if (mTouchPoint == null) {
        mTouchPoint = new Point();
        mTouchPoint.x = (int) event.getX();
        mTouchPoint.y = (int) event.getY();
    }
    if (event.getActionMasked() == MotionEvent.ACTION_MOVE) {
        float translation = event.getY() - mTouchPoint.y;
        float alpha = 1.0f - (Math.abs(translation) / mCurrentView.getHeight());
        if (getOrientation() == LinearLayout.VERTICAL) {
            translation = event.getX() - mTouchPoint.x;
            alpha = 1.0f - (Math.abs(translation) / mCurrentView.getWidth());
            mCurrentView.setTranslationX(translation);
        } else {
            mCurrentView.setTranslationY(translation);
        }
        mCurrentView.setBackgroundAlpha(alpha);
        if (ALLOWS_DRAG && alpha < 0.7) {
            setOnDragListener(mDragListener);
            DragShadowBuilder shadowBuilder = new DragShadowBuilder(mCurrentView);
            mCurrentView.startDrag(null, shadowBuilder, mCurrentView, 0);
            mStartedDrag = true;
        }
    }
    if (!mExited && mCurrentView != null && mCurrentView.getBackgroundAlpha() > mDeleteSlope && event.getActionMasked() == MotionEvent.ACTION_UP && System.currentTimeMillis() - mTouchTime < mMaxTouchDelay) {
        FilterRepresentation representation = mCurrentView.getState().getFilterRepresentation();
        mCurrentView.setSelected(true);
        if (representation != MasterImage.getImage().getCurrentFilterRepresentation()) {
            FilterShowActivity activity = (FilterShowActivity) getContext();
            activity.showRepresentation(representation);
            mCurrentView.setSelected(false);
        }
    }
    if (event.getActionMasked() == MotionEvent.ACTION_UP || (!mStartedDrag && event.getActionMasked() == MotionEvent.ACTION_CANCEL)) {
        checkEndState();
        if (mCurrentView != null) {
            FilterRepresentation representation = mCurrentView.getState().getFilterRepresentation();
            if (representation.getEditorId() == ImageOnlyEditor.ID) {
                mCurrentView.setSelected(false);
            }
        }
    }
    return true;
}
Also used : FilterRepresentation(com.android.gallery3d.filtershow.filters.FilterRepresentation) FilterShowActivity(com.android.gallery3d.filtershow.FilterShowActivity) Point(android.graphics.Point)

Example 25 with FilterRepresentation

use of com.android.gallery3d.filtershow.filters.FilterRepresentation 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;
}
Also used : FilterDualCamFusionRepresentation(com.android.gallery3d.filtershow.filters.FilterDualCamFusionRepresentation) FilterTruePortraitFusionRepresentation(com.android.gallery3d.filtershow.filters.FilterTruePortraitFusionRepresentation) 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