EditorCurves.java revision 6a07dfbe03c8396cc43840a1630ea480a2cff663
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 17package com.android.gallery3d.filtershow.editors; 18 19import android.content.Context; 20import android.widget.FrameLayout; 21 22import com.android.gallery3d.R; 23import com.android.gallery3d.filtershow.filters.FilterCurvesRepresentation; 24import com.android.gallery3d.filtershow.filters.FilterRepresentation; 25import com.android.gallery3d.filtershow.ui.ImageCurves; 26 27public class EditorCurves extends Editor { 28 public static final int ID = R.id.imageCurves; 29 ImageCurves mImageCurves; 30 31 public EditorCurves() { 32 super(ID); 33 } 34 35 @Override 36 public void createEditor(Context context, FrameLayout frameLayout) { 37 super.createEditor(context, frameLayout); 38 mView = mImageShow = mImageCurves = new ImageCurves(context); 39 mImageCurves.setEditor(this); 40 } 41 42 @Override 43 public void reflectCurrentFilter() { 44 super.reflectCurrentFilter(); 45 FilterRepresentation rep = getLocalRepresentation(); 46 if (rep != null && getLocalRepresentation() instanceof FilterCurvesRepresentation) { 47 FilterCurvesRepresentation drawRep = (FilterCurvesRepresentation) rep; 48 mImageCurves.setFilterDrawRepresentation(drawRep); 49 } 50 } 51} 52