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_IMAGE_IMAGE_SKIA_OPERATIONS_H_ | 5 #ifndef UI_GFX_IMAGE_IMAGE_SKIA_OPERATIONS_H_ |
6 #define UI_GFX_IMAGE_IMAGE_SKIA_OPERATIONS_H_ | 6 #define UI_GFX_IMAGE_IMAGE_SKIA_OPERATIONS_H_ |
7 | 7 |
8 #include "skia/ext/image_operations.h" | 8 #include "skia/ext/image_operations.h" |
9 #include "third_party/skia/include/core/SkDrawLooper.h" | 9 #include "third_party/skia/include/core/SkDrawLooper.h" |
10 #include "third_party/skia/include/core/SkPaint.h" | 10 #include "third_party/skia/include/core/SkPaint.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 // Creates an image by resizing |source| to given |target_dip_size|. | 84 // Creates an image by resizing |source| to given |target_dip_size|. |
85 static ImageSkia CreateResizedImage(const ImageSkia& source, | 85 static ImageSkia CreateResizedImage(const ImageSkia& source, |
86 skia::ImageOperations::ResizeMethod methd, | 86 skia::ImageOperations::ResizeMethod methd, |
87 const Size& target_dip_size); | 87 const Size& target_dip_size); |
88 | 88 |
89 // Creates an image with drop shadow defined in |shadows| for |source|. | 89 // Creates an image with drop shadow defined in |shadows| for |source|. |
90 static ImageSkia CreateImageWithDropShadow(const ImageSkia& source, | 90 static ImageSkia CreateImageWithDropShadow(const ImageSkia& source, |
91 const ShadowValues& shadows); | 91 const ShadowValues& shadows); |
92 | 92 |
93 // Creates an image with the given shadows painted around a round rect with | |
94 // the given corner radius. The image will be just large enough to paint the | |
95 // shadows appropriately with a 1px square region reserved for "content". | |
96 static ImageSkia CreateShadowNinebox(const ShadowValues& shadows, | |
97 float corner_radius); | |
98 | |
99 // Creates an image that is 1dp wide, suitable for tiling horizontally to | 93 // Creates an image that is 1dp wide, suitable for tiling horizontally to |
100 // create a drop shadow effect. The purpose of tiling a static image is to | 94 // create a drop shadow effect. The purpose of tiling a static image is to |
101 // avoid repeatedly asking Skia to draw a shadow. | 95 // avoid repeatedly asking Skia to draw a shadow. |
102 static ImageSkia CreateHorizontalShadow( | 96 static ImageSkia CreateHorizontalShadow( |
103 const std::vector<ShadowValue>& shadows, | 97 const std::vector<ShadowValue>& shadows, |
104 bool fades_down); | 98 bool fades_down); |
105 | 99 |
106 // Creates an image which is a rotation of the |source|. |rotation| is the | 100 // Creates an image which is a rotation of the |source|. |rotation| is the |
107 // amount of clockwise rotation in degrees. | 101 // amount of clockwise rotation in degrees. |
108 static ImageSkia CreateRotatedImage( | 102 static ImageSkia CreateRotatedImage( |
109 const ImageSkia& source, | 103 const ImageSkia& source, |
110 SkBitmapOperations::RotationAmount rotation); | 104 SkBitmapOperations::RotationAmount rotation); |
111 | 105 |
112 // Creates an icon by painting the second icon as a badge to the first one. | 106 // Creates an icon by painting the second icon as a badge to the first one. |
113 // The second icon is in the right corner of the first icon. If the icon | 107 // The second icon is in the right corner of the first icon. If the icon |
114 // is valid and the badge is not, the icon will be returned. | 108 // is valid and the badge is not, the icon will be returned. |
115 static ImageSkia CreateIconWithBadge(const ImageSkia& icon, | 109 static ImageSkia CreateIconWithBadge(const ImageSkia& icon, |
116 const ImageSkia& badge); | 110 const ImageSkia& badge); |
117 | 111 |
118 private: | 112 private: |
119 ImageSkiaOperations(); // Class for scoping only. | 113 ImageSkiaOperations(); // Class for scoping only. |
120 }; | 114 }; |
121 | 115 |
122 } // namespace gfx | 116 } // namespace gfx |
123 | 117 |
124 #endif // UI_GFX_IMAGE_IMAGE_SKIA_OPERATIONS_H_ | 118 #endif // UI_GFX_IMAGE_IMAGE_SKIA_OPERATIONS_H_ |
OLD | NEW |