Home | History | Annotate | Download | only in filters
      1 /*
      2  * Copyright (C) 2010 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.photoeditor.filters;
     18 
     19 import com.android.photoeditor.Photo;
     20 
     21 /**
     22  * Image filter for photo editing.
     23  */
     24 public abstract class Filter {
     25 
     26     private boolean isValid;
     27 
     28     protected void validate() {
     29         isValid = true;
     30     }
     31 
     32     /**
     33      * Some filters, e.g. lighting filters, are initially invalid until set up with parameters while
     34      * others, e.g. sepia or flip filters, are initially valid without parameters.
     35      */
     36     public boolean isValid() {
     37         return isValid;
     38     }
     39 
     40     /**
     41      * Processes the source bitmap and matrix and output the destination bitmap and matrix.
     42      *
     43      * @param src source photo as the input.
     44      * @param dst destination photo having the same dimension as source photo as the output.
     45      */
     46     public abstract void process(Photo src, Photo dst);
     47 }
     48