1 /* 2 * Copyright 2006 The Android Open Source Project 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 SkMaskFilter_DEFINED 9 #define SkMaskFilter_DEFINED 10 11 #include "SkCoverageMode.h" 12 #include "SkFlattenable.h" 13 14 class SkMatrix; 15 class SkString; 16 17 /** \class SkMaskFilter 18 19 SkMaskFilter is the base class for object that perform transformations on 20 the mask before drawing it. An example subclass is Blur. 21 */ 22 class SK_API SkMaskFilter : public SkFlattenable { 23 public: 24 /** 25 * Construct a maskfilter whose effect is to first apply the inner filter and then apply 26 * the outer filter to the result of the inner's. Returns nullptr on failure. 27 */ 28 static sk_sp<SkMaskFilter> MakeCompose(sk_sp<SkMaskFilter> outer, sk_sp<SkMaskFilter> inner); 29 30 /** 31 * Compose two maskfilters together using a coverage mode. Returns nullptr on failure. 32 */ 33 static sk_sp<SkMaskFilter> MakeCombine(sk_sp<SkMaskFilter> filterA, sk_sp<SkMaskFilter> filterB, 34 SkCoverageMode mode); 35 36 sk_sp<SkMaskFilter> makeWithLocalMatrix(const SkMatrix&) const; 37 38 SK_TO_STRING_PUREVIRT() 39 SK_DEFINE_FLATTENABLE_TYPE(SkMaskFilter) 40 41 private: 42 static void InitializeFlattenables(); 43 friend class SkFlattenable; 44 }; 45 46 #endif 47