Switch the Color struct back to storing unassociated alpha (#4518)

* Switch Color struct back to storing unassociated alpha

* Address review feedback

* Update the Invert node and legacy image migration for straight alpha and add round-trip tests

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
Dennis Kobert
2026-09-12 08:22:54 +00:00
committed by GitHub
co-authored by Keavon Chambers
parent e725f55043
commit 944d00cac5
13 changed files with 103 additions and 139 deletions
@@ -2123,7 +2123,9 @@ fn migrate_node(node_id: &NodeId, node: &DocumentNode, network_path: &[NodeId],
_ => None,
});
if let Some(image) = image {
if let Some(mut image) = image {
// Legacy embedded pixel data is premultiplied, so restore straight alpha before encoding it
image.data.iter_mut().for_each(|pixel| *pixel = pixel.to_unassociated_alpha());
let hash = document.resources.embedded.store(Resource::new(image.to_png()));
let resource_id = ResourceId::new();