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

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

Issue 10704199: Implement remaining SkBitmapOperations as ImageSkiaOperations (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
« no previous file with comments | « ui/gfx/image/image_skia.cc ('k') | ui/gfx/image/image_skia_operations.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_SKIA_OPERATIONS_H_
6 #define UI_GFX_IMAGE_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 "ui/base/ui_export.h" 9 #include "ui/base/ui_export.h"
10 #include "ui/gfx/shadow_value.h" 10 #include "ui/gfx/shadow_value.h"
11 11
12 namespace gfx { 12 namespace gfx {
13 class ImageSkia; 13 class ImageSkia;
14 class Rect;
14 class Size; 15 class Size;
15 16
16 class UI_EXPORT ImageSkiaOperations { 17 class UI_EXPORT ImageSkiaOperations {
17 public: 18 public:
18 // Create an image that is a blend of two others. The alpha argument 19 // 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 20 // specifies the opacity of the second imag. The provided image must
20 // use the kARGB_8888_Config config and be of equal dimensions. 21 // use the kARGB_8888_Config config and be of equal dimensions.
21 static ImageSkia CreateBlendedImage(const ImageSkia& first, 22 static ImageSkia CreateBlendedImage(const ImageSkia& first,
22 const ImageSkia& second, 23 const ImageSkia& second,
23 double alpha); 24 double alpha);
24 25
25 // Create an image that is the original image masked out by the mask defined 26 // 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 27 // in the alpha image. The images must use the kARGB_8888_Config config and
27 // be of equal dimensions. 28 // be of equal dimensions.
28 static ImageSkia CreateMaskedImage(const ImageSkia& first, 29 static ImageSkia CreateMaskedImage(const ImageSkia& first,
29 const ImageSkia& alpha); 30 const ImageSkia& alpha);
30 31
31 // Create an image that is cropped from another image. This is special 32 // Create an image that is cropped from another image. This is special
32 // because it tiles the original image, so your coordinates can extend 33 // because it tiles the original image, so your coordinates can extend
33 // outside the bounds of the original image. 34 // outside the bounds of the original image.
34 static ImageSkia CreateTiledImage(const ImageSkia& image, 35 static ImageSkia CreateTiledImage(const ImageSkia& image,
35 int src_x, int src_y, 36 int src_x, int src_y,
36 int dst_w, int dst_h); 37 int dst_w, int dst_h);
37 38
39 // Creates a button background image by compositing the color and image
40 // together, then applying the mask. This is a highly specialized composite
41 // operation that is the equivalent of drawing a background in |color|,
42 // tiling |image| over the top, and then masking the result out with |mask|.
43 // The images must use kARGB_8888_Config config.
44 static ImageSkia CreateButtonBackground(SkColor color,
45 const gfx::ImageSkia& image,
46 const gfx::ImageSkia& mask);
47
48 // Returns an image which is a subset of |image| with bounds |subset_bounds|.
49 // The |image| cannot use kA1_Config config.
50 static ImageSkia ExtractSubset(const gfx::ImageSkia& image,
51 const gfx::Rect& subset_bounds);
52
38 // Creates an image by resizing |source| to given |target_dip_size|. 53 // Creates an image by resizing |source| to given |target_dip_size|.
39 static ImageSkia CreateResizedImage(const ImageSkia& source, 54 static ImageSkia CreateResizedImage(const ImageSkia& source,
40 const Size& target_dip_size); 55 const Size& target_dip_size);
41 56
42 // Creates an image with drop shadow defined in |shadows| for |source|. 57 // Creates an image with drop shadow defined in |shadows| for |source|.
43 static ImageSkia CreateImageWithDropShadow(const ImageSkia& source, 58 static ImageSkia CreateImageWithDropShadow(const ImageSkia& source,
44 const ShadowValues& shadows); 59 const ShadowValues& shadows);
45 60
46 private: 61 private:
47 ImageSkiaOperations(); // Class for scoping only. 62 ImageSkiaOperations(); // Class for scoping only.
48 }; 63 };
49 64
50 } 65 } // namespace gfx
51 66
52 #endif // UI_GFX_IMAGE_IMAGE_SKIA_OPERATIONS_H_ 67 #endif // UI_GFX_IMAGE_IMAGE_SKIA_OPERATIONS_H_
OLDNEW
« no previous file with comments | « ui/gfx/image/image_skia.cc ('k') | ui/gfx/image/image_skia_operations.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698