Debian Codegraph @

experimental/rust_bmp/decoder/SkBmpRustDecoder.h

raw
1 /*
2 * Copyright 2025 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 SkBmpRustDecoder_DEFINED
8 #define SkBmpRustDecoder_DEFINED
9
10 #include "include/codec/SkCodec.h"
11 #include "include/core/SkRefCnt.h"
12 #include "include/private/base/SkAPI.h"
13
14 class SkData;
15 class SkStream;
16
17 #include <memory>
18
19 namespace SkBmpRustDecoder {
20
21 /** Returns true if this data claims to be a BMP image. */
22 SK_API bool IsBmp(const void*, size_t);
23
24 /**
25 * Attempts to decode the given bytes as a BMP using Rust implementation.
26 *
27 * If the bytes are not a BMP, returns nullptr.
28 */
29 SK_API std::unique_ptr<SkCodec> Decode(std::unique_ptr<SkStream>,
30 SkCodec::Result*,
31 SkCodecs::DecodeContext = nullptr);
32 SK_API std::unique_ptr<SkCodec> Decode(sk_sp<const SkData>,
33 SkCodec::Result*,
34 SkCodecs::DecodeContext = nullptr);
35
36 inline constexpr SkCodecs::Decoder Decoder() {
37 return { "rust_bmp", IsBmp, Decode };
38 }
39
40 } // namespace SkBmpRustDecoder
41
42 #endif // SkBmpRustDecoder_DEFINED