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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 } | 44 } |
45 SkScalar fX, fY, fZ; | 45 SkScalar fX, fY, fZ; |
46 }; | 46 }; |
47 | 47 |
48 class SkLight; | 48 class SkLight; |
49 | 49 |
50 class SK_API SkLightingImageFilter : public SkImageFilter { | 50 class SK_API SkLightingImageFilter : public SkImageFilter { |
51 public: | 51 public: |
52 static SkImageFilter* CreateDistantLitDiffuse(const SkPoint3& direction, | 52 static SkImageFilter* CreateDistantLitDiffuse(const SkPoint3& direction, |
53 SkColor lightColor, SkScalar surfaceScale, SkScalar kd, | 53 SkColor lightColor, SkScalar surfaceScale, SkScalar kd, |
54 SkImageFilter* input = NULL); | 54 SkImageFilter* input = NULL, const SkIRect* cropRect = NULL); |
55 static SkImageFilter* CreatePointLitDiffuse(const SkPoint3& location, | 55 static SkImageFilter* CreatePointLitDiffuse(const SkPoint3& location, |
56 SkColor lightColor, SkScalar surfaceScale, SkScalar kd, | 56 SkColor lightColor, SkScalar surfaceScale, SkScalar kd, |
57 SkImageFilter* input = NULL); | 57 SkImageFilter* input = NULL, const SkIRect* cropRect = NULL); |
58 static SkImageFilter* CreateSpotLitDiffuse(const SkPoint3& location, | 58 static SkImageFilter* CreateSpotLitDiffuse(const SkPoint3& location, |
59 const SkPoint3& target, SkScalar specularExponent, SkScalar cutoffAngle, | 59 const SkPoint3& target, SkScalar specularExponent, SkScalar cutoffAngle, |
60 SkColor lightColor, SkScalar surfaceScale, SkScalar kd, | 60 SkColor lightColor, SkScalar surfaceScale, SkScalar kd, |
61 SkImageFilter* input = NULL); | 61 SkImageFilter* input = NULL, const SkIRect* cropRect = NULL); |
62 static SkImageFilter* CreateDistantLitSpecular(const SkPoint3& direction, | 62 static SkImageFilter* CreateDistantLitSpecular(const SkPoint3& direction, |
63 SkColor lightColor, SkScalar surfaceScale, SkScalar ks, | 63 SkColor lightColor, SkScalar surfaceScale, SkScalar ks, |
64 SkScalar shininess, SkImageFilter* input = NULL); | 64 SkScalar shininess, SkImageFilter* input = NULL, const SkIRect* cropRect
= NULL); |
65 static SkImageFilter* CreatePointLitSpecular(const SkPoint3& location, | 65 static SkImageFilter* CreatePointLitSpecular(const SkPoint3& location, |
66 SkColor lightColor, SkScalar surfaceScale, SkScalar ks, | 66 SkColor lightColor, SkScalar surfaceScale, SkScalar ks, |
67 SkScalar shininess, SkImageFilter* input = NULL); | 67 SkScalar shininess, SkImageFilter* input = NULL, const SkIRect* cropRect
= NULL); |
68 static SkImageFilter* CreateSpotLitSpecular(const SkPoint3& location, | 68 static SkImageFilter* CreateSpotLitSpecular(const SkPoint3& location, |
69 const SkPoint3& target, SkScalar specularExponent, SkScalar cutoffAngle, | 69 const SkPoint3& target, SkScalar specularExponent, SkScalar cutoffAngle, |
70 SkColor lightColor, SkScalar surfaceScale, SkScalar ks, | 70 SkColor lightColor, SkScalar surfaceScale, SkScalar ks, |
71 SkScalar shininess, SkImageFilter* input = NULL); | 71 SkScalar shininess, SkImageFilter* input = NULL, const SkIRect* cropRect
= NULL); |
72 ~SkLightingImageFilter(); | 72 ~SkLightingImageFilter(); |
73 | 73 |
74 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() | 74 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() |
75 | 75 |
76 protected: | 76 protected: |
77 SkLightingImageFilter(SkLight* light, SkScalar surfaceScale, SkImageFilter*
input); | 77 SkLightingImageFilter(SkLight* light, |
| 78 SkScalar surfaceScale, |
| 79 SkImageFilter* input, |
| 80 const SkIRect* cropRect = NULL); |
78 explicit SkLightingImageFilter(SkFlattenableReadBuffer& buffer); | 81 explicit SkLightingImageFilter(SkFlattenableReadBuffer& buffer); |
79 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; | 82 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; |
80 const SkLight* light() const { return fLight; } | 83 const SkLight* light() const { return fLight; } |
81 SkScalar surfaceScale() const { return fSurfaceScale; } | 84 SkScalar surfaceScale() const { return fSurfaceScale; } |
82 | 85 |
83 private: | 86 private: |
84 typedef SkImageFilter INHERITED; | 87 typedef SkImageFilter INHERITED; |
85 SkLight* fLight; | 88 SkLight* fLight; |
86 SkScalar fSurfaceScale; | 89 SkScalar fSurfaceScale; |
87 }; | 90 }; |
88 | 91 |
89 #endif | 92 #endif |
OLD | NEW |