| 1 |
/* |
| 2 |
* Copyright 2024 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 |
#ifndef SkPngRustDecoder_DEFINED |
| 8 |
#define SkPngRustDecoder_DEFINED |
| 9 |
|
| 10 |
#include <memory> |
| 11 |
|
| 12 |
#include "include/codec/SkCodec.h" |
| 13 |
#include "include/private/base/SkAPI.h" |
| 14 |
|
| 15 |
class SkStream; |
| 16 |
|
| 17 |
namespace SkPngRustDecoder { |
| 18 |
|
| 19 |
/** Returns true if this data claims to be a PNG image. */ |
| 20 |
SK_API bool IsPng(const void*, size_t); |
| 21 |
|
| 22 |
SK_API std::unique_ptr<SkCodec> Decode(std::unique_ptr<SkStream>, |
| 23 |
SkCodec::Result*, |
| 24 |
SkCodecs::DecodeContext = nullptr); |
| 25 |
|
| 26 |
inline constexpr SkCodecs::Decoder Decoder() { return {"png", IsPng, Decode}; } |
| 27 |
|
| 28 |
} // namespace SkPngRustDecoder |
| 29 |
|
| 30 |
#endif // SkPngRustDecoder_DEFINED |