SkMaskFilter.h 代码
时间: 2023-09-21 16:13:24 浏览: 157
filter代码
以下是SkMaskFilter.h的代码,您可以查看是否正确包含了SkBlurMaskFilter.h头文件:
```
#ifndef SkMaskFilter_DEFINED
#define SkMaskFilter_DEFINED
#include "include/core/SkRefCnt.h"
class SkMask;
class SkPaint;
class SkRect;
class SkString;
struct SkIRect;
class SkMatrix;
enum SkBlurStyle {
kNormal_SkBlurStyle, //!< fuzzy inside and outside
kSolid_SkBlurStyle, //!< solid inside, fuzzy outside
kOuter_SkBlurStyle, //!< nothing inside, fuzzy outside
kInner_SkBlurStyle, //!< fuzzy inside, nothing outside
kLastEnum_SkBlurStyle = kInner_SkBlurStyle
};
static constexpr int kBlurStyleCount = kLastEnum_SkBlurStyle + 1;
/** \class SkMaskFilter
SkMaskFilter is the base class for object that perform transformations on the mask before drawing
(in the maskFilter case) or after drawing (in the tableMaskFilter case).
*/
class SK_API SkMaskFilter : public SkRefCnt {
public:
~SkMaskFilter() override;
/** Given the input mask (generally from a SkGlyph), generate a new mask by applying the
filter's transform to it. The caller is responsible for freeing the returned mask.
@param dst storage for the new mask. It should be pre-allocated
@param src the original mask to be filtered
@param matrix transformation to apply to the mask, if the filter requires it
@param offset optional (may be nullptr) output parameter for the offset of the mask
relative to the original mask. The mask's bounds will be offset by this
amount relative to the glyph's left and top.
@return true if the resulting mask is not empty
*/
virtual bool filterMask(SkMask* dst, const SkMask& src, const SkMatrix& matrix,
SkIPoint* offset) const = 0;
/** Given the input blur radius, return the amount of additional space required in order to
account for the blur. This is used by the font cache to determine how much padding to add
when a glyph is added to the cache.
@param sigma The standard deviation of the desired Gaussian blur. Must be > 0.
@param style The style of the blur to apply.
@param bloatOutset If non-null, the resulting blur-outset will be added to this value.
@return The number of pixels of additional space required in each direction.
*/
virtual SkIRect filterBounds(const SkIRect& src, const SkMatrix& matrix,
SkBlurStyle style, SkScalar sigma) const;
/** Compute the blur radius for a given matrix and total sigma, taking into account this
filter's sigma and respectCTM setting.
@param matrix The matrix for the current draw operation.
@param totalSigma The total sigma to apply to the blur.
@return The sigma to use for this filter.
*/
virtual BlurRec computeBlurRec(const SkMatrix& matrix, SkScalar totalSigma) const = 0;
virtual void flatten(SkWriteBuffer&) const = 0;
int getFlattenedSize() const;
static sk_sp<SkMaskFilter> Deserialize(SkReadBuffer&);
static void RegisterFlattenables();
protected:
SkMaskFilter() = default;
private:
typedef SkRefCnt INHERITED;
friend class SkMaskFilterBase;
};
#endif
```
如果问题仍然存在,请提供更多上下文信息,以便我更好地帮助您。
阅读全文