blob: 5afae34c3bd9e7a7266040ad3c56fbd3a1bb513e [file] [log] [blame]
Kevin Lubick9b028372023-10-05 15:04:54 -04001/*
2 * Copyright 2023 Google LLC
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 EncodeUtils_DEFINED
9#define EncodeUtils_DEFINED
10
11class SkBitmap;
12class SkPixmap;
13class SkString;
14
15namespace ToolUtils {
16
17// Encodes the bitmap into a data:/image/png;base64,... url suitable to view in a browser after
18// printing to a log. If false is returned, dst holds an error message instead of a URI.
19bool BitmapToBase64DataURI(const SkBitmap& bitmap, SkString* dst);
20
21bool EncodeImageToPngFile(const char* path, const SkBitmap& src);
22bool EncodeImageToPngFile(const char* path, const SkPixmap& src);
23
24} // namespace ToolUtils
25
26#endif