Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkJpegxlDecoder.h
Go to the documentation of this file.
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#ifndef SkJpegxlDecoder_DEFINED
8#define SkJpegxlDecoder_DEFINED
9
13
14class SkData;
15class SkStream;
16
17#include <memory>
18
19namespace SkJpegxlDecoder {
20
21/** Returns true if this data claims to be a JPEGXL image. */
22SK_API bool IsJpegxl(const void*, size_t);
23
24/**
25 * Attempts to decode the given bytes as a JPEGXL.
26 *
27 * If the bytes are not a JPEGXL, returns nullptr.
28 *
29 * DecodeContext is ignored
30 */
31SK_API std::unique_ptr<SkCodec> Decode(std::unique_ptr<SkStream>,
33 SkCodecs::DecodeContext = nullptr);
34SK_API std::unique_ptr<SkCodec> Decode(sk_sp<SkData>,
36 SkCodecs::DecodeContext = nullptr);
37
38inline constexpr SkCodecs::Decoder Decoder() {
39 return { "jpegxl", IsJpegxl, Decode };
40}
41
42} // namespace SkJpegxlDecoder
43
44#endif // SkJpegxlDecoder_DEFINED
#define SK_API
Definition SkAPI.h:35
constexpr SkCodecs::Decoder Decoder()
SK_API bool IsJpegxl(const void *, size_t)
SK_API std::unique_ptr< SkCodec > Decode(std::unique_ptr< SkStream >, SkCodec::Result *, SkCodecs::DecodeContext=nullptr)