1 /* 2 * Copyright (C) 2012 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.gallery3d.filtershow.filters; 18 19 import com.android.gallery3d.R; 20 import com.android.gallery3d.filtershow.editors.EditorTinyPlanet; 21 22 public class FilterTinyPlanetRepresentation extends FilterBasicRepresentation { 23 private static final String LOGTAG = "FilterTinyPlanetRepresentation"; 24 private float mAngle = 0; 25 FilterTinyPlanetRepresentation()26 public FilterTinyPlanetRepresentation() { 27 super("TinyPlanet", 0, 50, 100); 28 setShowParameterValue(true); 29 setFilterClass(ImageFilterTinyPlanet.class); 30 setPriority(FilterRepresentation.TYPE_TINYPLANET); 31 setTextId(R.string.tinyplanet); 32 setButtonId(R.id.tinyplanetButton); 33 setEditorId(EditorTinyPlanet.ID); 34 setMinimum(1); 35 } 36 37 @Override clone()38 public FilterRepresentation clone() throws CloneNotSupportedException { 39 FilterTinyPlanetRepresentation representation = (FilterTinyPlanetRepresentation) super 40 .clone(); 41 representation.mAngle = mAngle; 42 representation.setZoom(getZoom()); 43 return representation; 44 } 45 46 @Override useParametersFrom(FilterRepresentation a)47 public void useParametersFrom(FilterRepresentation a) { 48 FilterTinyPlanetRepresentation representation = (FilterTinyPlanetRepresentation) a; 49 super.useParametersFrom(a); 50 mAngle = representation.mAngle; 51 setZoom(representation.getZoom()); 52 } 53 setAngle(float angle)54 public void setAngle(float angle) { 55 mAngle = angle; 56 } 57 getAngle()58 public float getAngle() { 59 return mAngle; 60 } 61 getZoom()62 public int getZoom() { 63 return getValue(); 64 } 65 setZoom(int zoom)66 public void setZoom(int zoom) { 67 setValue(zoom); 68 } 69 isNil()70 public boolean isNil() { 71 // TinyPlanet always has an effect 72 return false; 73 } 74 } 75