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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 16 matching lines...) Expand all Loading... | |
27 ShadowValue(); | 27 ShadowValue(); |
28 ShadowValue(const gfx::Point& offset, double blur, SkColor color); | 28 ShadowValue(const gfx::Point& offset, double blur, SkColor color); |
29 ~ShadowValue(); | 29 ~ShadowValue(); |
30 | 30 |
31 int x() const { return offset_.x(); } | 31 int x() const { return offset_.x(); } |
32 int y() const { return offset_.y(); } | 32 int y() const { return offset_.y(); } |
33 const gfx::Point& offset() const { return offset_; } | 33 const gfx::Point& offset() const { return offset_; } |
34 double blur() const { return blur_; } | 34 double blur() const { return blur_; } |
35 SkColor color() const { return color_; } | 35 SkColor color() const { return color_; } |
36 | 36 |
37 ShadowValue GetScaled(float scale) const; | |
pkotwicz
2012/07/02 23:34:01
Rename to Scale()
xiyuan
2012/07/03 22:16:00
Done.
| |
38 | |
37 std::string ToString() const; | 39 std::string ToString() const; |
38 | 40 |
39 // Gets margin space needed for shadows. Note that values in returned Insets | 41 // Gets margin space needed for shadows. Note that values in returned Insets |
40 // are negative because shadow margins are outside a boundary. | 42 // are negative because shadow margins are outside a boundary. |
41 static Insets GetMargin(const ShadowValues& shadows); | 43 static Insets GetMargin(const ShadowValues& shadows); |
42 | 44 |
43 private: | 45 private: |
44 gfx::Point offset_; | 46 gfx::Point offset_; |
45 | 47 |
46 // Blur amount of the shadow in pixels. If underlying implementation supports | 48 // Blur amount of the shadow in pixels. If underlying implementation supports |
47 // (e.g. Skia), it can have fraction part such as 0.5 pixel. The value | 49 // (e.g. Skia), it can have fraction part such as 0.5 pixel. The value |
48 // defines a range from full shadow color at the start point inside the | 50 // defines a range from full shadow color at the start point inside the |
49 // shadow to fully transparent at the end point outside it. The range is | 51 // shadow to fully transparent at the end point outside it. The range is |
50 // perpendicular to and centered on the shadow edge. For example, a blur | 52 // perpendicular to and centered on the shadow edge. For example, a blur |
51 // amount of 4.0 means to have a blurry shadow edge of 4 pixels that | 53 // amount of 4.0 means to have a blurry shadow edge of 4 pixels that |
52 // transitions from full shadow color to fully transparent and with 2 pixels | 54 // transitions from full shadow color to fully transparent and with 2 pixels |
53 // inside the shadow and 2 pixels goes beyond the edge. | 55 // inside the shadow and 2 pixels goes beyond the edge. |
54 double blur_; | 56 double blur_; |
55 | 57 |
56 SkColor color_; | 58 SkColor color_; |
57 }; | 59 }; |
58 | 60 |
59 } // namespace gfx | 61 } // namespace gfx |
60 | 62 |
61 #endif // UI_GFX_SHADOW_VALUE_H_ | 63 #endif // UI_GFX_SHADOW_VALUE_H_ |
OLD | NEW |