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 #ifndef SkLightingImageFilter_DEFINED | 8 #ifndef SkLightingImageFilter_DEFINED |
9 #define SkLightingImageFilter_DEFINED | 9 #define SkLightingImageFilter_DEFINED |
10 | 10 |
11 #include "SkImageFilter.h" | 11 #include "SkImageFilter.h" |
12 #include "SkColor.h" | 12 #include "SkColor.h" |
13 | 13 |
14 | 14 |
15 class SkLight; | 15 class SkImageFilterLight; |
16 struct SkPoint3; | 16 struct SkPoint3; |
17 | 17 |
18 class SK_API SkLightingImageFilter : public SkImageFilter { | 18 class SK_API SkLightingImageFilter : public SkImageFilter { |
19 public: | 19 public: |
20 static SkImageFilter* CreateDistantLitDiffuse(const SkPoint3& direction, | 20 static SkImageFilter* CreateDistantLitDiffuse(const SkPoint3& direction, |
21 SkColor lightColor, SkScalar surfaceScale, SkScalar kd, | 21 SkColor lightColor, SkScalar surfaceScale, SkScalar kd, |
22 SkImageFilter* input = NULL, const CropRect* cropRect = NULL); | 22 SkImageFilter* input = NULL, const CropRect* cropRect = NULL); |
23 static SkImageFilter* CreatePointLitDiffuse(const SkPoint3& location, | 23 static SkImageFilter* CreatePointLitDiffuse(const SkPoint3& location, |
24 SkColor lightColor, SkScalar surfaceScale, SkScalar kd, | 24 SkColor lightColor, SkScalar surfaceScale, SkScalar kd, |
25 SkImageFilter* input = NULL, const CropRect* cropRect = NULL); | 25 SkImageFilter* input = NULL, const CropRect* cropRect = NULL); |
26 static SkImageFilter* CreateSpotLitDiffuse(const SkPoint3& location, | 26 static SkImageFilter* CreateSpotLitDiffuse(const SkPoint3& location, |
27 const SkPoint3& target, SkScalar specularExponent, SkScalar cutoffAngle, | 27 const SkPoint3& target, SkScalar specularExponent, SkScalar cutoffAngle, |
28 SkColor lightColor, SkScalar surfaceScale, SkScalar kd, | 28 SkColor lightColor, SkScalar surfaceScale, SkScalar kd, |
29 SkImageFilter* input = NULL, const CropRect* cropRect = NULL); | 29 SkImageFilter* input = NULL, const CropRect* cropRect = NULL); |
30 static SkImageFilter* CreateDistantLitSpecular(const SkPoint3& direction, | 30 static SkImageFilter* CreateDistantLitSpecular(const SkPoint3& direction, |
31 SkColor lightColor, SkScalar surfaceScale, SkScalar ks, | 31 SkColor lightColor, SkScalar surfaceScale, SkScalar ks, |
32 SkScalar shininess, SkImageFilter* input = NULL, const CropRect* cropRec
t = NULL); | 32 SkScalar shininess, SkImageFilter* input = NULL, const CropRect* cropRec
t = NULL); |
33 static SkImageFilter* CreatePointLitSpecular(const SkPoint3& location, | 33 static SkImageFilter* CreatePointLitSpecular(const SkPoint3& location, |
34 SkColor lightColor, SkScalar surfaceScale, SkScalar ks, | 34 SkColor lightColor, SkScalar surfaceScale, SkScalar ks, |
35 SkScalar shininess, SkImageFilter* input = NULL, const CropRect* cropRec
t = NULL); | 35 SkScalar shininess, SkImageFilter* input = NULL, const CropRect* cropRec
t = NULL); |
36 static SkImageFilter* CreateSpotLitSpecular(const SkPoint3& location, | 36 static SkImageFilter* CreateSpotLitSpecular(const SkPoint3& location, |
37 const SkPoint3& target, SkScalar specularExponent, SkScalar cutoffAngle, | 37 const SkPoint3& target, SkScalar specularExponent, SkScalar cutoffAngle, |
38 SkColor lightColor, SkScalar surfaceScale, SkScalar ks, | 38 SkColor lightColor, SkScalar surfaceScale, SkScalar ks, |
39 SkScalar shininess, SkImageFilter* input = NULL, const CropRect* cropRec
t = NULL); | 39 SkScalar shininess, SkImageFilter* input = NULL, const CropRect* cropRec
t = NULL); |
40 ~SkLightingImageFilter(); | 40 ~SkLightingImageFilter(); |
41 | 41 |
42 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() | 42 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() |
43 | 43 |
44 protected: | 44 protected: |
45 SkLightingImageFilter(SkLight* light, | 45 SkLightingImageFilter(SkImageFilterLight* light, |
46 SkScalar surfaceScale, | 46 SkScalar surfaceScale, |
47 SkImageFilter* input, | 47 SkImageFilter* input, |
48 const CropRect* cropRect); | 48 const CropRect* cropRect); |
49 void flatten(SkWriteBuffer&) const override; | 49 void flatten(SkWriteBuffer&) const override; |
50 const SkLight* light() const { return fLight.get(); } | 50 const SkImageFilterLight* light() const { return fLight.get(); } |
51 SkScalar surfaceScale() const { return fSurfaceScale; } | 51 SkScalar surfaceScale() const { return fSurfaceScale; } |
52 | 52 |
53 private: | 53 private: |
54 typedef SkImageFilter INHERITED; | 54 typedef SkImageFilter INHERITED; |
55 SkAutoTUnref<SkLight> fLight; | 55 SkAutoTUnref<SkImageFilterLight> fLight; |
56 SkScalar fSurfaceScale; | 56 SkScalar fSurfaceScale; |
57 }; | 57 }; |
58 | 58 |
59 #endif | 59 #endif |
OLD | NEW |