Home | History | Annotate | Download | only in core
      1 /*
      2  * Copyright (C) 2011 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 #ifndef SkDrawFilter_DEFINED
     18 #define SkDrawFilter_DEFINED
     19 
     20 #include "SkRefCnt.h"
     21 
     22 class SkCanvas;
     23 class SkPaint;
     24 
     25 /**
     26  *  Right before something is being draw, filter() is called with the
     27  *  paint. The filter may modify the paint as it wishes, which will then be
     28  *  used for the actual drawing. Note: this modification only lasts for the
     29  *  current draw, as a temporary copy of the paint is used.
     30  */
     31 class SkDrawFilter : public SkRefCnt {
     32 public:
     33     enum Type {
     34         kPaint_Type,
     35         kPoint_Type,
     36         kLine_Type,
     37         kBitmap_Type,
     38         kRect_Type,
     39         kPath_Type,
     40         kText_Type
     41     };
     42 
     43     /**
     44      *  Called with the paint that will be used to draw the specified type.
     45      *  The implementation may modify the paint as they wish.
     46      */
     47     virtual void filter(SkPaint*, Type) = 0;
     48 };
     49 
     50 #endif
     51