Skia
2DGraphicsLibrary
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SkLightingImageFilter.h
1 /*
2  * Copyright 2012 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 SkLightingImageFilter_DEFINED
9 #define SkLightingImageFilter_DEFINED
10 
11 #include "SkImageFilter.h"
12 #include "SkColor.h"
13 
14 
15 class SkImageFilterLight;
16 struct SkPoint3;
17 
18 class SK_API SkLightingImageFilter : public SkImageFilter {
19 public:
20  static sk_sp<SkImageFilter> MakeDistantLitDiffuse(const SkPoint3& direction,
21  SkColor lightColor, SkScalar surfaceScale, SkScalar kd,
22  sk_sp<SkImageFilter> input, const CropRect* cropRect = nullptr);
23  static sk_sp<SkImageFilter> MakePointLitDiffuse(const SkPoint3& location,
24  SkColor lightColor, SkScalar surfaceScale, SkScalar kd,
25  sk_sp<SkImageFilter> input, const CropRect* cropRect = nullptr);
26  static sk_sp<SkImageFilter> MakeSpotLitDiffuse(const SkPoint3& location,
27  const SkPoint3& target, SkScalar specularExponent, SkScalar cutoffAngle,
28  SkColor lightColor, SkScalar surfaceScale, SkScalar kd,
29  sk_sp<SkImageFilter> input, const CropRect* cropRect = nullptr);
30  static sk_sp<SkImageFilter> MakeDistantLitSpecular(const SkPoint3& direction,
31  SkColor lightColor, SkScalar surfaceScale, SkScalar ks,
32  SkScalar shininess, sk_sp<SkImageFilter> input, const CropRect* cropRect = nullptr);
33  static sk_sp<SkImageFilter> MakePointLitSpecular(const SkPoint3& location,
34  SkColor lightColor, SkScalar surfaceScale, SkScalar ks,
35  SkScalar shininess, sk_sp<SkImageFilter> input, const CropRect* cropRect = nullptr);
36  static sk_sp<SkImageFilter> MakeSpotLitSpecular(const SkPoint3& location,
37  const SkPoint3& target, SkScalar specularExponent, SkScalar cutoffAngle,
38  SkColor lightColor, SkScalar surfaceScale, SkScalar ks,
39  SkScalar shininess, sk_sp<SkImageFilter> input, const CropRect* cropRect = nullptr);
40  ~SkLightingImageFilter() override;
41 
42  SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
43 
44 protected:
46  SkScalar surfaceScale,
48  const CropRect* cropRect);
49  void flatten(SkWriteBuffer&) const override;
50  const SkImageFilterLight* light() const { return fLight.get(); }
51  SkScalar surfaceScale() const { return fSurfaceScale; }
52  bool affectsTransparentBlack() const override { return true; }
53 
54 private:
56  SkScalar fSurfaceScale;
57 
58  typedef SkImageFilter INHERITED;
59 };
60 
61 #endif
Definition: SkLightingImageFilter.h:18
Definition: SkImageFilter.h:76
Definition: SkPoint3.h:13
void flatten(SkWriteBuffer &) const override
Override this if your subclass needs to record data that it will need to recreate itself from its Cre...
Definition: SkRefCnt.h:125
Base class for image filters.
Definition: SkImageFilter.h:36
uint32_t SkColor
32 bit ARGB color value, not premultiplied.
Definition: SkColor.h:28
Definition: SkWriteBuffer.h:27
Types and macros for colors.