| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 SKIA_EXT_IMAGE_OPERATIONS_H_ | 5 #ifndef SKIA_EXT_IMAGE_OPERATIONS_H_ |
| 6 #define SKIA_EXT_IMAGE_OPERATIONS_H_ | 6 #define SKIA_EXT_IMAGE_OPERATIONS_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/gfx/rect.h" | 9 #include "base/gfx/rect.h" |
| 10 #include "skia/ext/skia_utils.h" | 10 #include "skia/ext/skia_utils.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 static SkBitmap CreateBlendedBitmap(const SkBitmap& first, | 54 static SkBitmap CreateBlendedBitmap(const SkBitmap& first, |
| 55 const SkBitmap& second, | 55 const SkBitmap& second, |
| 56 double alpha); | 56 double alpha); |
| 57 | 57 |
| 58 // Create a bitmap that is the original bitmap masked out by the mask defined | 58 // Create a bitmap that is the original bitmap masked out by the mask defined |
| 59 // in the alpha bitmap. The images must use the kARGB_8888_Config config and | 59 // in the alpha bitmap. The images must use the kARGB_8888_Config config and |
| 60 // be of equal dimensions. | 60 // be of equal dimensions. |
| 61 static SkBitmap CreateMaskedBitmap(const SkBitmap& first, | 61 static SkBitmap CreateMaskedBitmap(const SkBitmap& first, |
| 62 const SkBitmap& alpha); | 62 const SkBitmap& alpha); |
| 63 | 63 |
| 64 // We create a button background image by compositing the color and image |
| 65 // together, then applying the mask. This is a highly specialized composite |
| 66 // operation that is the equivalent of drawing a background in |color|, |
| 67 // tiling |image| over the top, and then masking the result out with |mask|. |
| 68 // The images must use kARGB_8888_Config config. |
| 69 static SkBitmap CreateButtonBackground(SkColor color, |
| 70 const SkBitmap& image, |
| 71 const SkBitmap& mask); |
| 72 |
| 64 // Blur a bitmap using an average-blur algorithm over the rectangle defined | 73 // Blur a bitmap using an average-blur algorithm over the rectangle defined |
| 65 // by |blur_amount|. The blur will wrap around image edges. | 74 // by |blur_amount|. The blur will wrap around image edges. |
| 66 static SkBitmap CreateBlurredBitmap(const SkBitmap& bitmap, int blur_amount); | 75 static SkBitmap CreateBlurredBitmap(const SkBitmap& bitmap, int blur_amount); |
| 67 | 76 |
| 68 // Shift a bitmap's HSL values. The shift values are in the range of 0-1, | 77 // Shift a bitmap's HSL values. The shift values are in the range of 0-1, |
| 69 // with the option to specify -1 for 'no change'. The shift values are | 78 // with the option to specify -1 for 'no change'. The shift values are |
| 70 // defined as: | 79 // defined as: |
| 71 // hsl_shift[0] (hue): The absolute hue value for the image - 0 and 1 map | 80 // hsl_shift[0] (hue): The absolute hue value for the image - 0 and 1 map |
| 72 // to 0 and 360 on the hue color wheel (red). | 81 // to 0 and 360 on the hue color wheel (red). |
| 73 // hsl_shift[1] (saturation): A saturation shift for the image, with the | 82 // hsl_shift[1] (saturation): A saturation shift for the image, with the |
| (...skipping 16 matching lines...) Expand all Loading... |
| 90 int src_x, int src_y, | 99 int src_x, int src_y, |
| 91 int dst_w, int dst_h); | 100 int dst_w, int dst_h); |
| 92 private: | 101 private: |
| 93 ImageOperations(); // Class for scoping only. | 102 ImageOperations(); // Class for scoping only. |
| 94 }; | 103 }; |
| 95 | 104 |
| 96 } // namespace skia | 105 } // namespace skia |
| 97 | 106 |
| 98 #endif // SKIA_EXT_IMAGE_OPERATIONS_H_ | 107 #endif // SKIA_EXT_IMAGE_OPERATIONS_H_ |
| 99 | 108 |
| OLD | NEW |