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

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

Issue 2251643011: Move Ash-specific vector icons to ash/common/resources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix sources again Created 4 years, 3 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 | « ash/resources/vector_icons/vector_icons.h.template ('k') | ui/gfx/paint_vector_icon.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_PAINT_VECTOR_ICON_H_ 5 #ifndef UI_GFX_PAINT_VECTOR_ICON_H_
6 #define UI_GFX_PAINT_VECTOR_ICON_H_ 6 #define UI_GFX_PAINT_VECTOR_ICON_H_
7 7
8 #include "third_party/skia/include/core/SkColor.h" 8 #include "third_party/skia/include/core/SkColor.h"
9 #include "ui/gfx/gfx_export.h" 9 #include "ui/gfx/gfx_export.h"
10 #include "ui/gfx/image/image_skia.h" 10 #include "ui/gfx/image/image_skia.h"
11 11
12 namespace gfx { 12 namespace gfx {
13 13
14 class Canvas; 14 class Canvas;
15 struct VectorIcon;
15 enum class VectorIconId; 16 enum class VectorIconId;
16 17
18 GFX_EXPORT extern const VectorIcon kNoneIcon;
19
17 // Draws a vector icon identified by |id| onto |canvas| at (0, 0). |dip_size| 20 // Draws a vector icon identified by |id| onto |canvas| at (0, 0). |dip_size|
18 // is the length of a single edge of the square icon, in device independent 21 // is the length of a single edge of the square icon, in device independent
19 // pixels. |color| is used as the fill. 22 // pixels. |color| is used as the fill.
20 GFX_EXPORT void PaintVectorIcon(Canvas* canvas, 23 GFX_EXPORT void PaintVectorIcon(Canvas* canvas,
21 VectorIconId id, 24 VectorIconId id,
22 int dip_size, 25 int dip_size,
23 SkColor color); 26 SkColor color);
27 GFX_EXPORT void PaintVectorIcon(Canvas* canvas,
28 const VectorIcon& icon,
29 int dip_size,
30 SkColor color);
24 31
25 // Creates an ImageSkia which will render the icon on demand. The size will come 32 // Creates an ImageSkia which will render the icon on demand. The size will come
26 // from the .icon file (the 1x version, if multiple versions exist). 33 // from the .icon file (the 1x version, if multiple versions exist).
27 GFX_EXPORT ImageSkia CreateVectorIcon(VectorIconId id, 34 GFX_EXPORT ImageSkia CreateVectorIcon(VectorIconId id,
28 SkColor color); 35 SkColor color);
36 GFX_EXPORT ImageSkia CreateVectorIcon(const VectorIcon& icon, SkColor color);
29 37
30 // As above, but creates the image at the given size. 38 // As above, but creates the image at the given size.
31 GFX_EXPORT ImageSkia CreateVectorIcon(VectorIconId id, 39 GFX_EXPORT ImageSkia CreateVectorIcon(VectorIconId id,
32 int dip_size, 40 int dip_size,
33 SkColor color); 41 SkColor color);
42 GFX_EXPORT ImageSkia CreateVectorIcon(const VectorIcon& icon,
43 int dip_size,
44 SkColor color);
34 45
35 // As above, but also paints a badge defined by |badge_id| on top of the icon. 46 // As above, but also paints a badge defined by |badge_id| on top of the icon.
36 // The badge uses the same canvas size and default color as the icon. 47 // The badge uses the same canvas size and default color as the icon.
37 GFX_EXPORT ImageSkia CreateVectorIconWithBadge(VectorIconId id, 48 GFX_EXPORT ImageSkia CreateVectorIconWithBadge(VectorIconId id,
38 int dip_size, 49 int dip_size,
39 SkColor color, 50 SkColor color,
40 VectorIconId badge_id); 51 VectorIconId badge_id);
52 GFX_EXPORT ImageSkia CreateVectorIconWithBadge(const VectorIcon& icon,
53 int dip_size,
54 SkColor color,
55 const VectorIcon& badge_icon);
41 56
42 #if defined(GFX_VECTOR_ICONS_UNSAFE) || defined(GFX_IMPLEMENTATION) 57 #if defined(GFX_VECTOR_ICONS_UNSAFE) || defined(GFX_IMPLEMENTATION)
43 // Takes a string of the format expected of .icon files and renders onto 58 // Takes a string of the format expected of .icon files and renders onto
44 // a canvas. This should only be used as a debugging aid and should never be 59 // a canvas. This should only be used as a debugging aid and should never be
45 // used in production code. 60 // used in production code.
46 GFX_EXPORT ImageSkia CreateVectorIconFromSource(const std::string& source, 61 GFX_EXPORT ImageSkia CreateVectorIconFromSource(const std::string& source,
47 int dip_size, 62 int dip_size,
48 SkColor color); 63 SkColor color);
49 #endif 64 #endif
50 65
51 } // namespace gfx 66 } // namespace gfx
52 67
53 #endif // UI_GFX_PAINT_VECTOR_ICON_H_ 68 #endif // UI_GFX_PAINT_VECTOR_ICON_H_
OLDNEW
« no previous file with comments | « ash/resources/vector_icons/vector_icons.h.template ('k') | ui/gfx/paint_vector_icon.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698