FilterTinyPlanetRepresentation.java revision 91d26f6c3b183862eeffc1856e2d758e800d13f4
144a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford/* 244a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford * Copyright (C) 2012 The Android Open Source Project 344a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford * 444a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford * Licensed under the Apache License, Version 2.0 (the "License"); 544a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford * you may not use this file except in compliance with the License. 644a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford * You may obtain a copy of the License at 744a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford * 844a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford * http://www.apache.org/licenses/LICENSE-2.0 944a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford * 1044a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford * Unless required by applicable law or agreed to in writing, software 1144a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford * distributed under the License is distributed on an "AS IS" BASIS, 1244a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1344a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford * See the License for the specific language governing permissions and 1444a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford * limitations under the License. 1544a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford */ 1644a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford 1744a499a64158cd5a12f8e44655f82b68c33bf3b2John Hofordpackage com.android.gallery3d.filtershow.filters; 1844a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford 196900cad45d240c9a54b92991538b6a33652e766cnicolasroardimport com.android.gallery3d.R; 206900cad45d240c9a54b92991538b6a33652e766cnicolasroardimport com.android.gallery3d.filtershow.editors.EditorTinyPlanet; 2144a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford 2244a499a64158cd5a12f8e44655f82b68c33bf3b2John Hofordpublic class FilterTinyPlanetRepresentation extends FilterBasicRepresentation { 2344a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford private static final String LOGTAG = "FilterTinyPlanetRepresentation"; 2444a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford private float mAngle = 0; 2544a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford 2644a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford public FilterTinyPlanetRepresentation() { 2744a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford super("TinyPlanet", 0, 50, 100); 2844a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford setShowParameterValue(true); 296900cad45d240c9a54b92991538b6a33652e766cnicolasroard setFilterClass(ImageFilterTinyPlanet.class); 30f60760478ec7c78446be0e0c6bc5502d1557974cnicolasroard setPriority(FilterRepresentation.TYPE_TINYPLANET); 316900cad45d240c9a54b92991538b6a33652e766cnicolasroard setTextId(R.string.tinyplanet); 326900cad45d240c9a54b92991538b6a33652e766cnicolasroard setButtonId(R.id.tinyplanetButton); 336900cad45d240c9a54b92991538b6a33652e766cnicolasroard setEditorId(EditorTinyPlanet.ID); 3491d26f6c3b183862eeffc1856e2d758e800d13f4John Hoford setMinimum(1); 3544a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford } 3644a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford 3744a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford @Override 3844a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford public FilterRepresentation clone() throws CloneNotSupportedException { 3944a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford FilterTinyPlanetRepresentation representation = (FilterTinyPlanetRepresentation) super 4044a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford .clone(); 4144a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford representation.mAngle = mAngle; 4244a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford representation.setZoom(getZoom()); 4344a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford return representation; 4444a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford } 4544a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford 4691d26f6c3b183862eeffc1856e2d758e800d13f4John Hoford @Override 4791d26f6c3b183862eeffc1856e2d758e800d13f4John Hoford public void useParametersFrom(FilterRepresentation a) { 4891d26f6c3b183862eeffc1856e2d758e800d13f4John Hoford FilterTinyPlanetRepresentation representation = (FilterTinyPlanetRepresentation) a; 4991d26f6c3b183862eeffc1856e2d758e800d13f4John Hoford super.useParametersFrom(a); 5091d26f6c3b183862eeffc1856e2d758e800d13f4John Hoford mAngle = representation.mAngle; 5191d26f6c3b183862eeffc1856e2d758e800d13f4John Hoford setZoom(representation.getZoom()); 5291d26f6c3b183862eeffc1856e2d758e800d13f4John Hoford } 5391d26f6c3b183862eeffc1856e2d758e800d13f4John Hoford 5444a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford public void setAngle(float angle) { 5544a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford mAngle = angle; 5644a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford } 5744a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford 5844a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford public float getAngle() { 5944a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford return mAngle; 6044a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford } 6144a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford 6244a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford public int getZoom() { 6344a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford return getValue(); 6444a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford } 6544a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford 6644a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford public void setZoom(int zoom) { 6744a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford setValue(zoom); 6844a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford } 696900cad45d240c9a54b92991538b6a33652e766cnicolasroard 706900cad45d240c9a54b92991538b6a33652e766cnicolasroard public boolean isNil() { 716900cad45d240c9a54b92991538b6a33652e766cnicolasroard // TinyPlanet always has an effect 726900cad45d240c9a54b92991538b6a33652e766cnicolasroard return false; 736900cad45d240c9a54b92991538b6a33652e766cnicolasroard } 7444a499a64158cd5a12f8e44655f82b68c33bf3b2John Hoford} 75