OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The Android Open Source Project | 2 * Copyright 2012 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 | 8 |
9 #ifndef SkLightingImageFilter_DEFINED | 9 #ifndef SkLightingImageFilter_DEFINED |
10 #define SkLightingImageFilter_DEFINED | 10 #define SkLightingImageFilter_DEFINED |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 } | 42 } |
43 bool operator==(const SkPoint3& other) const { | 43 bool operator==(const SkPoint3& other) const { |
44 return fX == other.fX && fY == other.fY && fZ == other.fZ; | 44 return fX == other.fX && fY == other.fY && fZ == other.fZ; |
45 } | 45 } |
46 SkScalar fX, fY, fZ; | 46 SkScalar fX, fY, fZ; |
47 }; | 47 }; |
48 | 48 |
49 class SkLight; | 49 class SkLight; |
50 | 50 |
51 class SK_API SkLightingImageFilter : public SkImageFilter { | 51 class SK_API SkLightingImageFilter : public SkImageFilter { |
| 52 typedef SkImageFilter INHERITED; |
| 53 |
52 public: | 54 public: |
53 static SkImageFilter* CreateDistantLitDiffuse(const SkPoint3& direction, | 55 static SkImageFilter* CreateDistantLitDiffuse(const SkPoint3& direction, |
54 SkColor lightColor, SkScalar surfaceScale, SkScalar kd, | 56 SkColor lightColor, SkScalar surfaceScale, SkScalar kd, |
55 SkImageFilter* input = NULL, const SkIRect* cropRect = NULL); | 57 SkImageFilter* input = NULL, const SkIRect* cropRect = NULL); |
56 static SkImageFilter* CreatePointLitDiffuse(const SkPoint3& location, | 58 static SkImageFilter* CreatePointLitDiffuse(const SkPoint3& location, |
57 SkColor lightColor, SkScalar surfaceScale, SkScalar kd, | 59 SkColor lightColor, SkScalar surfaceScale, SkScalar kd, |
58 SkImageFilter* input = NULL, const SkIRect* cropRect = NULL); | 60 SkImageFilter* input = NULL, const SkIRect* cropRect = NULL); |
59 static SkImageFilter* CreateSpotLitDiffuse(const SkPoint3& location, | 61 static SkImageFilter* CreateSpotLitDiffuse(const SkPoint3& location, |
60 const SkPoint3& target, SkScalar specularExponent, SkScalar cutoffAngle, | 62 const SkPoint3& target, SkScalar specularExponent, SkScalar cutoffAngle, |
61 SkColor lightColor, SkScalar surfaceScale, SkScalar kd, | 63 SkColor lightColor, SkScalar surfaceScale, SkScalar kd, |
62 SkImageFilter* input = NULL, const SkIRect* cropRect = NULL); | 64 SkImageFilter* input = NULL, const SkIRect* cropRect = NULL); |
63 static SkImageFilter* CreateDistantLitSpecular(const SkPoint3& direction, | 65 static SkImageFilter* CreateDistantLitSpecular(const SkPoint3& direction, |
64 SkColor lightColor, SkScalar surfaceScale, SkScalar ks, | 66 SkColor lightColor, SkScalar surfaceScale, SkScalar ks, |
65 SkScalar shininess, SkImageFilter* input = NULL, const SkIRect* cropRect
= NULL); | 67 SkScalar shininess, SkImageFilter* input = NULL, const SkIRect* cropRect
= NULL); |
66 static SkImageFilter* CreatePointLitSpecular(const SkPoint3& location, | 68 static SkImageFilter* CreatePointLitSpecular(const SkPoint3& location, |
67 SkColor lightColor, SkScalar surfaceScale, SkScalar ks, | 69 SkColor lightColor, SkScalar surfaceScale, SkScalar ks, |
68 SkScalar shininess, SkImageFilter* input = NULL, const SkIRect* cropRect
= NULL); | 70 SkScalar shininess, SkImageFilter* input = NULL, const SkIRect* cropRect
= NULL); |
69 static SkImageFilter* CreateSpotLitSpecular(const SkPoint3& location, | 71 static SkImageFilter* CreateSpotLitSpecular(const SkPoint3& location, |
70 const SkPoint3& target, SkScalar specularExponent, SkScalar cutoffAngle, | 72 const SkPoint3& target, SkScalar specularExponent, SkScalar cutoffAngle, |
71 SkColor lightColor, SkScalar surfaceScale, SkScalar ks, | 73 SkColor lightColor, SkScalar surfaceScale, SkScalar ks, |
72 SkScalar shininess, SkImageFilter* input = NULL, const SkIRect* cropRect
= NULL); | 74 SkScalar shininess, SkImageFilter* input = NULL, const SkIRect* cropRect
= NULL); |
73 ~SkLightingImageFilter(); | 75 ~SkLightingImageFilter(); |
74 | 76 |
75 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() | 77 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() |
| 78 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_UTILS() |
76 | 79 |
77 protected: | 80 protected: |
78 SkLightingImageFilter(SkLight* light, | 81 SkLightingImageFilter(SkLight* light, |
79 SkScalar surfaceScale, | 82 SkScalar surfaceScale, |
80 SkImageFilter* input, | 83 SkImageFilter* input, |
81 const SkIRect* cropRect = NULL); | 84 const SkIRect* cropRect = NULL); |
82 explicit SkLightingImageFilter(SkFlattenableReadBuffer& buffer); | 85 explicit SkLightingImageFilter(SkFlattenableReadBuffer& buffer); |
83 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; | 86 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; |
84 const SkLight* light() const { return fLight; } | 87 const SkLight* light() const { return fLight; } |
85 SkScalar surfaceScale() const { return fSurfaceScale; } | 88 SkScalar surfaceScale() const { return fSurfaceScale; } |
86 | 89 |
87 private: | 90 private: |
88 typedef SkImageFilter INHERITED; | |
89 SkLight* fLight; | 91 SkLight* fLight; |
90 SkScalar fSurfaceScale; | 92 SkScalar fSurfaceScale; |
91 }; | 93 }; |
92 | 94 |
93 #endif | 95 #endif |
OLD | NEW |