OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_GFX_SHADOW_VALUE_H_ | 5 #ifndef UI_GFX_SHADOW_VALUE_H_ |
6 #define UI_GFX_SHADOW_VALUE_H_ | 6 #define UI_GFX_SHADOW_VALUE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 ShadowValue(); | 26 ShadowValue(); |
27 ShadowValue(const gfx::Point& offset, double blur, SkColor color); | 27 ShadowValue(const gfx::Point& offset, double blur, SkColor color); |
28 ~ShadowValue(); | 28 ~ShadowValue(); |
29 | 29 |
30 int x() const { return offset_.x(); } | 30 int x() const { return offset_.x(); } |
31 int y() const { return offset_.y(); } | 31 int y() const { return offset_.y(); } |
32 const gfx::Point& offset() const { return offset_; } | 32 const gfx::Point& offset() const { return offset_; } |
33 double blur() const { return blur_; } | 33 double blur() const { return blur_; } |
34 SkColor color() const { return color_; } | 34 SkColor color() const { return color_; } |
35 | 35 |
| 36 ShadowValue Scale(float scale) const; |
| 37 |
36 std::string ToString() const; | 38 std::string ToString() const; |
37 | 39 |
38 // Gets margin space needed for shadows. Note that values in returned Insets | 40 // Gets margin space needed for shadows. Note that values in returned Insets |
39 // are negative because shadow margins are outside a boundary. | 41 // are negative because shadow margins are outside a boundary. |
40 static Insets GetMargin(const ShadowValues& shadows); | 42 static Insets GetMargin(const ShadowValues& shadows); |
41 | 43 |
42 private: | 44 private: |
43 gfx::Point offset_; | 45 gfx::Point offset_; |
44 | 46 |
45 // Blur amount of the shadow in pixels. If underlying implementation supports | 47 // Blur amount of the shadow in pixels. If underlying implementation supports |
46 // (e.g. Skia), it can have fraction part such as 0.5 pixel. The value | 48 // (e.g. Skia), it can have fraction part such as 0.5 pixel. The value |
47 // defines a range from full shadow color at the start point inside the | 49 // defines a range from full shadow color at the start point inside the |
48 // shadow to fully transparent at the end point outside it. The range is | 50 // shadow to fully transparent at the end point outside it. The range is |
49 // perpendicular to and centered on the shadow edge. For example, a blur | 51 // perpendicular to and centered on the shadow edge. For example, a blur |
50 // amount of 4.0 means to have a blurry shadow edge of 4 pixels that | 52 // amount of 4.0 means to have a blurry shadow edge of 4 pixels that |
51 // transitions from full shadow color to fully transparent and with 2 pixels | 53 // transitions from full shadow color to fully transparent and with 2 pixels |
52 // inside the shadow and 2 pixels goes beyond the edge. | 54 // inside the shadow and 2 pixels goes beyond the edge. |
53 double blur_; | 55 double blur_; |
54 | 56 |
55 SkColor color_; | 57 SkColor color_; |
56 }; | 58 }; |
57 | 59 |
58 } // namespace gfx | 60 } // namespace gfx |
59 | 61 |
60 #endif // UI_GFX_SHADOW_VALUE_H_ | 62 #endif // UI_GFX_SHADOW_VALUE_H_ |
OLD | NEW |