mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:48:11 +00:00
LibPDF: Implement the DCT filter
This filter basically tells us that we are dealing with a JPEG. Note that by serializing the resulting image we assume that this filter is the last one in the chain, everything else would be highly unlikely.
This commit is contained in:
parent
baaf42360e
commit
f926dfe36b
1 changed files with 5 additions and 3 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <AK/Hex.h>
|
||||
#include <LibCompress/Deflate.h>
|
||||
#include <LibGfx/JPGLoader.h>
|
||||
#include <LibPDF/CommonNames.h>
|
||||
#include <LibPDF/Filter.h>
|
||||
|
||||
|
@ -153,10 +154,11 @@ ErrorOr<ByteBuffer> Filter::decode_jbig2(ReadonlyBytes)
|
|||
TODO();
|
||||
};
|
||||
|
||||
ErrorOr<ByteBuffer> Filter::decode_dct(ReadonlyBytes)
|
||||
ErrorOr<ByteBuffer> Filter::decode_dct(ReadonlyBytes bytes)
|
||||
{
|
||||
// FIXME: Support dct decoding
|
||||
TODO();
|
||||
Gfx::JPGImageDecoderPlugin decoder(bytes.data(), bytes.size());
|
||||
auto frame = TRY(decoder.frame(0));
|
||||
return frame.image->serialize_to_byte_buffer();
|
||||
};
|
||||
|
||||
ErrorOr<ByteBuffer> Filter::decode_jpx(ReadonlyBytes)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue