1pub mod bmp_decoder {
2 use std::{io, result};
3
4 use crate::{codec::codecs::Decoder, codec::Result, Codec};
5
6 pub fn decode_stream(stream: &mut impl io::Read) -> result::Result<Codec, Result> {
7 decoder().from_stream(stream)
8 }
9
10 pub fn decoder() -> Decoder {
11 Decoder::construct(|decoder: *mut SkCodecs_Decoder| unsafe { skia_bindings::C_SkBmpDecoder_Decoder(uninitialized:decoder) })
12 }
13}
14
15pub mod gif_decoder {
16 use std::{io, result};
17
18 use crate::{codec::codecs::Decoder, codec::Result, Codec};
19
20 pub fn decode_stream(stream: &mut impl io::Read) -> result::Result<Codec, Result> {
21 decoder().from_stream(stream)
22 }
23
24 pub fn decoder() -> Decoder {
25 Decoder::construct(|decoder: *mut SkCodecs_Decoder| unsafe { skia_bindings::C_SkGifDecoder_Decoder(uninitialized:decoder) })
26 }
27}
28
29pub mod ico_decoder {
30 use std::{io, result};
31
32 use crate::{codec::codecs::Decoder, codec::Result, Codec};
33
34 pub fn decode_stream(stream: &mut impl io::Read) -> result::Result<Codec, Result> {
35 decoder().from_stream(stream)
36 }
37
38 pub fn decoder() -> Decoder {
39 Decoder::construct(|decoder: *mut SkCodecs_Decoder| unsafe { skia_bindings::C_SkIcoDecoder_Decoder(uninitialized:decoder) })
40 }
41}
42
43pub mod jpeg_decoder {
44 use std::{io, result};
45
46 use crate::{codec::codecs::Decoder, codec::Result, Codec};
47
48 pub fn decode_stream(stream: &mut impl io::Read) -> result::Result<Codec, Result> {
49 decoder().from_stream(stream)
50 }
51
52 pub fn decoder() -> Decoder {
53 Decoder::construct(|decoder: *mut SkCodecs_Decoder| unsafe { skia_bindings::C_SkJpegDecoder_Decoder(uninitialized:decoder) })
54 }
55}
56
57pub mod png_decoder {
58 use std::{io, result};
59
60 use crate::{codec::codecs::Decoder, codec::Result, Codec};
61
62 pub fn decode_stream(stream: &mut impl io::Read) -> result::Result<Codec, Result> {
63 decoder().from_stream(stream)
64 }
65
66 pub fn decoder() -> Decoder {
67 Decoder::construct(|decoder: *mut SkCodecs_Decoder| unsafe { skia_bindings::C_SkPngDecoder_Decoder(uninitialized:decoder) })
68 }
69}
70
71pub mod wbmp_decoder {
72 use std::{io, result};
73
74 use crate::{codec::codecs::Decoder, codec::Result, Codec};
75
76 pub fn decode_stream(stream: &mut impl io::Read) -> result::Result<Codec, Result> {
77 decoder().from_stream(stream)
78 }
79
80 pub fn decoder() -> Decoder {
81 Decoder::construct(|decoder: *mut SkCodecs_Decoder| unsafe { skia_bindings::C_SkWbmpDecoder_Decoder(uninitialized:decoder) })
82 }
83}
84
85#[cfg(feature = "webp-decode")]
86pub mod webp_decoder {
87 use std::{io, result};
88
89 use crate::{codec::codecs::Decoder, codec::Result, Codec};
90
91 pub fn decode_stream(stream: &mut impl io::Read) -> result::Result<Codec, Result> {
92 decoder().from_stream(stream)
93 }
94
95 pub fn decoder() -> Decoder {
96 Decoder::construct(|decoder| unsafe { skia_bindings::C_SkWebpDecoder_Decoder(decoder) })
97 }
98}
99