getValueSaturationTexture
Parameters
- hue:f32
- f32
Source
Implementation
pub fn getValueSaturationTexture(hue: f32) dvui.Backend.TextureError!dvui.Texture {
var h = dvui.fnv.init();
h.update("value");
h.update(std.mem.asBytes(&(hue * 10000)));
const id = h.final();
if (dvui.textureGetCached(id)) |cached| return cached else {
var pixels: [4]Color.PMA = .{ .white, .cast(Color.HSV.toColor(.{ .h = hue })), .black, .black };
// set top right corner to the max value of that hue
const texture = try dvui.textureCreate(&pixels, .{ .width = 2, .height = 2 });
dvui.textureAddToCache(id, texture);
return texture;
}
}