blob: e9bda5f982a12d7de6d7fd3c2e5a92602155c46d [file] [log] [blame]
commit-bot@chromium.org4cd9e212014-03-07 03:25:16 +00001/*
2 * Copyright 2014 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef sk_tool_utils_DEFINED
9#define sk_tool_utils_DEFINED
10
tfarina20108912014-06-21 10:54:17 -070011#include "SkImageInfo.h"
caryclark5fb6bd42014-06-23 11:25:00 -070012#include "SkTypeface.h"
commit-bot@chromium.org4cd9e212014-03-07 03:25:16 +000013
Cary Clark992c7b02014-07-31 08:58:44 -040014class SkBitmap;
15class SkCanvas;
16class SkPaint;
17class SkTestFont;
skia.committer@gmail.comdb0c8752014-03-18 03:02:11 +000018
Cary Clark992c7b02014-07-31 08:58:44 -040019namespace sk_tool_utils {
caryclark5fb6bd42014-06-23 11:25:00 -070020
commit-bot@chromium.orga713f9c2014-03-17 21:31:26 +000021 const char* colortype_name(SkColorType);
commit-bot@chromium.org4cd9e212014-03-07 03:25:16 +000022
23 /**
caryclark5fb6bd42014-06-23 11:25:00 -070024 * Sets the paint to use a platform-independent text renderer.
25 */
Cary Clark992c7b02014-07-31 08:58:44 -040026 void set_portable_typeface(SkPaint* paint, const char* name = NULL,
27 SkTypeface::Style style = SkTypeface::kNormal);
28 SkTypeface* create_portable_typeface(const char* name, SkTypeface::Style style);
29 void report_used_chars();
caryclark5fb6bd42014-06-23 11:25:00 -070030
31 /**
commit-bot@chromium.org4cd9e212014-03-07 03:25:16 +000032 * Call canvas->writePixels() by using the pixels from bitmap, but with an info that claims
33 * the pixels are colorType + alphaType
34 */
35 void write_pixels(SkCanvas*, const SkBitmap&, int x, int y, SkColorType, SkAlphaType);
commit-bot@chromium.org4cd9e212014-03-07 03:25:16 +000036
Cary Clark992c7b02014-07-31 08:58:44 -040037 // private to sk_tool_utils
38 SkTypeface* create_font(const char* name, SkTypeface::Style );
39 SkTypeface* resource_font(const char* name, SkTypeface::Style );
40
tfarina20108912014-06-21 10:54:17 -070041} // namespace sk_tool_utils
42
43#endif // sk_tool_utils_DEFINED