canselcik / libremarkable

The only public framework for developing applications with native refresh support for Remarkable Tablet
MIT License
607 stars 57 forks source link

Black text incorrectly drawn #130

Closed granolaonicecream closed 3 days ago

granolaonicecream commented 1 week ago

Issue

When using black text, all pixels are being drawn as white, making it appear as if the text is not being drawn at all if against a white background. This is very apparent in the demo, as it is mostly text.

Cause

Regression from #123

The new function to determine pixel color becomes constant when the coverage parameter is zeroed out by the rgb component value. That said, it looks like the calculation of c1,c2,c3 is also redundant so this formula could be cleaned up.

Relevant code:

let components = col.to_rgb8();
let c1 = f32::from(255 - components[0]);
...
color::RGB(
    (255.0 + (c1 - 255.0) * v) as u8, ...
fenollp commented 3 days ago

Fixed in https://github.com/canselcik/libremarkable/pull/131