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 |
11 #include "base/string16.h" | 11 #include "base/string16.h" |
12 // TODO(beng): remove this include when we no longer depend on SkTypes. | 12 // TODO(beng): remove this include when we no longer depend on SkTypes. |
13 #include "skia/ext/platform_canvas.h" | 13 #include "skia/ext/platform_canvas.h" |
14 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
| 15 #include "ui/ui_api.h" |
15 | 16 |
16 namespace ui { | 17 namespace ui { |
17 class Transform; | 18 class Transform; |
18 | 19 |
19 typedef unsigned int TextureID; | 20 typedef unsigned int TextureID; |
20 } | 21 } |
21 | 22 |
22 namespace gfx { | 23 namespace gfx { |
23 | 24 |
24 class Brush; | 25 class Brush; |
25 class CanvasSkia; | 26 class CanvasSkia; |
26 class Font; | 27 class Font; |
27 class Point; | 28 class Point; |
28 class Rect; | 29 class Rect; |
29 | 30 |
30 // TODO(beng): documentation. | 31 // TODO(beng): documentation. |
31 class Canvas { | 32 class UI_API Canvas { |
32 public: | 33 public: |
33 // Specifies the alignment for text rendered with the DrawStringInt method. | 34 // Specifies the alignment for text rendered with the DrawStringInt method. |
34 enum { | 35 enum { |
35 TEXT_ALIGN_LEFT = 1, | 36 TEXT_ALIGN_LEFT = 1, |
36 TEXT_ALIGN_CENTER = 2, | 37 TEXT_ALIGN_CENTER = 2, |
37 TEXT_ALIGN_RIGHT = 4, | 38 TEXT_ALIGN_RIGHT = 4, |
38 TEXT_VALIGN_TOP = 8, | 39 TEXT_VALIGN_TOP = 8, |
39 TEXT_VALIGN_MIDDLE = 16, | 40 TEXT_VALIGN_MIDDLE = 16, |
40 TEXT_VALIGN_BOTTOM = 32, | 41 TEXT_VALIGN_BOTTOM = 32, |
41 | 42 |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 // Create a texture ID that can be used for accelerated drawing. | 221 // Create a texture ID that can be used for accelerated drawing. |
221 virtual ui::TextureID GetTextureID() = 0; | 222 virtual ui::TextureID GetTextureID() = 0; |
222 | 223 |
223 // TODO(beng): remove this once we don't need to use any skia-specific methods | 224 // TODO(beng): remove this once we don't need to use any skia-specific methods |
224 // through this interface. | 225 // through this interface. |
225 // A quick and dirty way to obtain the underlying SkCanvas. | 226 // A quick and dirty way to obtain the underlying SkCanvas. |
226 virtual CanvasSkia* AsCanvasSkia(); | 227 virtual CanvasSkia* AsCanvasSkia(); |
227 virtual const CanvasSkia* AsCanvasSkia() const; | 228 virtual const CanvasSkia* AsCanvasSkia() const; |
228 }; | 229 }; |
229 | 230 |
230 class CanvasPaint { | 231 class UI_API CanvasPaint { |
231 public: | 232 public: |
232 virtual ~CanvasPaint() {} | 233 virtual ~CanvasPaint() {} |
233 | 234 |
234 // Creates a canvas that paints to |view| when it is destroyed. The canvas is | 235 // Creates a canvas that paints to |view| when it is destroyed. The canvas is |
235 // sized to the client area of |view|. | 236 // sized to the client area of |view|. |
236 static CanvasPaint* CreateCanvasPaint(gfx::NativeView view); | 237 static CanvasPaint* CreateCanvasPaint(gfx::NativeView view); |
237 | 238 |
238 // Returns true if the canvas has an invalid rect that needs to be repainted. | 239 // Returns true if the canvas has an invalid rect that needs to be repainted. |
239 virtual bool IsValid() const = 0; | 240 virtual bool IsValid() const = 0; |
240 | 241 |
241 // Returns the rectangle that is invalid. | 242 // Returns the rectangle that is invalid. |
242 virtual gfx::Rect GetInvalidRect() const = 0; | 243 virtual gfx::Rect GetInvalidRect() const = 0; |
243 | 244 |
244 // Returns the underlying Canvas. | 245 // Returns the underlying Canvas. |
245 virtual Canvas* AsCanvas() = 0; | 246 virtual Canvas* AsCanvas() = 0; |
246 }; | 247 }; |
247 | 248 |
248 } // namespace gfx; | 249 } // namespace gfx; |
249 | 250 |
250 #endif // UI_GFX_CANVAS_H_ | 251 #endif // UI_GFX_CANVAS_H_ |
OLD | NEW |