本文整理汇总了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);
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
}
}
}
示例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();
}
示例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);
}
}
}
示例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);
}
示例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);
}
}
示例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;
}
示例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;
}
示例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();
}
}
示例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);
}
}