mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 08:36:15 +00:00
LibGfx: Add BMP loader
Adds an *almost fully featured BMP loader to process .bmp files. Features: - All header formats are supported - Full RLE4/8/24 support - Color scaling (e.g. distributing a 5-bit color throughout the 8-bit color spectrum, so 5-bit white is still 0xffffff) - Full BITMASK/ALPHABITMASK support *Not included: - 1D Huffman compression. Good luck actually finding a bmp in the wild that uses this - Use of any field in the V4/V5 header. Color spaces? Endpoints? No thanks :) This loader was tested with the images at https://entropymine.com/jason/bmpsuite/bmpsuite/html/bmpsuite.html. This loader correctly displays 81 out of the 90 total images (for reference, firefox displays 64 correctly). Note that not rendering the images at the bottom is counted as displaying correctly.
This commit is contained in:
committed by
Andreas Kling
parent
dfe5b232f4
commit
4e093a7c23
@@ -25,6 +25,7 @@
|
||||
*/
|
||||
|
||||
#include <LibGfx/ImageDecoder.h>
|
||||
#include <LibGfx/BMPLoader.h>
|
||||
#include <LibGfx/GIFLoader.h>
|
||||
#include <LibGfx/PNGLoader.h>
|
||||
|
||||
@@ -40,6 +41,10 @@ ImageDecoder::ImageDecoder(const u8* data, size_t size)
|
||||
if (m_plugin->sniff())
|
||||
return;
|
||||
|
||||
m_plugin = make<BMPImageDecoderPlugin>(data, size);
|
||||
if (m_plugin->sniff())
|
||||
return;
|
||||
|
||||
m_plugin = nullptr;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user