Shortcut for making [`Histogram`] with `add_fixed_color` Set `gamma` to `0.` for sRGB colors.
(attr: &Attributes, palette: &[RGBA], gamma: f64)
| 293 | /// |
| 294 | /// Set `gamma` to `0.` for sRGB colors. |
| 295 | pub fn from_palette(attr: &Attributes, palette: &[RGBA], gamma: f64) -> Result<Self, Error> { |
| 296 | if palette.len() > MAX_COLORS { |
| 297 | return Err(Unsupported); |
| 298 | } |
| 299 | |
| 300 | let mut hist = Histogram::new(attr); |
| 301 | for &c in palette { |
| 302 | hist.add_fixed_color(c, gamma)?; |
| 303 | } |
| 304 | hist.quantize(attr) |
| 305 | } |
| 306 | |
| 307 | /// Getter for the value set in [`set_dithering_level`] |
| 308 | pub fn dithering_level(&self) -> f32 { |
nothing calls this directly
no test coverage detected