Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkEmbossMaskFilter.h
Go to the documentation of this file.
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 SkEmbossMaskFilter_DEFINED
9#define SkEmbossMaskFilter_DEFINED
10
13#include "include/core/SkRect.h"
16#include "src/core/SkMask.h"
18
19#include <cstdint>
20
21class SkMatrix;
22class SkReadBuffer;
23class SkWriteBuffer;
24struct SkIPoint;
25
26/** \class SkEmbossMaskFilter
27
28 This mask filter creates a 3D emboss look, by specifying a light and blur amount.
29*/
31public:
32 struct Light {
33 SkScalar fDirection[3]; // x,y,z
34 uint16_t fPad;
35 uint8_t fAmbient;
36 uint8_t fSpecular; // exponent, 4.4 right now
37 };
38
39 static sk_sp<SkMaskFilter> Make(SkScalar blurSigma, const Light& light);
40
41 // overrides from SkMaskFilter
42 // This method is not exported to java.
43 SkMask::Format getFormat() const override;
44 // This method is not exported to java.
45 bool filterMask(SkMaskBuilder* dst, const SkMask& src, const SkMatrix&,
46 SkIPoint* margin) const override;
48
49protected:
50 SkEmbossMaskFilter(SkScalar blurSigma, const Light& light);
51 void flatten(SkWriteBuffer&) const override;
52
53private:
55
56 Light fLight;
57 SkScalar fBlurSigma;
58
59 using INHERITED = SkMaskFilter;
60};
61
62#endif
#define SK_FLATTENABLE_HOOKS(type)
SkMask::Format getFormat() const override
static sk_sp< SkMaskFilter > Make(SkScalar blurSigma, const Light &light)
bool filterMask(SkMaskBuilder *dst, const SkMask &src, const SkMatrix &, SkIPoint *margin) const override
void flatten(SkWriteBuffer &) const override
SkMaskFilterBase::Type type() const override
float SkScalar
Definition extension.cpp:12
Format
Definition SkMask.h:26