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_2_H_ | 5 #ifndef GFX_CANVAS_2_H_ |
6 #define GFX_CANVAS_2_H_ | 6 #define GFX_CANVAS_2_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "gfx/native_widget_types.h" | 10 #include "gfx/native_widget_types.h" |
11 // TODO(beng): remove this include when we no longer depend on SkTypes. | 11 // TODO(beng): remove this include when we no longer depend on SkTypes. |
12 #include "skia/ext/platform_canvas.h" | 12 #include "skia/ext/platform_canvas.h" |
13 | 13 |
14 namespace gfx { | 14 namespace gfx { |
15 | 15 |
16 class Canvas; | 16 class CanvasSkia; |
17 class Font; | 17 class Font; |
18 class Rect; | 18 class Rect; |
19 | 19 |
20 // TODO(beng): documentation. | 20 // TODO(beng): documentation. |
21 class Canvas2 { | 21 class Canvas2 { |
22 public: | 22 public: |
23 // Specifies the alignment for text rendered with the DrawStringInt method. | 23 // Specifies the alignment for text rendered with the DrawStringInt method. |
24 enum { | 24 enum { |
25 TEXT_ALIGN_LEFT = 1, | 25 TEXT_ALIGN_LEFT = 1, |
26 TEXT_ALIGN_CENTER = 2, | 26 TEXT_ALIGN_CENTER = 2, |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 int h) = 0; | 168 int h) = 0; |
169 virtual void TileImageInt(const SkBitmap& bitmap, int src_x, int src_y, | 169 virtual void TileImageInt(const SkBitmap& bitmap, int src_x, int src_y, |
170 int dest_x, int dest_y, int w, int h) = 0; | 170 int dest_x, int dest_y, int w, int h) = 0; |
171 | 171 |
172 // Extracts a bitmap from the contents of this canvas. | 172 // Extracts a bitmap from the contents of this canvas. |
173 virtual SkBitmap ExtractBitmap() const = 0; | 173 virtual SkBitmap ExtractBitmap() const = 0; |
174 | 174 |
175 // TODO(beng): remove this once we don't need to use any skia-specific methods | 175 // TODO(beng): remove this once we don't need to use any skia-specific methods |
176 // through this interface. | 176 // through this interface. |
177 // A quick and dirty way to obtain the underlying SkCanvas. | 177 // A quick and dirty way to obtain the underlying SkCanvas. |
178 virtual Canvas* AsCanvas() { return NULL; } | 178 virtual CanvasSkia* AsCanvasSkia() { return NULL; } |
179 }; | 179 }; |
180 | 180 |
181 class CanvasPaint2 { | 181 class CanvasPaint2 { |
182 public: | 182 public: |
183 virtual ~CanvasPaint2() {} | 183 virtual ~CanvasPaint2() {} |
184 | 184 |
185 // Creates a canvas that paints to |view| when it is destroyed. The canvas is | 185 // Creates a canvas that paints to |view| when it is destroyed. The canvas is |
186 // sized to the client area of |view|. | 186 // sized to the client area of |view|. |
187 static CanvasPaint2* CreateCanvasPaint(gfx::NativeView view); | 187 static CanvasPaint2* CreateCanvasPaint(gfx::NativeView view); |
188 | 188 |
189 // Returns true if the canvas has an invalid rect that needs to be repainted. | 189 // Returns true if the canvas has an invalid rect that needs to be repainted. |
190 virtual bool IsValid() const = 0; | 190 virtual bool IsValid() const = 0; |
191 | 191 |
192 // Returns the rectangle that is invalid. | 192 // Returns the rectangle that is invalid. |
193 virtual gfx::Rect GetInvalidRect() const = 0; | 193 virtual gfx::Rect GetInvalidRect() const = 0; |
194 | 194 |
195 // Returns the underlying Canvas2. | 195 // Returns the underlying Canvas2. |
196 virtual Canvas2* AsCanvas2() = 0; | 196 virtual Canvas2* AsCanvas2() = 0; |
197 }; | 197 }; |
198 | 198 |
199 } // namespace gfx; | 199 } // namespace gfx; |
200 | 200 |
201 #endif // GFX_CANVAS_2_H_ | 201 #endif // GFX_CANVAS_2_H_ |
OLD | NEW |