| 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_SKBITMAP_OPERATIONS_H_ | 5 #ifndef UI_GFX_SKBITMAP_OPERATIONS_H_ |
| 6 #define UI_GFX_SKBITMAP_OPERATIONS_H_ | 6 #define UI_GFX_SKBITMAP_OPERATIONS_H_ |
| 7 | 7 |
| 8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
| 9 #include "ui/gfx/color_utils.h" | 9 #include "ui/gfx/color_utils.h" |
| 10 #include "ui/gfx/gfx_export.h" | 10 #include "ui/gfx/gfx_export.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 93 |
| 94 // Unpremultiplies all pixels in |bitmap|. You almost never want to call | 94 // Unpremultiplies all pixels in |bitmap|. You almost never want to call |
| 95 // this, as |SkBitmap|s are always premultiplied by conversion. Call this | 95 // this, as |SkBitmap|s are always premultiplied by conversion. Call this |
| 96 // only if you will pass the bitmap's data into a system function that | 96 // only if you will pass the bitmap's data into a system function that |
| 97 // doesn't expect premultiplied colors. | 97 // doesn't expect premultiplied colors. |
| 98 static SkBitmap UnPreMultiply(const SkBitmap& bitmap); | 98 static SkBitmap UnPreMultiply(const SkBitmap& bitmap); |
| 99 | 99 |
| 100 // Transpose the pixels in |bitmap| by swapping x and y. | 100 // Transpose the pixels in |bitmap| by swapping x and y. |
| 101 static SkBitmap CreateTransposedBitmap(const SkBitmap& bitmap); | 101 static SkBitmap CreateTransposedBitmap(const SkBitmap& bitmap); |
| 102 | 102 |
| 103 // Mirror the pixels in |bitmap|. |
| 104 static SkBitmap CreateMirroredBitmap(const SkBitmap& bitmap); |
| 105 |
| 103 // Create a bitmap by combining alpha channel of |bitmap| and color |c|. | 106 // Create a bitmap by combining alpha channel of |bitmap| and color |c|. |
| 104 // The image must use the kARGB_8888_Config config. | 107 // The image must use the kARGB_8888_Config config. |
| 105 static SkBitmap CreateColorMask(const SkBitmap& bitmap, SkColor c); | 108 static SkBitmap CreateColorMask(const SkBitmap& bitmap, SkColor c); |
| 106 | 109 |
| 107 // Create a bitmap with drop shadow added to |bitmap|. |shadows| defines | 110 // Create a bitmap with drop shadow added to |bitmap|. |shadows| defines |
| 108 // the shadows to add. The created bitmap would be padded to have enough space | 111 // the shadows to add. The created bitmap would be padded to have enough space |
| 109 // for shadows and have original bitmap in the center. The image must use the | 112 // for shadows and have original bitmap in the center. The image must use the |
| 110 // kARGB_8888_Config config. | 113 // kARGB_8888_Config config. |
| 111 static SkBitmap CreateDropShadow(const SkBitmap& bitmap, | 114 static SkBitmap CreateDropShadow(const SkBitmap& bitmap, |
| 112 const gfx::ShadowValues& shadows); | 115 const gfx::ShadowValues& shadows); |
| 113 | 116 |
| 114 // Rotates the given source bitmap clockwise by the requested amount. | 117 // Rotates the given source bitmap clockwise by the requested amount. |
| 115 static SkBitmap Rotate(const SkBitmap& source, RotationAmount rotation); | 118 static SkBitmap Rotate(const SkBitmap& source, RotationAmount rotation); |
| 116 | 119 |
| 117 private: | 120 private: |
| 118 SkBitmapOperations(); // Class for scoping only. | 121 SkBitmapOperations(); // Class for scoping only. |
| 119 | 122 |
| 120 FRIEND_TEST_ALL_PREFIXES(SkBitmapOperationsTest, DownsampleByTwo); | 123 FRIEND_TEST_ALL_PREFIXES(SkBitmapOperationsTest, DownsampleByTwo); |
| 121 FRIEND_TEST_ALL_PREFIXES(SkBitmapOperationsTest, DownsampleByTwoSmall); | 124 FRIEND_TEST_ALL_PREFIXES(SkBitmapOperationsTest, DownsampleByTwoSmall); |
| 122 }; | 125 }; |
| 123 | 126 |
| 124 #endif // UI_GFX_SKBITMAP_OPERATIONS_H_ | 127 #endif // UI_GFX_SKBITMAP_OPERATIONS_H_ |
| OLD | NEW |