OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_CANVAS_H_ | 5 #ifndef UI_GFX_CANVAS_H_ |
6 #define UI_GFX_CANVAS_H_ | 6 #define UI_GFX_CANVAS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 typedef unsigned int TextureID; | 22 typedef unsigned int TextureID; |
23 } | 23 } |
24 | 24 |
25 namespace gfx { | 25 namespace gfx { |
26 | 26 |
27 class Brush; | 27 class Brush; |
28 class CanvasSkia; | 28 class CanvasSkia; |
29 class Font; | 29 class Font; |
30 class Point; | 30 class Point; |
31 class Rect; | 31 class Rect; |
| 32 class Size; |
32 | 33 |
33 // TODO(beng): documentation. | 34 // TODO(beng): documentation. |
34 class UI_EXPORT Canvas { | 35 class UI_EXPORT Canvas { |
35 public: | 36 public: |
36 // Specifies the alignment for text rendered with the DrawStringInt method. | 37 // Specifies the alignment for text rendered with the DrawStringInt method. |
37 enum { | 38 enum { |
38 TEXT_ALIGN_LEFT = 1, | 39 TEXT_ALIGN_LEFT = 1, |
39 TEXT_ALIGN_CENTER = 2, | 40 TEXT_ALIGN_CENTER = 2, |
40 TEXT_ALIGN_RIGHT = 4, | 41 TEXT_ALIGN_RIGHT = 4, |
41 TEXT_VALIGN_TOP = 8, | 42 TEXT_VALIGN_TOP = 8, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 // See FORCE_RTL_DIRECTIONALITY for details. | 75 // See FORCE_RTL_DIRECTIONALITY for details. |
75 FORCE_LTR_DIRECTIONALITY = 4096, | 76 FORCE_LTR_DIRECTIONALITY = 4096, |
76 }; | 77 }; |
77 | 78 |
78 virtual ~Canvas() {} | 79 virtual ~Canvas() {} |
79 | 80 |
80 // Creates an empty canvas. Must be initialized before it can be used. | 81 // Creates an empty canvas. Must be initialized before it can be used. |
81 static Canvas* CreateCanvas(); | 82 static Canvas* CreateCanvas(); |
82 | 83 |
83 // Creates a canvas with the specified size. | 84 // Creates a canvas with the specified size. |
84 static Canvas* CreateCanvas(int width, int height, bool is_opaque); | 85 static Canvas* CreateCanvas(const gfx::Size& size, bool is_opaque); |
85 | 86 |
86 // Saves a copy of the drawing state onto a stack, operating on this copy | 87 // Saves a copy of the drawing state onto a stack, operating on this copy |
87 // until a balanced call to Restore() is made. | 88 // until a balanced call to Restore() is made. |
88 virtual void Save() = 0; | 89 virtual void Save() = 0; |
89 | 90 |
90 // As with Save(), except draws to a layer that is blended with the canvas | 91 // As with Save(), except draws to a layer that is blended with the canvas |
91 // at the specified alpha once Restore() is called. | 92 // at the specified alpha once Restore() is called. |
92 // |layer_bounds| are the bounds of the layer relative to the current | 93 // |layer_bounds| are the bounds of the layer relative to the current |
93 // transform. | 94 // transform. |
94 virtual void SaveLayerAlpha(uint8 alpha) = 0; | 95 virtual void SaveLayerAlpha(uint8 alpha) = 0; |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 // Returns the rectangle that is invalid. | 245 // Returns the rectangle that is invalid. |
245 virtual gfx::Rect GetInvalidRect() const = 0; | 246 virtual gfx::Rect GetInvalidRect() const = 0; |
246 | 247 |
247 // Returns the underlying Canvas. | 248 // Returns the underlying Canvas. |
248 virtual Canvas* AsCanvas() = 0; | 249 virtual Canvas* AsCanvas() = 0; |
249 }; | 250 }; |
250 | 251 |
251 } // namespace gfx | 252 } // namespace gfx |
252 | 253 |
253 #endif // UI_GFX_CANVAS_H_ | 254 #endif // UI_GFX_CANVAS_H_ |
OLD | NEW |