BOOTIL_EXPORT bool Load( Bootil::Buffer & buf, Bootil::Image::Format & imageout ) { stbi s; start_mem( &s, ( const uint8* ) buf.GetBase(), buf.GetWritten() ); if ( !stbi_jpeg_test( &s ) ) { return false; } int x, y, comp; unsigned char* pData = stbi_jpeg_load( &s, &x, &y, &comp, 3 ); imageout.width = x; imageout.height = y; imageout.alpha = false; imageout.data.Write( pData, x * y * 3 ); stbi_image_free( pData ); return true; }
int stbi_bmp_test_memory (stbi_uc const *buffer, int len) { stbi s; start_mem(&s, buffer, len); return bmp_test(&s); }