| 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_SKIA_OPERATIONS_H_ | 5 #ifndef UI_GFX_IMAGE_SKIA_OPERATIONS_H_ |
| 6 #define UI_GFX_IMAGE_SKIA_OPERATIONS_H_ | 6 #define UI_GFX_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/color_utils.h" | 10 #include "ui/gfx/color_utils.h" |
| 11 #include "ui/gfx/shadow_value.h" | 11 #include "ui/gfx/shadow_value.h" |
| 12 | 12 |
| 13 namespace gfx { | 13 namespace gfx { |
| 14 class ImageSkia; | 14 class ImageSkia; |
| 15 class Rect; | 15 class Rect; |
| 16 class Size; | 16 class Size; |
| 17 | 17 |
| 18 class UI_EXPORT ImageSkiaOperations { | 18 class UI_EXPORT ImageSkiaOperations { |
| 19 public: | 19 public: |
| 20 // Create an image that is a blend of two others. The alpha argument | 20 // Create an image that is a blend of two others. The alpha argument |
| 21 // specifies the opacity of the second imag. The provided image must | 21 // specifies the opacity of the second imag. The provided image must |
| 22 // use the kARGB_8888_Config config and be of equal dimensions. | 22 // use the kARGB_8888_Config config and be of equal dimensions. |
| 23 static ImageSkia CreateBlendedImage(const ImageSkia& first, | 23 static ImageSkia CreateBlendedImage(const ImageSkia& first, |
| 24 const ImageSkia& second, | 24 const ImageSkia& second, |
| 25 double alpha); | 25 double alpha); |
| 26 | 26 |
| 27 // Creates an image that is the original image with opacity set to |alpha|. |
| 28 static ImageSkia CreateTransparentImage(const ImageSkia& image, double alpha); |
| 29 |
| 30 // Creates new image by painting first and second image respectively. |
| 31 // The second image is centered in respect to the first image. |
| 32 static ImageSkia CreateSuperimposedImage(const ImageSkia& first, |
| 33 const ImageSkia& second); |
| 34 |
| 27 // Create an image that is the original image masked out by the mask defined | 35 // Create an image that is the original image masked out by the mask defined |
| 28 // in the alpha image. The images must use the kARGB_8888_Config config and | 36 // in the alpha image. The images must use the kARGB_8888_Config config and |
| 29 // be of equal dimensions. | 37 // be of equal dimensions. |
| 30 static ImageSkia CreateMaskedImage(const ImageSkia& first, | 38 static ImageSkia CreateMaskedImage(const ImageSkia& first, |
| 31 const ImageSkia& alpha); | 39 const ImageSkia& alpha); |
| 32 | 40 |
| 33 // Create an image that is cropped from another image. This is special | 41 // Create an image that is cropped from another image. This is special |
| 34 // because it tiles the original image, so your coordinates can extend | 42 // because it tiles the original image, so your coordinates can extend |
| 35 // outside the bounds of the original image. | 43 // outside the bounds of the original image. |
| 36 static ImageSkia CreateTiledImage(const ImageSkia& image, | 44 static ImageSkia CreateTiledImage(const ImageSkia& image, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 static ImageSkia CreateImageWithDropShadow(const ImageSkia& source, | 85 static ImageSkia CreateImageWithDropShadow(const ImageSkia& source, |
| 78 const ShadowValues& shadows); | 86 const ShadowValues& shadows); |
| 79 | 87 |
| 80 private: | 88 private: |
| 81 ImageSkiaOperations(); // Class for scoping only. | 89 ImageSkiaOperations(); // Class for scoping only. |
| 82 }; | 90 }; |
| 83 | 91 |
| 84 } // namespace gfx | 92 } // namespace gfx |
| 85 | 93 |
| 86 #endif // UI_GFX_IMAGE_IMAGE_SKIA_OPERATIONS_H_ | 94 #endif // UI_GFX_IMAGE_IMAGE_SKIA_OPERATIONS_H_ |
| OLD | NEW |