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" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 enum TruncateFadeMode { | 43 enum TruncateFadeMode { |
44 TruncateFadeTail, | 44 TruncateFadeTail, |
45 TruncateFadeHead, | 45 TruncateFadeHead, |
46 TruncateFadeHeadAndTail, | 46 TruncateFadeHeadAndTail, |
47 }; | 47 }; |
48 | 48 |
49 // Specifies the alignment for text rendered with the DrawStringInt method. | 49 // Specifies the alignment for text rendered with the DrawStringInt method. |
50 enum { | 50 enum { |
51 TEXT_ALIGN_LEFT = 1 << 0, | 51 TEXT_ALIGN_LEFT = 1 << 0, |
52 TEXT_ALIGN_CENTER = 1 << 1, | 52 TEXT_ALIGN_CENTER = 1 << 1, |
53 TEXT_ALIGN_RIGHT = 1 << 2 , | 53 TEXT_ALIGN_RIGHT = 1 << 2, |
54 TEXT_VALIGN_TOP = 1 << 3, | |
55 TEXT_VALIGN_MIDDLE = 1 << 4, | |
56 TEXT_VALIGN_BOTTOM = 1 << 5, | |
57 | 54 |
58 // Specifies the text consists of multiple lines. | 55 // Specifies the text consists of multiple lines. |
59 MULTI_LINE = 1 << 6, | 56 MULTI_LINE = 1 << 3, |
60 | 57 |
61 // By default DrawStringInt does not process the prefix ('&') character | 58 // By default DrawStringInt does not process the prefix ('&') character |
62 // specially. That is, the string "&foo" is rendered as "&foo". When | 59 // specially. That is, the string "&foo" is rendered as "&foo". When |
63 // rendering text from a resource that uses the prefix character for | 60 // rendering text from a resource that uses the prefix character for |
64 // mnemonics, the prefix should be processed and can be rendered as an | 61 // mnemonics, the prefix should be processed and can be rendered as an |
65 // underline (SHOW_PREFIX), or not rendered at all (HIDE_PREFIX). | 62 // underline (SHOW_PREFIX), or not rendered at all (HIDE_PREFIX). |
66 SHOW_PREFIX = 1 << 7, | 63 SHOW_PREFIX = 1 << 4, |
67 HIDE_PREFIX = 1 << 8, | 64 HIDE_PREFIX = 1 << 5, |
68 | 65 |
69 // Prevent ellipsizing | 66 // Prevent ellipsizing |
70 NO_ELLIPSIS = 1 << 9, | 67 NO_ELLIPSIS = 1 << 6, |
71 | 68 |
72 // Specifies if words can be split by new lines. | 69 // Specifies if words can be split by new lines. |
73 // This only works with MULTI_LINE. | 70 // This only works with MULTI_LINE. |
74 CHARACTER_BREAK = 1 << 10, | 71 CHARACTER_BREAK = 1 << 7, |
75 | 72 |
76 // Instructs DrawStringInt() to render the text using RTL directionality. | 73 // Instructs DrawStringInt() to render the text using RTL directionality. |
77 // In most cases, passing this flag is not necessary because information | 74 // In most cases, passing this flag is not necessary because information |
78 // about the text directionality is going to be embedded within the string | 75 // about the text directionality is going to be embedded within the string |
79 // in the form of special Unicode characters. However, we don't insert | 76 // in the form of special Unicode characters. However, we don't insert |
80 // directionality characters into strings if the locale is LTR because some | 77 // directionality characters into strings if the locale is LTR because some |
81 // platforms (for example, an English Windows XP with no RTL fonts | 78 // platforms (for example, an English Windows XP with no RTL fonts |
82 // installed) don't support these characters. Thus, this flag should be | 79 // installed) don't support these characters. Thus, this flag should be |
83 // used to render text using RTL directionality when the locale is LTR. | 80 // used to render text using RTL directionality when the locale is LTR. |
84 FORCE_RTL_DIRECTIONALITY = 1 << 11, | 81 FORCE_RTL_DIRECTIONALITY = 1 << 8, |
85 | 82 |
86 // Similar to FORCE_RTL_DIRECTIONALITY, but left-to-right. | 83 // Similar to FORCE_RTL_DIRECTIONALITY, but left-to-right. |
87 // See FORCE_RTL_DIRECTIONALITY for details. | 84 // See FORCE_RTL_DIRECTIONALITY for details. |
88 FORCE_LTR_DIRECTIONALITY = 1 << 12, | 85 FORCE_LTR_DIRECTIONALITY = 1 << 9, |
89 | 86 |
90 // Instructs DrawStringInt() to not use subpixel rendering. This is useful | 87 // Instructs DrawStringInt() to not use subpixel rendering. This is useful |
91 // when rendering text onto a fully- or partially-transparent background | 88 // when rendering text onto a fully- or partially-transparent background |
92 // that will later be blended with another image. | 89 // that will later be blended with another image. |
93 NO_SUBPIXEL_RENDERING = 1 << 13, | 90 NO_SUBPIXEL_RENDERING = 1 << 10, |
94 }; | 91 }; |
95 | 92 |
96 // Creates an empty canvas with scale factor of 1x. | 93 // Creates an empty canvas with scale factor of 1x. |
97 Canvas(); | 94 Canvas(); |
98 | 95 |
99 // Creates canvas with provided DIP |size| and |scale_factor|. | 96 // Creates canvas with provided DIP |size| and |scale_factor|. |
100 // If this canvas is not opaque, it's explicitly cleared to transparent before | 97 // If this canvas is not opaque, it's explicitly cleared to transparent before |
101 // being returned. | 98 // being returned. |
102 Canvas(const gfx::Size& size, | 99 Canvas(const gfx::Size& size, |
103 ui::ScaleFactor scale_factor, | 100 ui::ScaleFactor scale_factor, |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 | 400 |
404 scoped_ptr<skia::PlatformCanvas> owned_canvas_; | 401 scoped_ptr<skia::PlatformCanvas> owned_canvas_; |
405 SkCanvas* canvas_; | 402 SkCanvas* canvas_; |
406 | 403 |
407 DISALLOW_COPY_AND_ASSIGN(Canvas); | 404 DISALLOW_COPY_AND_ASSIGN(Canvas); |
408 }; | 405 }; |
409 | 406 |
410 } // namespace gfx | 407 } // namespace gfx |
411 | 408 |
412 #endif // UI_GFX_CANVAS_H_ | 409 #endif // UI_GFX_CANVAS_H_ |
OLD | NEW |