Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Side by Side Diff: ui/gfx/shadow_value.h

Issue 854713003: More old files deletion. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fix tryjobs? Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/gfx/selection_model.cc ('k') | ui/gfx/shadow_value.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef UI_GFX_SHADOW_VALUE_H_
6 #define UI_GFX_SHADOW_VALUE_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "third_party/skia/include/core/SkColor.h"
12 #include "ui/gfx/gfx_export.h"
13 #include "ui/gfx/point.h"
14
15 namespace gfx {
16
17 class Insets;
18
19 class ShadowValue;
20 typedef std::vector<ShadowValue> ShadowValues;
21
22 // ShadowValue encapsulates parameters needed to define a shadow, including the
23 // shadow's offset, blur amount and color.
24 class GFX_EXPORT ShadowValue {
25 public:
26 ShadowValue();
27 ShadowValue(const gfx::Point& offset, double blur, SkColor color);
28 ~ShadowValue();
29
30 int x() const { return offset_.x(); }
31 int y() const { return offset_.y(); }
32 const gfx::Point& offset() const { return offset_; }
33 double blur() const { return blur_; }
34 SkColor color() const { return color_; }
35
36 ShadowValue Scale(float scale) const;
37
38 std::string ToString() const;
39
40 // Gets margin space needed for shadows. Note that values in returned Insets
41 // are negative because shadow margins are outside a boundary.
42 static Insets GetMargin(const ShadowValues& shadows);
43
44 private:
45 gfx::Point offset_;
46
47 // Blur amount of the shadow in pixels. If underlying implementation supports
48 // (e.g. Skia), it can have fraction part such as 0.5 pixel. The value
49 // defines a range from full shadow color at the start point inside the
50 // shadow to fully transparent at the end point outside it. The range is
51 // perpendicular to and centered on the shadow edge. For example, a blur
52 // amount of 4.0 means to have a blurry shadow edge of 4 pixels that
53 // transitions from full shadow color to fully transparent and with 2 pixels
54 // inside the shadow and 2 pixels goes beyond the edge.
55 double blur_;
56
57 SkColor color_;
58 };
59
60 } // namespace gfx
61
62 #endif // UI_GFX_SHADOW_VALUE_H_
OLDNEW
« no previous file with comments | « ui/gfx/selection_model.cc ('k') | ui/gfx/shadow_value.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698