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_IMAGESKIA_OPERATIONS_H_ | 5 #ifndef UI_GFX_IMAGE_IMAGE_SKIA_OPERATIONS_H_ |
6 #define UI_GFX_IMAGESKIA_OPERATIONS_H_ | 6 #define UI_GFX_IMAGE_IMAGE_SKIA_OPERATIONS_H_ |
7 | 7 |
8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
9 #include "ui/base/ui_export.h" | 9 #include "ui/base/ui_export.h" |
| 10 #include "ui/gfx/shadow_value.h" |
10 | 11 |
11 namespace gfx { | 12 namespace gfx { |
12 class ImageSkia; | 13 class ImageSkia; |
| 14 class Size; |
13 | 15 |
14 class UI_EXPORT ImageSkiaOperations { | 16 class UI_EXPORT ImageSkiaOperations { |
15 public: | 17 public: |
16 // Create an image that is a blend of two others. The alpha argument | 18 // Create an image that is a blend of two others. The alpha argument |
17 // specifies the opacity of the second imag. The provided image must | 19 // specifies the opacity of the second imag. The provided image must |
18 // use the kARGB_8888_Config config and be of equal dimensions. | 20 // use the kARGB_8888_Config config and be of equal dimensions. |
19 static ImageSkia CreateBlendedImage(const ImageSkia& first, | 21 static ImageSkia CreateBlendedImage(const ImageSkia& first, |
20 const ImageSkia& second, | 22 const ImageSkia& second, |
21 double alpha); | 23 double alpha); |
22 | 24 |
23 // Create an image that is the original image masked out by the mask defined | 25 // Create an image that is the original image masked out by the mask defined |
24 // in the alpha image. The images must use the kARGB_8888_Config config and | 26 // in the alpha image. The images must use the kARGB_8888_Config config and |
25 // be of equal dimensions. | 27 // be of equal dimensions. |
26 static ImageSkia CreateMaskedImage(const ImageSkia& first, | 28 static ImageSkia CreateMaskedImage(const ImageSkia& first, |
27 const ImageSkia& alpha); | 29 const ImageSkia& alpha); |
28 | 30 |
29 // Create an image that is cropped from another image. This is special | 31 // Create an image that is cropped from another image. This is special |
30 // because it tiles the original image, so your coordinates can extend | 32 // because it tiles the original image, so your coordinates can extend |
31 // outside the bounds of the original image. | 33 // outside the bounds of the original image. |
32 static ImageSkia CreateTiledImage(const ImageSkia& image, | 34 static ImageSkia CreateTiledImage(const ImageSkia& image, |
33 int src_x, int src_y, | 35 int src_x, int src_y, |
34 int dst_w, int dst_h); | 36 int dst_w, int dst_h); |
35 | 37 |
| 38 // Creates an image by resizing |source| to given |target_dip_size|. |
| 39 static ImageSkia CreateResizedImage(const ImageSkia& source, |
| 40 const Size& target_dip_size); |
| 41 |
| 42 // Creates an image with drop shadow defined in |shadows| for |source|. |
| 43 static ImageSkia CreateImageWithDropShadow(const ImageSkia& source, |
| 44 const ShadowValues& shadows); |
| 45 |
36 private: | 46 private: |
37 ImageSkiaOperations(); // Class for scoping only. | 47 ImageSkiaOperations(); // Class for scoping only. |
38 }; | 48 }; |
39 | 49 |
40 } | 50 } |
41 | 51 |
42 #endif // UI_GFX_IMAGESKIA_OPERATIONS_H_ | 52 #endif // UI_GFX_IMAGE_IMAGE_SKIA_OPERATIONS_H_ |
OLD | NEW |