Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dark mode makes picture in book negative (inverted) #11574

Closed
ghost opened this issue Mar 19, 2024 · 3 comments · Fixed by #11578
Closed

dark mode makes picture in book negative (inverted) #11574

ghost opened this issue Mar 19, 2024 · 3 comments · Fixed by #11578
Labels
Milestone

Comments

@ghost
Copy link

ghost commented Mar 19, 2024

  • KOReader version: 2024.03.1 Latest
  • Device: PocketBook 633

I turn on the dark mode and starting reading the book, the first page is with the cover of the book.
The picture inside the book became negative (inverted) anyway (see photos)

It seems that in the settings I turn on invert images - it’s still a negative image, then I turn off the function - it’s still a negative image, not a real color one!

PHOTOS DESCRIBES PROBLEM
IMG_20240319_210825.jpg

IMG_20240319_210759.jpg

Help me fix it please.
Please fix it in the new version.

@Frenzie Frenzie added the MµPDF label Mar 19, 2024
@Frenzie
Copy link
Member

Frenzie commented Mar 19, 2024

I don't think MuPDF (easily) offers that through its API, but if it does it's still something that should probably be off by default (e.g., the whole document might consist of images, the images might count on transparency so you get black on black, etc.).

Interested parties could start investigating around fz_invert_pixmap and fz_gamma_pixmap.

@poire-z
Copy link
Contributor

poire-z commented Mar 19, 2024

I think this is not related to MuPDF: the bottom menu is the one we get with CRE.
And I guess, from the russian UI, that this is a FB2 document - and for FB2 document, the cover is something special drawn via a dedicated codepath (unlike other images in the FB2, or all image including the cover in EPUBs) where we don't do that inversion (because we just didn't think about it :/).
Not sure yet if it's easy to fix, I'll look at it, no promise.

@poire-z poire-z added CREngine and removed MµPDF labels Mar 19, 2024
@poire-z
Copy link
Contributor

poire-z commented Mar 19, 2024

OK, the fix looks easy, will push that in the coming days.

--- a/crengine/src/lvdocview.cpp
+++ b/crengine/src/lvdocview.cpp
@@ -1161,6 +1161,7 @@ void LVDocView::drawCoverTo(LVDrawBuf * drawBuf, lvRect & rc) {
                        dst_dy = imgrc.height();
                //CRLog::trace("drawCoverTo() - drawing image");
         LVColorDrawBuf buf2(src_dx, src_dy, 32);
+        buf2.setInvertImages(drawBuf->getInvertImages());
         buf2.Draw(imgsrc, 0, 0, src_dx, src_dy, true);
         drawBuf->DrawRescaled(&buf2, imgrc.left + (imgrc.width() - dst_dx) / 2,
                 imgrc.top + (imgrc.height() - dst_dy) / 2, dst_dx, dst_dy, 0);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants