MCPcopy Create free account
hub / github.com/RIP-Comm/clementine / brightness_decrease

Method brightness_decrease

emu/src/cpu/hardware/lcd.rs:483–494  ·  view source on GitHub ↗

Brightness decrease (fade to black): result = color - color * evy / 16

(color: Color, evy: u8)

Source from the content-addressed store, hash-verified

481 let evy = self.registers.get_blend_brightness();
482 Self::brightness_decrease(top_color, evy)
483 }
484 _ => top_color,
485 }
486 }
487
488 /// Alpha blend two colors: result = (color1 * eva + color2 * evb) / 16
489 fn alpha_blend(color1: Color, color2: Color, eva: u8, evb: u8) -> Color {
490 let blend_component = |c1: u8, c2: u8| -> u8 {
491 let result = (u16::from(c1) * u16::from(eva) + u16::from(c2) * u16::from(evb)) / 16;
492 result.min(31) as u8
493 };
494
495 Color::from_rgb(
496 blend_component(color1.red(), color2.red()),
497 blend_component(color1.green(), color2.green()),

Callers

nothing calls this directly

Calls 3

redMethod · 0.45
greenMethod · 0.45
blueMethod · 0.45

Tested by

no test coverage detected