blob: 33bfd56df2c8bc8f53bb7c1dffb678a3f14f8312 [file] [log] [blame]
Mike Reed331ccfd2018-10-25 12:36:06 -04001/*
2 * Copyright 2018 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 SkTextUtils_DEFINED
9#define SkTextUtils_DEFINED
10
11#include "SkCanvas.h"
12#include "SkPaint.h"
13#include "SkFont.h"
14#include "SkString.h"
15
16class SkTextUtils {
17public:
18 static void DrawText(SkCanvas*, const void* text, size_t size, SkScalar x, SkScalar y,
19 const SkPaint&, SkPaint::Align = SkPaint::kLeft_Align);
20
21 static void DrawString(SkCanvas* canvas, const char text[], SkScalar x, SkScalar y,
22 const SkPaint& paint, SkPaint::Align align = SkPaint::kLeft_Align) {
23 DrawText(canvas, text, strlen(text), x, y, paint, align);
24 }
25 static void DrawString(SkCanvas* canvas, const SkString& str, SkScalar x, SkScalar y,
26 const SkPaint& paint, SkPaint::Align align = SkPaint::kLeft_Align) {
27 DrawText(canvas, str.c_str(), str.size(), x, y, paint, align);
28 }
29};
30
31#endif