| 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_VIEWS_PAINTER_H_ | 5 #ifndef UI_VIEWS_PAINTER_H_ |
| 6 #define UI_VIEWS_PAINTER_H_ | 6 #define UI_VIEWS_PAINTER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 // A convenience method for painting a Painter in a particular region. | 28 // A convenience method for painting a Painter in a particular region. |
| 29 // This translates the canvas to x/y and paints the painter. | 29 // This translates the canvas to x/y and paints the painter. |
| 30 static void PaintPainterAt(gfx::Canvas* canvas, | 30 static void PaintPainterAt(gfx::Canvas* canvas, |
| 31 Painter* painter, | 31 Painter* painter, |
| 32 const gfx::Rect& rect); | 32 const gfx::Rect& rect); |
| 33 | 33 |
| 34 // Creates a painter that draws a gradient between the two colors. | 34 // Creates a painter that draws a gradient between the two colors. |
| 35 static Painter* CreateHorizontalGradient(SkColor c1, SkColor c2); | 35 static Painter* CreateHorizontalGradient(SkColor c1, SkColor c2); |
| 36 static Painter* CreateVerticalGradient(SkColor c1, SkColor c2); | 36 static Painter* CreateVerticalGradient(SkColor c1, SkColor c2); |
| 37 | 37 |
| 38 // Creates a painter that draws a multi-color gradient. |colors| contains the |
| 39 // gradient colors and |pos| the relative positions of the colors. The first |
| 40 // element in |pos| must be 0.0 and the last element 1.0. |count| contains |
| 41 // the number of elements in |colors| and |pos|. |
| 42 static Painter* CreateVerticalMultiColorGradient(SkColor* colors, |
| 43 SkScalar* pos, |
| 44 size_t count); |
| 45 |
| 38 // Creates a painter that divides |image| into nine regions. The four corners | 46 // Creates a painter that divides |image| into nine regions. The four corners |
| 39 // are rendered at the size specified in insets (for example, the upper | 47 // are rendered at the size specified in insets (for example, the upper |
| 40 // left corners is rendered at 0x0 with a size of | 48 // left corners is rendered at 0x0 with a size of |
| 41 // insets.left()xinsets.right()). The four edges are stretched to fill the | 49 // insets.left()xinsets.right()). The four edges are stretched to fill the |
| 42 // destination size. | 50 // destination size. |
| 43 // Ownership is passed to the caller. | 51 // Ownership is passed to the caller. |
| 44 static Painter* CreateImagePainter(const gfx::ImageSkia& image, | 52 static Painter* CreateImagePainter(const gfx::ImageSkia& image, |
| 45 const gfx::Insets& insets, | 53 const gfx::Insets& insets, |
| 46 bool paint_center); | 54 bool paint_center); |
| 47 | 55 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 int height_; | 89 int height_; |
| 82 // NOTE: the images are owned by ResourceBundle. Don't free them. | 90 // NOTE: the images are owned by ResourceBundle. Don't free them. |
| 83 const gfx::ImageSkia* images_[3]; | 91 const gfx::ImageSkia* images_[3]; |
| 84 | 92 |
| 85 DISALLOW_COPY_AND_ASSIGN(HorizontalPainter); | 93 DISALLOW_COPY_AND_ASSIGN(HorizontalPainter); |
| 86 }; | 94 }; |
| 87 | 95 |
| 88 } // namespace views | 96 } // namespace views |
| 89 | 97 |
| 90 #endif // UI_VIEWS_PAINTER_H_ | 98 #endif // UI_VIEWS_PAINTER_H_ |
| OLD | NEW |