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_GFX_CANVAS_H_ | 5 #ifndef UI_GFX_CANVAS_H_ |
6 #define UI_GFX_CANVAS_H_ | 6 #define UI_GFX_CANVAS_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/string16.h" | 12 #include "base/string16.h" |
13 #include "skia/ext/platform_canvas.h" | 13 #include "skia/ext/platform_canvas.h" |
14 #include "ui/gfx/image/image_skia.h" | 14 #include "ui/gfx/image/image_skia.h" |
15 #include "ui/gfx/native_widget_types.h" | 15 #include "ui/gfx/native_widget_types.h" |
16 #include "ui/gfx/shadow_value.h" | 16 #include "ui/gfx/shadow_value.h" |
17 | 17 |
18 class SkBitmap; | 18 class SkBitmap; |
19 | 19 |
20 namespace ui { | |
21 class Transform; | |
22 } | |
23 | |
24 namespace gfx { | 20 namespace gfx { |
25 | 21 |
26 class Rect; | 22 class Rect; |
27 class Font; | 23 class Font; |
28 class Point; | 24 class Point; |
29 class Size; | 25 class Size; |
| 26 class Transform; |
30 | 27 |
31 // Canvas is a SkCanvas wrapper that provides a number of methods for | 28 // Canvas is a SkCanvas wrapper that provides a number of methods for |
32 // common operations used throughout an application built using ui/gfx. | 29 // common operations used throughout an application built using ui/gfx. |
33 // | 30 // |
34 // All methods that take integer arguments (as is used throughout views) | 31 // All methods that take integer arguments (as is used throughout views) |
35 // end with Int. If you need to use methods provided by SkCanvas, you'll | 32 // end with Int. If you need to use methods provided by SkCanvas, you'll |
36 // need to do a conversion. In particular you'll need to use |SkIntToScalar()|, | 33 // need to do a conversion. In particular you'll need to use |SkIntToScalar()|, |
37 // or if converting from a scalar to an integer |SkScalarRound()|. | 34 // or if converting from a scalar to an integer |SkScalarRound()|. |
38 // | 35 // |
39 // A handful of methods in this class are overloaded providing an additional | 36 // A handful of methods in this class are overloaded providing an additional |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 | 352 |
356 // Returns a native drawing context for platform specific drawing routines to | 353 // Returns a native drawing context for platform specific drawing routines to |
357 // use. Must be balanced by a call to EndPlatformPaint(). | 354 // use. Must be balanced by a call to EndPlatformPaint(). |
358 NativeDrawingContext BeginPlatformPaint(); | 355 NativeDrawingContext BeginPlatformPaint(); |
359 | 356 |
360 // Signifies the end of platform drawing using the native drawing context | 357 // Signifies the end of platform drawing using the native drawing context |
361 // returned by BeginPlatformPaint(). | 358 // returned by BeginPlatformPaint(). |
362 void EndPlatformPaint(); | 359 void EndPlatformPaint(); |
363 | 360 |
364 // Apply transformation on the canvas. | 361 // Apply transformation on the canvas. |
365 void Transform(const ui::Transform& transform); | 362 void Transform(const gfx::Transform& transform); |
366 | 363 |
367 // Draws the given string with the beginning and/or the end using a fade | 364 // Draws the given string with the beginning and/or the end using a fade |
368 // gradient. When truncating the head | 365 // gradient. When truncating the head |
369 // |desired_characters_to_truncate_from_head| specifies the maximum number of | 366 // |desired_characters_to_truncate_from_head| specifies the maximum number of |
370 // characters that can be truncated. | 367 // characters that can be truncated. |
371 void DrawFadeTruncatingString( | 368 void DrawFadeTruncatingString( |
372 const string16& text, | 369 const string16& text, |
373 TruncateFadeMode truncate_mode, | 370 TruncateFadeMode truncate_mode, |
374 size_t desired_characters_to_truncate_from_head, | 371 size_t desired_characters_to_truncate_from_head, |
375 const gfx::Font& font, | 372 const gfx::Font& font, |
(...skipping 30 matching lines...) Expand all Loading... |
406 | 403 |
407 scoped_ptr<skia::PlatformCanvas> owned_canvas_; | 404 scoped_ptr<skia::PlatformCanvas> owned_canvas_; |
408 SkCanvas* canvas_; | 405 SkCanvas* canvas_; |
409 | 406 |
410 DISALLOW_COPY_AND_ASSIGN(Canvas); | 407 DISALLOW_COPY_AND_ASSIGN(Canvas); |
411 }; | 408 }; |
412 | 409 |
413 } // namespace gfx | 410 } // namespace gfx |
414 | 411 |
415 #endif // UI_GFX_CANVAS_H_ | 412 #endif // UI_GFX_CANVAS_H_ |
OLD | NEW |