Skia
2DGraphicsLibrary
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SkEmbossMaskFilter.h
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 
11 #include "SkMaskFilter.h"
12 
17 class SK_API SkEmbossMaskFilter : public SkMaskFilter {
18 public:
19  struct Light {
20  SkScalar fDirection[3]; // x,y,z
21  uint16_t fPad;
22  uint8_t fAmbient;
23  uint8_t fSpecular; // exponent, 4.4 right now
24  };
25 
26  static sk_sp<SkMaskFilter> Make(SkScalar blurSigma, const Light& light);
27 
28 #ifdef SK_SUPPORT_LEGACY_MASKFILTER_PTR
29  static SkMaskFilter* Create(SkScalar blurSigma, const Light& light) {
30  return Make(blurSigma, light).release();
31  }
32 #endif
33 
34  // overrides from SkMaskFilter
35  // This method is not exported to java.
36  SkMask::Format getFormat() const override;
37  // This method is not exported to java.
38  bool filterMask(SkMask* dst, const SkMask& src, const SkMatrix&,
39  SkIPoint* margin) const override;
40 
41  SK_TO_STRING_OVERRIDE()
42  SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkEmbossMaskFilter)
43 
44 protected:
45  SkEmbossMaskFilter(SkScalar blurSigma, const Light& light);
46  void flatten(SkWriteBuffer&) const override;
47 
48 private:
49  Light fLight;
50  SkScalar fBlurSigma;
51 
52  typedef SkMaskFilter INHERITED;
53 };
54 
55 #endif
This mask filter creates a 3D emboss look, by specifying a light and blur amount. ...
Definition: SkEmbossMaskFilter.h:17
The SkMatrix class holds a 3x3 matrix for transforming coordinates.
Definition: SkMatrix.h:26
SkMask is used to describe alpha bitmaps, either 1bit, 8bit, or the 3-channel 3D format.
Definition: SkMask.h:19
virtual bool filterMask(SkMask *dst, const SkMask &src, const SkMatrix &, SkIPoint *margin) const
Create a new mask by filter the src mask.
SkMaskFilter is the base class for object that perform transformations on an alpha-channel mask befor...
Definition: SkMaskFilter.h:44
virtual SkMask::Format getFormat() const =0
Returns the format of the resulting mask that this subclass will return when its filterMask() method ...
Format
Definition: SkMask.h:22
Definition: SkWriteBuffer.h:26
SkIPoint holds two 32 bit integer coordinates.
Definition: SkPoint.h:40
Definition: SkEmbossMaskFilter.h:19