| 1 |
/* |
| 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 |
|
| 11 |
class SkBitmap; |
| 12 |
class SkPixmap; |
| 13 |
class SkString; |
| 14 |
|
| 15 |
namespace 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. |
| 19 |
bool BitmapToBase64DataURI(const SkBitmap& bitmap, SkString* dst); |
| 20 |
|
| 21 |
bool EncodeImageToPngFile(const char* path, const SkBitmap& src); |
| 22 |
bool EncodeImageToPngFile(const char* path, const SkPixmap& src); |
| 23 |
|
| 24 |
} // namespace ToolUtils |
| 25 |
|
| 26 |
#endif |