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 "skia/ext/image_operations.h" | 9 #include "skia/ext/image_operations.h" |
10 #include "ui/base/ui_export.h" | 10 #include "ui/base/ui_export.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 static ImageSkia CreateButtonBackground(SkColor color, | 72 static ImageSkia CreateButtonBackground(SkColor color, |
73 const gfx::ImageSkia& image, | 73 const gfx::ImageSkia& image, |
74 const gfx::ImageSkia& mask); | 74 const gfx::ImageSkia& mask); |
75 | 75 |
76 // Returns an image which is a subset of |image| with bounds |subset_bounds|. | 76 // Returns an image which is a subset of |image| with bounds |subset_bounds|. |
77 // The |image| cannot use kA1_Config config. | 77 // The |image| cannot use kA1_Config config. |
78 static ImageSkia ExtractSubset(const gfx::ImageSkia& image, | 78 static ImageSkia ExtractSubset(const gfx::ImageSkia& image, |
79 const gfx::Rect& subset_bounds); | 79 const gfx::Rect& subset_bounds); |
80 | 80 |
81 // Creates an image by resizing |source| to given |target_dip_size|. | 81 // Creates an image by resizing |source| to given |target_dip_size|. |
82 // If |source| is missing the representation for a required scale factor, the | |
83 // representation for the scale factor will be generated by resizing one of | |
84 // |source|'s existing representations' bitmap to the target pixel size. | |
85 // The bitmap will be resized using resize method |methd|. | |
86 static ImageSkia CreateResizedImage(const ImageSkia& source, | 82 static ImageSkia CreateResizedImage(const ImageSkia& source, |
87 skia::ImageOperations::ResizeMethod methd, | 83 skia::ImageOperations::ResizeMethod methd, |
88 const Size& target_dip_size); | 84 const Size& target_dip_size); |
89 | 85 |
90 // Creates an image which inherits image representations from |source|. | |
91 // Image representations for the scale factors not containted in |source| are | |
92 // generated by resizing existing representations using |method|. | |
93 static ImageSkia CreateImageWithCustomResizeMethod( | |
94 const ImageSkia& source, | |
95 skia::ImageOperations::ResizeMethod method); | |
96 | |
97 // Creates an image with drop shadow defined in |shadows| for |source|. | 86 // Creates an image with drop shadow defined in |shadows| for |source|. |
98 static ImageSkia CreateImageWithDropShadow(const ImageSkia& source, | 87 static ImageSkia CreateImageWithDropShadow(const ImageSkia& source, |
99 const ShadowValues& shadows); | 88 const ShadowValues& shadows); |
100 | 89 |
101 private: | 90 private: |
102 ImageSkiaOperations(); // Class for scoping only. | 91 ImageSkiaOperations(); // Class for scoping only. |
103 }; | 92 }; |
104 | 93 |
105 } // namespace gfx | 94 } // namespace gfx |
106 | 95 |
107 #endif // UI_GFX_IMAGE_IMAGE_SKIA_OPERATIONS_H_ | 96 #endif // UI_GFX_IMAGE_IMAGE_SKIA_OPERATIONS_H_ |
OLD | NEW |