Skip to content

Commit

Permalink
Add tag to RawImage
Browse files Browse the repository at this point in the history
  • Loading branch information
fschutt committed Nov 23, 2024
1 parent 3ef428a commit 7e31b69
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion api.json
Original file line number Diff line number Diff line change
Expand Up @@ -11367,7 +11367,8 @@
{"width": {"type": "usize", "doc": "Width of the image"}},
{"height": {"type": "usize", "doc": "Height of the image"}},
{"alpha_premultiplied": {"type": "bool", "doc": "Whether the image already has the alpha channel premultiplied"}},
{"data_format": {"type": "RawImageFormat", "doc": "Which data format (channels) the image uses"}}
{"data_format": {"type": "RawImageFormat", "doc": "Which data format (channels) the image uses"}},
{"tag": {"type": "U8Vec", "doc": "Optional tag for this image"}}
],
"constructors": {
"empty": {
Expand Down
5 changes: 5 additions & 0 deletions azul-core/src/app_resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@ impl ImageRef {
height: image_descriptor.height,
premultiplied_alpha: true,
data_format: image_descriptor.format,
tag: Vec::new().into(),
}),
_ => None,
}
Expand Down Expand Up @@ -1490,6 +1491,7 @@ pub struct RawImage {
pub height: usize,
pub premultiplied_alpha: bool,
pub data_format: RawImageFormat,
pub tag: U8Vec,
}

impl RawImage {
Expand All @@ -1501,6 +1503,7 @@ impl RawImage {
height: 0,
premultiplied_alpha: true,
data_format: RawImageFormat::BGRA8,
tag: Vec::new().into(),
}
}

Expand All @@ -1514,6 +1517,7 @@ impl RawImage {
height: size.height as usize,
premultiplied_alpha: true,
data_format: RawImageFormat::R8,
tag: Vec::new().into()
}
}

Expand Down Expand Up @@ -1547,6 +1551,7 @@ impl RawImage {
pixels,
mut data_format,
premultiplied_alpha,
tag,
} = self;

const FOUR_BPP: usize = 4;
Expand Down

0 comments on commit 7e31b69

Please sign in to comment.