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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: ui/gfx/image/image_skia_operations.h
diff --git a/ui/gfx/image/image_skia_operations.h b/ui/gfx/image/image_skia_operations.h
index e725602f2b084cc0bae656afd9c5cc18c23162b4..1154dc22f25cbbc690bc09c2e49b8e715e6b5bda 100644
--- a/ui/gfx/image/image_skia_operations.h
+++ b/ui/gfx/image/image_skia_operations.h
@@ -7,10 +7,12 @@
#include "base/gtest_prod_util.h"
#include "ui/base/ui_export.h"
-#include "ui/gfx/size.h"
+#include "ui/gfx/color_utils.h"
namespace gfx {
class ImageSkia;
+class Rect;
+class Size;
class UI_EXPORT ImageSkiaOperations {
public:
@@ -34,6 +36,41 @@ class UI_EXPORT ImageSkiaOperations {
int src_x, int src_y,
int dst_w, int dst_h);
+ // We create a button background image by compositing the color and image
+ // together, then applying the mask. This is a highly specialized composite
+ // operation that is the equivalent of drawing a background in |color|,
+ // tiling |image| over the top, and then masking the result out with |mask|.
+ // The images must use kARGB_8888_Config config.
+ static ImageSkia CreateButtonBackground(SkColor color,
oshima 2012/07/13 16:54:55 If this is specific to image button, i'd keep it i
pkotwicz 2012/07/15 03:36:48 I want to keep it here if only because this method
+ const gfx::ImageSkia& image,
+ const gfx::ImageSkia& mask);
+
+ // Shift an image's HSL values. The shift values are in the range of 0-1,
+ // with the option to specify -1 for 'no change'. The shift values are
+ // defined as:
+ // hsl_shift[0] (hue): The absolute hue value for the image - 0 and 1 map
+ // to 0 and 360 on the hue color wheel (red).
+ // hsl_shift[1] (saturation): A saturation shift for the image, with the
+ // following key values:
+ // 0 = remove all color.
+ // 0.5 = leave unchanged.
+ // 1 = fully saturate the image.
+ // hsl_shift[2] (lightness): A lightness shift for the image, with the
+ // following key values:
+ // 0 = remove all lightness (make all pixels black).
+ // 0.5 = leave unchanged.
+ // 1 = full lightness (make all pixels white).
+ static ImageSkia CreateHSLShiftedImage(const gfx::ImageSkia& image,
+ const color_utils::HSL& hsl_shift);
+
+ // Create an image by combining alpha channel of |image| and color |c|.
+ // The image must use the kARGB_8888_Config config.
+ static ImageSkia CreateColorMask(const gfx::ImageSkia& image, SkColor c);
oshima 2012/07/13 16:54:55 Are these used in this CL? I prefer to add when yo
+
+ // Returns an image which is a subset of |image| with bounds |subset_bounds|.
+ static ImageSkia ExtractSubset(const gfx::ImageSkia& image,
+ const gfx::Rect& subset_bounds);
+
// Creates an image that resizes |source| to given |target_size_in_dip|.
// The resize operation occurs synchronously at the time that the desired
// scale factor is known (either GetRepresentation is called or the image

Powered by Google App Engine
This is Rietveld 408576698