Home | History | Annotate | Download | only in effects
      1 /*
      2  * Copyright 2016 Google Inc.
      3  *
      4  * Use of this source code is governed by a BSD-style license that can be
      5  * found in the LICENSE file.
      6  */
      7 
      8 #ifndef SkRRectsGaussianEdgeMaskFilter_DEFINED
      9 #define SkRRectsGaussianEdgeMaskFilter_DEFINED
     10 
     11 #include "SkMaskFilter.h"
     12 #include "SkScalar.h"
     13 
     14 class SkRRect;
     15 
     16 class SK_API SkRRectsGaussianEdgeMaskFilter {
     17 public:
     18     /** Returns a mask filter that applies a Gaussian blur depending on distance to the edge
     19      *  of the intersection of two round rects.
     20      *  Currently this is only useable with round rects that have the same radii at
     21      *  all the corners and for which the x & y radii are equal.
     22      *
     23      *  In order to minimize fill the coverage geometry that should be drawn should be no larger
     24      *  than the intersection of the bounding boxes of the two round rects. Ambitious users can
     25      *  omit the center area of the coverage geometry if it is known to be occluded.
     26      */
     27     static sk_sp<SkMaskFilter> Make(const SkRRect& first,
     28                                     const SkRRect& second,
     29                                     SkScalar radius);
     30 
     31     SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
     32 
     33 private:
     34     SkRRectsGaussianEdgeMaskFilter(); // can't be instantiated
     35 };
     36 
     37 #endif
     38