mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 08:32:11 +01:00
Have wuffs_aux SelectPixfmt default to BGRA_PREMUL
This commit is contained in:
1 parent
decb64e5ea
commit
57ad55355b
5 files changed
+28
-19
No files matched your search
@@ -89,6 +89,17 @@ wuffs_aux::MemOwner g_pixbuf_mem_owner(nullptr, &free);
|
||||
wuffs_base__slice_u8 g_pixbuf_mem_slice = {0};
|
||||
uint32_t g_background_color_index = 0;
|
||||
|
||||
class MyCallbacks : public wuffs_aux::DecodeImageCallbacks {
|
||||
public:
|
||||
// This override is redundant - it is the same as the default
|
||||
// implementation. It exists because this is example code and shows how to
|
||||
// decode to other pixel formats such as BGR_565 or RGBA_NONPREMUL.
|
||||
wuffs_base__pixel_format //
|
||||
SelectPixfmt(const wuffs_base__image_config& image_config) override {
|
||||
return wuffs_base__make_pixel_format(WUFFS_BASE__PIXEL_FORMAT__BGRA_PREMUL);
|
||||
}
|
||||
};
|
||||
|
||||
bool //
|
||||
load_image(const char* filename) {
|
||||
FILE* file = stdin;
|
||||
@@ -108,7 +119,7 @@ load_image(const char* filename) {
|
||||
g_pixbuf_mem_owner.reset();
|
||||
g_pixbuf_mem_slice = wuffs_base__empty_slice_u8();
|
||||
|
||||
wuffs_aux::DecodeImageCallbacks callbacks;
|
||||
MyCallbacks callbacks;
|
||||
wuffs_aux::sync_io::FileInput input(file);
|
||||
wuffs_aux::DecodeImageResult res = wuffs_aux::DecodeImage(
|
||||
callbacks, input,
|
||||
|
||||
Reference in new issue
Block a user