diff --git a/Userland/Libraries/LibPDF/Renderer.cpp b/Userland/Libraries/LibPDF/Renderer.cpp index 4fd2e4589ed..ccb988576fc 100644 --- a/Userland/Libraries/LibPDF/Renderer.cpp +++ b/Userland/Libraries/LibPDF/Renderer.cpp @@ -1172,13 +1172,6 @@ PDFErrorOr Renderer::load_image(NonnullRefPtrfamily() == ColorSpaceFamily::Indexed) return Error(Error::Type::RenderingUnsupported, "16 bpp indexed images not yet supported"); @@ -1347,7 +1340,9 @@ PDFErrorOr Renderer::show_image(NonnullRefPtr image) // Move mask to alpha channel, and put current color in RGB. auto current_color = state().paint_style.get(); for (auto& pixel : *image_bitmap.bitmap) { - u8 mask_alpha = Color::from_argb(pixel).luminosity(); + // "a sample value of 0 marks the page with the current color, and a 1 leaves the previous contents unchanged." + // That's opposite of the normal alpha convention, and we're upsampling masks to 8 bit and use that as normal alpha. + u8 mask_alpha = 255 - Color::from_argb(pixel).luminosity(); pixel = current_color.with_alpha(mask_alpha).value(); } } else if (image_dict->contains(CommonNames::SMask)) {