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. | |
pkotwicz
2012/10/17 18:42:20
Nit: mention that we are resizing using |methd| in
tbarzic
2012/10/17 19:00:46
Done.
| |
82 static ImageSkia CreateResizedImage(const ImageSkia& source, | 85 static ImageSkia CreateResizedImage(const ImageSkia& source, |
83 skia::ImageOperations::ResizeMethod methd, | 86 skia::ImageOperations::ResizeMethod methd, |
84 const Size& target_dip_size); | 87 const Size& target_dip_size); |
85 | 88 |
89 // Creates an image which inherits image representations from |source|. | |
90 // Image representations for the scale factors not containted in |source| are | |
91 // generated by resizing existing representations using |resize_method|. | |
92 static ImageSkia SetFallbackResizeMethod( | |
pkotwicz
2012/10/17 18:42:20
How about GetImageWithCustomResizeMethod() ?
tbarzic
2012/10/17 19:00:46
yeah, sounds much better (I'll use 'Create' instea
| |
93 const ImageSkia& source, | |
94 skia::ImageOperations::ResizeMethod method); | |
95 | |
86 // Creates an image with drop shadow defined in |shadows| for |source|. | 96 // Creates an image with drop shadow defined in |shadows| for |source|. |
87 static ImageSkia CreateImageWithDropShadow(const ImageSkia& source, | 97 static ImageSkia CreateImageWithDropShadow(const ImageSkia& source, |
88 const ShadowValues& shadows); | 98 const ShadowValues& shadows); |
89 | 99 |
90 private: | 100 private: |
91 ImageSkiaOperations(); // Class for scoping only. | 101 ImageSkiaOperations(); // Class for scoping only. |
92 }; | 102 }; |
93 | 103 |
94 } // namespace gfx | 104 } // namespace gfx |
95 | 105 |
96 #endif // UI_GFX_IMAGE_IMAGE_SKIA_OPERATIONS_H_ | 106 #endif // UI_GFX_IMAGE_IMAGE_SKIA_OPERATIONS_H_ |
OLD | NEW |