当前位置: 首页>>代码示例>>Java>>正文


Java FilterRepresentation类代码示例

本文整理汇总了Java中com.android.gallery3d.filtershow.filters.FilterRepresentation的典型用法代码示例。如果您正苦于以下问题:Java FilterRepresentation类的具体用法?Java FilterRepresentation怎么用?Java FilterRepresentation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FilterRepresentation类属于com.android.gallery3d.filtershow.filters包,在下文中一共展示了FilterRepresentation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fillLooks

import com.android.gallery3d.filtershow.filters.FilterRepresentation; //导入依赖的package包/类
private void fillLooks() {
    FiltersManager filtersManager = FiltersManager.getManager();
    ArrayList<FilterRepresentation> filtersRepresentations = filtersManager.getLooks();

    if (mCategoryLooksAdapter != null) {
        mCategoryLooksAdapter.clear();
    }
    mCategoryLooksAdapter = new CategoryAdapter(this);
    int verticalItemHeight = (int) getResources().getDimension(R.dimen.action_item_height);
    mCategoryLooksAdapter.setItemHeight(verticalItemHeight);
    for (FilterRepresentation representation : filtersRepresentations) {
        mCategoryLooksAdapter.add(new Action(this, representation, Action.FULL_VIEW));
    }
    if (mUserPresetsManager.getRepresentations() == null
        || mUserPresetsManager.getRepresentations().size() == 0) {
        mCategoryLooksAdapter.add(new Action(this, Action.ADD_ACTION));
    }

    Fragment panel = getSupportFragmentManager().findFragmentByTag(MainPanel.FRAGMENT_TAG);
    if (panel != null) {
        if (panel instanceof MainPanel) {
            MainPanel mainPanel = (MainPanel) panel;
            mainPanel.loadCategoryLookPanel(true);
        }
    }
}
 
开发者ID:asm-products,项目名称:nexus-gallery,代码行数:27,代码来源:FilterShowActivity.java

示例2: applyRepresentation

import com.android.gallery3d.filtershow.filters.FilterRepresentation; //导入依赖的package包/类
public Bitmap applyRepresentation(FilterRepresentation representation, Bitmap bitmap) {
    if (representation instanceof FilterUserPresetRepresentation) {
        // we allow instances of FilterUserPresetRepresentation in a preset only to know if one
        // has been applied (so we can show this in the UI). But as all the filters in them are
        // 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());
    }
    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;
}
 
开发者ID:asm-products,项目名称:nexus-gallery,代码行数:22,代码来源:FilterEnvironment.java

示例3: buildSteps

import com.android.gallery3d.filtershow.filters.FilterRepresentation; //导入依赖的package包/类
public static Vector<CacheStep> buildSteps(Vector<FilterRepresentation> filters) {
    Vector<CacheStep> steps = new Vector<CacheStep>();
    CacheStep step = new CacheStep();
    for (int i = 0; i < filters.size(); i++) {
        FilterRepresentation representation = filters.elementAt(i);
        if (step.canMergeWith(representation)) {
            step.add(representation.copy());
        } else {
            steps.add(step);
            step = new CacheStep();
            step.add(representation.copy());
        }
    }
    steps.add(step);
    return steps;
}
 
开发者ID:asm-products,项目名称:nexus-gallery,代码行数:17,代码来源:CacheProcessing.java

示例4: getFilterRepresentationCopyFrom

import com.android.gallery3d.filtershow.filters.FilterRepresentation; //导入依赖的package包/类
public FilterRepresentation getFilterRepresentationCopyFrom(
        FilterRepresentation filterRepresentation) {
    // TODO: add concept of position in the filters (to allow multiple instances)
    if (filterRepresentation == null) {
        return null;
    }
    int position = getPositionForRepresentation(filterRepresentation);
    if (position == -1) {
        return null;
    }
    FilterRepresentation representation = mFilters.elementAt(position);
    if (representation != null) {
        representation = representation.copy();
    }
    return representation;
}
 
开发者ID:asm-products,项目名称:nexus-gallery,代码行数:17,代码来源:ImagePreset.java

示例5: isPanoramaSafe

import com.android.gallery3d.filtershow.filters.FilterRepresentation; //导入依赖的package包/类
public boolean isPanoramaSafe() {
    for (FilterRepresentation representation : mFilters) {
        if (representation.getFilterType() == FilterRepresentation.TYPE_GEOMETRY
                && !representation.isNil()) {
            return false;
        }
        if (representation.getFilterType() == FilterRepresentation.TYPE_BORDER
                && !representation.isNil()) {
            return false;
        }
        if (representation.getFilterType() == FilterRepresentation.TYPE_VIGNETTE
                && !representation.isNil()) {
            return false;
        }
        if (representation.getFilterType() == FilterRepresentation.TYPE_TINYPLANET
                && !representation.isNil()) {
            return false;
        }
    }
    return true;
}
 
开发者ID:asm-products,项目名称:nexus-gallery,代码行数:22,代码来源:ImagePreset.java

示例6: similarUpTo

import com.android.gallery3d.filtershow.filters.FilterRepresentation; //导入依赖的package包/类
public int similarUpTo(ImagePreset preset) {
    for (int i = 0; i < preset.mFilters.size(); i++) {
        FilterRepresentation a = preset.mFilters.elementAt(i);
        if (i < mFilters.size()) {
            FilterRepresentation b = mFilters.elementAt(i);
            if (!a.same(b)) {
                return i;
            }
            if (!a.equals(b)) {
                return i;
            }
        } else {
            return i;
        }
    }
    return preset.mFilters.size();
}
 
开发者ID:asm-products,项目名称:nexus-gallery,代码行数:18,代码来源:ImagePreset.java

示例7: removeFilter

import com.android.gallery3d.filtershow.filters.FilterRepresentation; //导入依赖的package包/类
public void removeFilter(FilterRepresentation filterRepresentation) {
    if (filterRepresentation.getFilterType() == FilterRepresentation.TYPE_BORDER) {
        for (int i = 0; i < mFilters.size(); i++) {
            if (mFilters.elementAt(i).getFilterType()
            == filterRepresentation.getFilterType()) {
                mFilters.remove(i);
                break;
            }
        }
    } else {
        for (int i = 0; i < mFilters.size(); i++) {
            if (sameSerializationName(mFilters.elementAt(i), filterRepresentation)) {
                mFilters.remove(i);
                break;
            }
        }
    }
}
 
开发者ID:asm-products,项目名称:nexus-gallery,代码行数:19,代码来源:ImagePreset.java

示例8: setPreset

import com.android.gallery3d.filtershow.filters.FilterRepresentation; //导入依赖的package包/类
public synchronized void setPreset(ImagePreset preset,
                                   FilterRepresentation change,
                                   boolean addToHistory) {
    if (DEBUG) {
        preset.showFilters();
    }
    mPreset = preset;
    mPreset.fillImageStateAdapter(mState);
    if (addToHistory) {
        HistoryItem historyItem = new HistoryItem(mPreset, change);
        mHistory.addHistoryItem(historyItem);
    }
    updatePresets(true);
    resetGeometryImages(false);
    mActivity.updateCategories();
}
 
开发者ID:asm-products,项目名称:nexus-gallery,代码行数:17,代码来源:MasterImage.java

示例9: applyFilters

import com.android.gallery3d.filtershow.filters.FilterRepresentation; //导入依赖的package包/类
public void applyFilters(int from, int to, Allocation in, Allocation out,
        FilterEnvironment environment) {
    if (mDoApplyFilters) {
        if (from < 0) {
            from = 0;
        }
        if (to == -1) {
            to = mFilters.size();
        }
        for (int i = from; i < to; i++) {
            FilterRepresentation representation = mFilters.elementAt(i);
            if (representation.getFilterType() == FilterRepresentation.TYPE_GEOMETRY
                    || representation.getFilterType() == FilterRepresentation.TYPE_BORDER) {
                continue;
            }
            if (i > from) {
                in.copyFrom(out);
            }
            environment.applyRepresentation(representation, in, out);
        }
    }
}
 
开发者ID:asm-products,项目名称:nexus-gallery,代码行数:23,代码来源:ImagePreset.java

示例10: fillImageStateAdapter

import com.android.gallery3d.filtershow.filters.FilterRepresentation; //导入依赖的package包/类
public void fillImageStateAdapter(StateAdapter imageStateAdapter) {
    if (imageStateAdapter == null) {
        return;
    }
    Vector<State> states = new Vector<State>();
    for (FilterRepresentation filter : mFilters) {
        if (filter instanceof FilterUserPresetRepresentation) {
            // do not show the user preset itself in the state panel
            continue;
        }
        State state = new State(filter.getName());
        state.setFilterRepresentation(filter);
        states.add(state);
    }
    imageStateAdapter.fill(states);
}
 
开发者ID:asm-products,项目名称:nexus-gallery,代码行数:17,代码来源:ImagePreset.java

示例11: writeJson

import com.android.gallery3d.filtershow.filters.FilterRepresentation; //导入依赖的package包/类
public void writeJson(JsonWriter writer, String name) {
    int numFilters = mFilters.size();
    try {
        writer.beginObject();
        for (int i = 0; i < numFilters; i++) {
            FilterRepresentation filter = mFilters.get(i);
            if (filter instanceof FilterUserPresetRepresentation) {
                continue;
            }
            String sname = filter.getSerializationName();
            if (DEBUG) {
                Log.v(LOGTAG, "Serialization: " + sname);
                if (sname == null) {
                    Log.v(LOGTAG, "Serialization name null for filter: " + filter);
                }
            }
            writer.name(sname);
            filter.serializeRepresentation(writer);
        }
        writer.endObject();

    } catch (IOException e) {
       Log.e(LOGTAG,"Error encoding JASON",e);
    }
}
 
开发者ID:asm-products,项目名称:nexus-gallery,代码行数:26,代码来源:ImagePreset.java

示例12: readJson

import com.android.gallery3d.filtershow.filters.FilterRepresentation; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:asm-products,项目名称:nexus-gallery,代码行数:23,代码来源:ImagePreset.java

示例13: getView

import com.android.gallery3d.filtershow.filters.FilterRepresentation; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    StateView view = null;
    if (convertView == null) {
        convertView = new StateView(getContext());
    }
    view = (StateView) convertView;
    State state = getItem(position);
    view.setState(state);
    view.setOrientation(mOrientation);
    FilterRepresentation currentRep = MasterImage.getImage().getCurrentFilterRepresentation();
    FilterRepresentation stateRep = state.getFilterRepresentation();
    if (currentRep != null && stateRep != null
        && currentRep.getFilterClass() == stateRep.getFilterClass()
        && currentRep.getEditorId() != ImageOnlyEditor.ID) {
        view.setSelected(true);
    } else {
        view.setSelected(false);
    }
    return view;
}
 
开发者ID:asm-products,项目名称:nexus-gallery,代码行数:22,代码来源:StateAdapter.java

示例14: saveImage

import com.android.gallery3d.filtershow.filters.FilterRepresentation; //导入依赖的package包/类
public static void saveImage(ImagePreset preset, final FilterShowActivity filterShowActivity,
        File destination) {
    Uri selectedImageUri = filterShowActivity.getSelectedImageUri();
    Uri sourceImageUri = MasterImage.getImage().getUri();
    boolean flatten = false;
    if (preset.contains(FilterRepresentation.TYPE_TINYPLANET)){
        flatten = true;
    }
    Intent processIntent = ProcessingService.getSaveIntent(filterShowActivity, preset,
            destination, selectedImageUri, sourceImageUri, flatten, 90, 1f, true);

    filterShowActivity.startService(processIntent);

    if (!filterShowActivity.isSimpleEditAction()) {
        String toastMessage = filterShowActivity.getResources().getString(
                R.string.save_and_processing);
        Toast.makeText(filterShowActivity,
                toastMessage,
                Toast.LENGTH_SHORT).show();
    }
}
 
开发者ID:asm-products,项目名称:nexus-gallery,代码行数:22,代码来源:SaveImage.java

示例15: setUtilityPanelUI

import com.android.gallery3d.filtershow.filters.FilterRepresentation; //导入依赖的package包/类
@Override
public void setUtilityPanelUI(View actionButton, View editControl) {
    mActionButton = actionButton;
    mEditControl = editControl;
    FilterRepresentation rep = getLocalRepresentation();
    Parameter param = getParameterToEdit(rep);
    if (param != null) {
        control(param, editControl);
    } else {
        mSeekBar = new SeekBar(editControl.getContext());
        LayoutParams lp = new LinearLayout.LayoutParams(
                LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
        mSeekBar.setLayoutParams(lp);
        ((LinearLayout) editControl).addView(mSeekBar);
        mSeekBar.setOnSeekBarChangeListener(this);
    }
}
 
开发者ID:asm-products,项目名称:nexus-gallery,代码行数:18,代码来源:ParametricEditor.java


注:本文中的com.android.gallery3d.filtershow.filters.FilterRepresentation类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。