writeWithResolution
resolution == 0 => don't write the pHYs chunk
Parameters
- output:*std.Io.Writer
- *std.Io.Writer
- pixels:[]u8
- []u8
- width:u32
- u32
- height:u32
- u32
- resolution:u32
- u32
Source
Implementation
pub fn writeWithResolution(output: *std.Io.Writer, pixels: []u8, width: u32, height: u32, resolution: u32) !void {
std.debug.assert(output.buffer.len >= min_buffer_size);
var png_encoder = PNGEncoder{
.resolution = resolution,
.output = output,
};
const res = dvui.c.stbi_write_png_to_func(
&stbi_write_png_callback,
&png_encoder,
@intCast(width),
@intCast(height),
dvui.c.STBI_rgb_alpha,
pixels.ptr,
@intCast(width * 4),
);
if (res == 0) return dvui.StbImageError.stbImageError;
}