#include #include namespace ui { Result> Image::load(const os::Path& path) { auto image = TRY(make_shared()); auto file = TRY(os::File::open(path, os::File::ReadOnly)); TRY(file->read_typed(image->m_tga_header)); if (image->m_tga_header.encoding != 2) todo(); if (image->m_tga_header.bpp != 32) todo(); Buffer image_id; TRY(file->read(image_id, image->m_tga_header.idlen)); TRY(file->read(image->m_image_data, image->m_tga_header.w * image->m_tga_header.h * (image->m_tga_header.bpp / 8))); return image; } }