OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 GFX_CANVAS_SKIA_H_ | 5 #ifndef GFX_CANVAS_SKIA_H_ |
6 #define GFX_CANVAS_SKIA_H_ | 6 #define GFX_CANVAS_SKIA_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "gfx/canvas.h" | 10 #include "gfx/canvas.h" |
(...skipping 49 matching lines...) Loading... |
60 // | 60 // |
61 // This function returns either gfx::Canvas::TEXT_ALIGN_LEFT or | 61 // This function returns either gfx::Canvas::TEXT_ALIGN_LEFT or |
62 // gfx::Canvas::TEXT_ALIGN_RIGHT. | 62 // gfx::Canvas::TEXT_ALIGN_RIGHT. |
63 static int DefaultCanvasTextAlignment(); | 63 static int DefaultCanvasTextAlignment(); |
64 | 64 |
65 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 65 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
66 // Draw the pixbuf in its natural size at (x, y). | 66 // Draw the pixbuf in its natural size at (x, y). |
67 void DrawGdkPixbuf(GdkPixbuf* pixbuf, int x, int y); | 67 void DrawGdkPixbuf(GdkPixbuf* pixbuf, int x, int y); |
68 #endif | 68 #endif |
69 | 69 |
70 #ifdef OS_WIN // Only implemented on Windows for now. | 70 #if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MACOSX)) |
71 // Draws text with a 1-pixel halo around it of the given color. It allows | 71 // Draws text with a 1-pixel halo around it of the given color. |
72 // ClearType to be drawn to an otherwise transparenct bitmap for drag images. | 72 // On Windows, it allows ClearType to be drawn to an otherwise transparenct |
73 // Drag images have only 1-bit of transparency, so we don't do any fancy | 73 // bitmap for drag images. Drag images have only 1-bit of transparency, so |
74 // blurring. | 74 // we don't do any fancy blurring. |
| 75 // On Linux, text with halo is created by stroking it with 2px |halo_color| |
| 76 // then filling it with |text_color|. |
75 void DrawStringWithHalo(const std::wstring& text, | 77 void DrawStringWithHalo(const std::wstring& text, |
76 const gfx::Font& font, | 78 const gfx::Font& font, |
77 const SkColor& text_color, | 79 const SkColor& text_color, |
78 const SkColor& halo_color, | 80 const SkColor& halo_color, |
79 int x, int y, int w, int h, | 81 int x, int y, int w, int h, |
80 int flags); | 82 int flags); |
81 #endif | 83 #endif |
82 | 84 |
83 // Extracts a bitmap from the contents of this canvas. | 85 // Extracts a bitmap from the contents of this canvas. |
84 SkBitmap ExtractBitmap() const; | 86 SkBitmap ExtractBitmap() const; |
(...skipping 66 matching lines...) Loading... |
151 int x, int y, int w, int h, | 153 int x, int y, int w, int h, |
152 int flags); | 154 int flags); |
153 #endif | 155 #endif |
154 | 156 |
155 DISALLOW_COPY_AND_ASSIGN(CanvasSkia); | 157 DISALLOW_COPY_AND_ASSIGN(CanvasSkia); |
156 }; | 158 }; |
157 | 159 |
158 } // namespace gfx; | 160 } // namespace gfx; |
159 | 161 |
160 #endif // GFX_CANVAS_SKIA_H_ | 162 #endif // GFX_CANVAS_SKIA_H_ |
OLD | NEW |