| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef sk_tool_utils_DEFINED | 8 #ifndef sk_tool_utils_DEFINED |
| 9 #define sk_tool_utils_DEFINED | 9 #define sk_tool_utils_DEFINED |
| 10 | 10 |
| 11 #include "SkColor.h" |
| 11 #include "SkImageInfo.h" | 12 #include "SkImageInfo.h" |
| 12 #include "SkTypeface.h" | 13 #include "SkTypeface.h" |
| 13 | 14 |
| 14 class SkBitmap; | 15 class SkBitmap; |
| 15 class SkCanvas; | 16 class SkCanvas; |
| 16 class SkPaint; | 17 class SkPaint; |
| 18 class SkShader; |
| 17 class SkTestFont; | 19 class SkTestFont; |
| 18 | 20 |
| 19 namespace sk_tool_utils { | 21 namespace sk_tool_utils { |
| 20 | 22 |
| 21 const char* colortype_name(SkColorType); | 23 const char* colortype_name(SkColorType); |
| 22 | 24 |
| 23 /** | 25 /** |
| 24 * Sets the paint to use a platform-independent text renderer. | 26 * Sets the paint to use a platform-independent text renderer. |
| 25 */ | 27 */ |
| 26 void set_portable_typeface(SkPaint* paint, const char* name = NULL, | 28 void set_portable_typeface(SkPaint* paint, const char* name = NULL, |
| 27 SkTypeface::Style style = SkTypeface::kNormal); | 29 SkTypeface::Style style = SkTypeface::kNormal); |
| 28 SkTypeface* create_portable_typeface(const char* name, SkTypeface::Style sty
le); | 30 SkTypeface* create_portable_typeface(const char* name, SkTypeface::Style sty
le); |
| 29 void report_used_chars(); | 31 void report_used_chars(); |
| 30 | 32 |
| 31 /** | 33 /** |
| 32 * Call canvas->writePixels() by using the pixels from bitmap, but with an
info that claims | 34 * Call canvas->writePixels() by using the pixels from bitmap, but with an
info that claims |
| 33 * the pixels are colorType + alphaType | 35 * the pixels are colorType + alphaType |
| 34 */ | 36 */ |
| 35 void write_pixels(SkCanvas*, const SkBitmap&, int x, int y, SkColorType, SkA
lphaType); | 37 void write_pixels(SkCanvas*, const SkBitmap&, int x, int y, SkColorType, SkA
lphaType); |
| 36 | 38 |
| 37 // private to sk_tool_utils | 39 // private to sk_tool_utils |
| 38 SkTypeface* create_font(const char* name, SkTypeface::Style ); | 40 SkTypeface* create_font(const char* name, SkTypeface::Style ); |
| 39 SkTypeface* resource_font(const char* name, SkTypeface::Style ); | 41 SkTypeface* resource_font(const char* name, SkTypeface::Style ); |
| 40 | 42 |
| 43 /** Returns a newly created CheckerboardShader. */ |
| 44 SkShader* create_checkerboard_shader(SkColor c1, SkColor c2, int size); |
| 45 |
| 46 /** Draw a checkerboard pattern in the current canvas, restricted to |
| 47 the current clip. */ |
| 48 void draw_checkerboard(SkCanvas* canvas, |
| 49 SkColor color1, |
| 50 SkColor color2, |
| 51 int size); |
| 52 |
| 53 /** A default checkerboard. */ |
| 54 inline void draw_checkerboard(SkCanvas* canvas) { |
| 55 sk_tool_utils::draw_checkerboard(canvas, 0xFF999999, 0xFF666666, 8); |
| 56 } |
| 57 |
| 41 } // namespace sk_tool_utils | 58 } // namespace sk_tool_utils |
| 42 | 59 |
| 43 #endif // sk_tool_utils_DEFINED | 60 #endif // sk_tool_utils_DEFINED |
| OLD | NEW |