Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(671)

Side by Side Diff: ui/gfx/image/image_skia_operations.h

Issue 10783015: Add ability to store hidpi theme images in data pack (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_IMAGE_SKIA_OPERATIONS_H_ 5 #ifndef UI_GFX_IMAGE_IMAGE_SKIA_OPERATIONS_H_
6 #define UI_GFX_IMAGE_IMAGE_SKIA_OPERATIONS_H_ 6 #define UI_GFX_IMAGE_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/shadow_value.h" 11 #include "ui/gfx/shadow_value.h"
11 12
12 namespace gfx { 13 namespace gfx {
13 class ImageSkia; 14 class ImageSkia;
15 class Rect;
14 class Size; 16 class Size;
15 17
16 class UI_EXPORT ImageSkiaOperations { 18 class UI_EXPORT ImageSkiaOperations {
17 public: 19 public:
18 // 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
19 // specifies the opacity of the second imag. The provided image must 21 // specifies the opacity of the second imag. The provided image must
20 // use the kARGB_8888_Config config and be of equal dimensions. 22 // use the kARGB_8888_Config config and be of equal dimensions.
21 static ImageSkia CreateBlendedImage(const ImageSkia& first, 23 static ImageSkia CreateBlendedImage(const ImageSkia& first,
22 const ImageSkia& second, 24 const ImageSkia& second,
23 double alpha); 25 double alpha);
24 26
25 // Create an image that is the original image masked out by the mask defined 27 // Create an image that is the original image masked out by the mask defined
26 // in the alpha image. The images must use the kARGB_8888_Config config and 28 // in the alpha image. The images must use the kARGB_8888_Config config and
27 // be of equal dimensions. 29 // be of equal dimensions.
28 static ImageSkia CreateMaskedImage(const ImageSkia& first, 30 static ImageSkia CreateMaskedImage(const ImageSkia& first,
29 const ImageSkia& alpha); 31 const ImageSkia& alpha);
30 32
31 // Create an image that is cropped from another image. This is special 33 // Create an image that is cropped from another image. This is special
32 // because it tiles the original image, so your coordinates can extend 34 // because it tiles the original image, so your coordinates can extend
33 // outside the bounds of the original image. 35 // outside the bounds of the original image.
34 static ImageSkia CreateTiledImage(const ImageSkia& image, 36 static ImageSkia CreateTiledImage(const ImageSkia& image,
35 int src_x, int src_y, 37 int src_x, int src_y,
36 int dst_w, int dst_h); 38 int dst_w, int dst_h);
37 39
40 // Shift an image's HSL values. The shift values are in the range of 0-1,
41 // with the option to specify -1 for 'no change'. The shift values are
42 // defined as:
43 // hsl_shift[0] (hue): The absolute hue value for the image - 0 and 1 map
44 // to 0 and 360 on the hue color wheel (red).
45 // hsl_shift[1] (saturation): A saturation shift for the image, with the
46 // following key values:
47 // 0 = remove all color.
48 // 0.5 = leave unchanged.
49 // 1 = fully saturate the image.
50 // hsl_shift[2] (lightness): A lightness shift for the image, with the
51 // following key values:
52 // 0 = remove all lightness (make all pixels black).
53 // 0.5 = leave unchanged.
54 // 1 = full lightness (make all pixels white).
55 static ImageSkia CreateHSLShiftedImage(const gfx::ImageSkia& image,
56 const color_utils::HSL& hsl_shift);
57
38 // Creates an image by resizing |source| to given |target_dip_size|. 58 // Creates an image by resizing |source| to given |target_dip_size|.
39 static ImageSkia CreateResizedImage(const ImageSkia& source, 59 static ImageSkia CreateResizedImage(const ImageSkia& source,
40 const Size& target_dip_size); 60 const Size& target_dip_size);
41 61
42 // Creates an image with drop shadow defined in |shadows| for |source|. 62 // Creates an image with drop shadow defined in |shadows| for |source|.
43 static ImageSkia CreateImageWithDropShadow(const ImageSkia& source, 63 static ImageSkia CreateImageWithDropShadow(const ImageSkia& source,
44 const ShadowValues& shadows); 64 const ShadowValues& shadows);
45 65
46 private: 66 private:
47 ImageSkiaOperations(); // Class for scoping only. 67 ImageSkiaOperations(); // Class for scoping only.
48 }; 68 };
49 69
50 } 70 } // namespace gfx
51 71
52 #endif // UI_GFX_IMAGE_IMAGE_SKIA_OPERATIONS_H_ 72 #endif // UI_GFX_IMAGE_IMAGE_SKIA_OPERATIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698