Bug 135910 - Transparent objects either possess outlines when none are defined or are completely opaque, depending on export PNG options
Summary: Transparent objects either possess outlines when none are defined or are comp...
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
7.1.0.0.alpha0+
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisected, bisected, regression
Depends on:
Blocks:
 
Reported: 2020-08-19 09:25 UTC by xordevoreaux
Modified: 2022-08-29 09:54 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
testing file (463.87 KB, application/vnd.oasis.opendocument.graphics)
2020-08-19 09:26 UTC, xordevoreaux
Details
screenshot of expected output (778.96 KB, image/png)
2020-08-19 09:27 UTC, xordevoreaux
Details
PNG output of entire page (990.78 KB, image/png)
2020-08-19 09:29 UTC, xordevoreaux
Details
PNG output of selection (586.21 KB, image/png)
2020-08-19 09:30 UTC, xordevoreaux
Details
Black semi-transparent rectangle on black background (8.83 KB, application/vnd.oasis.opendocument.graphics)
2020-08-19 21:44 UTC, Mike Kaganski
Details
Perfect output (except that it's a TIF not a PNG) (1.26 MB, image/tiff)
2020-08-27 16:59 UTC, xordevoreaux
Details
testing document round 2 (487.11 KB, application/vnd.oasis.opendocument.graphics)
2020-08-27 17:04 UTC, xordevoreaux
Details
skia with rendering 7.2.0.0 alpha 0 (620.17 KB, image/png)
2020-11-23 17:09 UTC, xordevoreaux
Details

Note You need to log in before you can comment on or make changes to this bug.
Description xordevoreaux 2020-08-19 09:25:07 UTC
Description:
Exporting to PNG an ODF's drawing slide with transparent objects leaves those transparent objects with either a gray/white border around them when no border was selected, or leaves the transparent objects completely opaque.

Which occurs depends on the output type. If "selection only" is selected, the transparent objects are opaque.

If one exports the entire slide's contents, the transparent objects are transparent, but bordered when they should be.

Steps to Reproduce:
1. Launch Draw
2. Insert a picture
3. Draw a shape over the picture
4. Set the shape's border to None
5. Set the shape's transparency to 100% (I also set its color to black)
6. Export the slide either as:
6a. The entire slide
6b. The selected objects only (in this case, all objects were selected).

Actual Results:
When exporting the entire slide, a gray/white border appears around the transparent object.

When exporting the slide with the "Selection" option checked on the export dialog box, the transparent objects appear opaque in the final output.

Expected Results:
Regardless of export method, the transparent object should appear transparent, and should not have border artifacts if a border of None was selected for the transparent object.


Reproducible: Always


User Profile Reset: No



Additional Info:
Skia rendering selected with anti-aliasing.

Version: 7.1.0.0.alpha0+ (x64)
Build ID: <buildversion>
CPU threads: 8; OS: Windows 10.0 Build 20190; UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL

Tested with the daily build available as of 2020.08.18. I lifted this from the version.ini file:

BuildVersion=<buildversion>
buildid=82189fdc93ac337e1de3379d678eca6b7654e6fc
ExtensionUpdateURL=http://updateexte.libreoffice.org/ExtensionUpdateService/check.Update
MsiProductVersion=7.1.0.0.alpha0
ProductCode={B9BAD41C-55C4-4886-9539-48BB387F388E}
ReferenceOOoMajorMinor=4.1
Comment 1 xordevoreaux 2020-08-19 09:26:16 UTC
Created attachment 164448 [details]
testing file

File I tested with.
Comment 2 xordevoreaux 2020-08-19 09:27:34 UTC
Created attachment 164449 [details]
screenshot of expected output

Screen grab of the document's window, showing the expected output.
Comment 3 xordevoreaux 2020-08-19 09:29:02 UTC
Created attachment 164450 [details]
PNG output of entire page

Output of a PNG when "selection" in the export dialog is NOT checked.
Transparent objects on the output of a gray/white border.
Comment 4 xordevoreaux 2020-08-19 09:30:14 UTC
Created attachment 164451 [details]
PNG output of selection

PNG output when the slide's entire contents are selected and "selection" in the export dialog box IS checked.

The transparent object renders opaque with a gray/white border.
Comment 5 xordevoreaux 2020-08-19 09:34:56 UTC
This was my original description:
If one exports the entire slide's contents, the transparent objects are transparent, but bordered when they should be.

It should have read:
If one exports the entire slide's contents, the transparent objects are transparent, but bordered when they should NOT be.
Comment 6 Mike Kaganski 2020-08-19 10:30:39 UTC
Repro with Version: 7.1.0.0.alpha0+ (x64)
Build ID: 5923d4173d5000d3462fa6e55952bfc5101b6bfa
CPU threads: 12; OS: Windows 10.0 Build 19041; UI render: default; VCL: win
Locale: ru-RU (ru_RU); UI: en-US
Calc: CL

=> not Skia-dependent.
Comment 7 Telesto 2020-08-19 13:55:48 UTC
Not in 
Version: 7.0.0.0.beta1+ (x64)
Build ID: 2891e91a513520d68ea2b8c59c14335861a15253
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: nl-NL (nl_NL); UI: en-US
Calc: CL

needs to bibisected with 7.1
Comment 8 Mike Kaganski 2020-08-19 21:44:59 UTC
Created attachment 164477 [details]
Black semi-transparent rectangle on black background

This is a simpler reproducing document.
Exporting it as PNG produces the light frame on black rectangle's borders. Exporting selection produces a semi-transparent rectangle.
Comment 9 Mike Kaganski 2020-08-19 21:50:24 UTC
The problem is that now, when the painting of objects happens on a clear transparent vdev, painting the object (e.g. rectangle in case of attachment 164477 [details]), happening in two stages (RGB separately, alpha separately), only sees white background while drawing RGB. AA makes the painting to blend with the background on edges, which results in the borders of the shape to become light (and semi-transparent, but the unintended *color* change happens anyway).

I suppose that it should instead somehow see that the pixels it blends with are completely transparent, and then do not change color, and only apply AA to transparency. But I don't yet have an idea how to perform that in out weird separated (RGB / Alpha) graphics.

Thorsten, quikee, Lubos: possibly you have some ideas?
Comment 10 xordevoreaux 2020-08-20 07:20:15 UTC Comment hidden (obsolete)
Comment 11 xordevoreaux 2020-08-20 07:20:15 UTC Comment hidden (obsolete)
Comment 12 Tomaz Vajngerl 2020-08-20 16:18:30 UTC
Could that be the issue when you're not working with pre-multiplied alpha? 

https://ciechanow.ski/alpha-compositing/
Comment 13 Mike Kaganski 2020-08-21 08:28:10 UTC
(In reply to Tomaz Vajngerl from comment #12)

Sure! But does this mean that we must re-implement the whole graphic stack to work with pre-multiplied bitmaps? E.g., when I create a transparent buffer, and use it as current vdev in a process() call, which would mean unknown number of nested calls, and ultimately primitives drawing polylines or (possibly RGBA) bitmaps on vdevs, so they all need to take care to work with pre-multiplied colors IIUC. Or do I overcomplicate because of poor understanding the topic?
Comment 14 xordevoreaux 2020-08-26 17:59:46 UTC Comment hidden (no-value)
Comment 15 xordevoreaux 2020-08-27 16:59:54 UTC
Created attachment 164768 [details]
Perfect output (except that it's a TIF not a PNG)

The attached image is absolutely freaking PERFECT in terms of how I would expect PNG to be exported. Only problem, it's not PNG, it's a TIF file. Do whatever it is that happens with the TIF export for PNG, and you got it.

1. Set rendering to Skia/anti-aliased.
2. Created LO draw file
3. Set margins to None
4. Add stuff, including various transparent objects, images, text, and curves
5. Set background to a black 1024x1024 bitmap (necessary to avoid Bug 117160)
6. Export as TIF

Version: 7.1.0.0.alpha0+ (x64)
Build ID: 6640d7f405d2970ba2825a9455926cc803284d01
CPU threads: 8; OS: Windows 10.0 Build 20201; UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL
Comment 16 xordevoreaux 2020-08-27 17:04:44 UTC
Created attachment 164769 [details]
testing document round 2

Testing file for the image results. First slide has a black background 1024x1024 bitmap, send slide has no background.
Comment 17 xordevoreaux 2020-09-11 12:51:58 UTC
Still happening in 

Version: 7.1.0.0.alpha0+ (x64)
Build ID: ed4f610f4a3de12016f8308a17b6ad4f86e9d67a
CPU threads: 8; OS: Windows 10.0 Build 20211; UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL
Comment 18 xordevoreaux 2020-10-23 14:09:36 UTC
So I'm a bit concerned here. 3 days to go before a bug hunt, and all of the transparency bugs are still unassigned. Are these going to fall through the cracks and wind up as persistent bugs in 7.1?
Comment 19 xordevoreaux 2020-11-23 17:04:40 UTC
Still a problem with 7.2.0.0 alpha 0, both scenarios, exported as an entire slide and just the objects selected and exported as selection, which forces everything opaque.

Version: 7.2.0.0.alpha0+ (x64)
Build ID: f313e27fb7f2d42247407e26e16f264e30f87ca5
CPU threads: 8; OS: Windows 10.0 Build 20262; UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: threaded
Comment 20 xordevoreaux 2020-11-23 17:09:53 UTC
Created attachment 167503 [details]
skia with rendering 7.2.0.0 alpha 0

Left is the drawing document as depicted on screen, right is the exported result as a PNG having selected the objects and exported with the Selection checked.
Comment 21 Attila Baraksó (NISZ) 2020-11-30 16:03:47 UTC
Bibisected using linux-64-7.1 to:
URL: https://cgit.freedesktop.org/libreoffice/core/commit?id=bf021c369f2306ee507da9bd3cc4cd10ac5d234c
author: Mike Kaganski <mike.kaganski@collabora.com>
committer: Mike Kaganski <mike.kaganski@collabora.com>
summary: tdf#135500: always use transparent and clear content vdev in impBufferDevice

Adding Cc: Mike Kaganski
Comment 22 xordevoreaux 2020-12-20 21:52:41 UTC
No longer able to reproduce, using either PNG export method, in:

Version: 7.2.0.0.alpha0+ (x64)
Build ID: 315c7570c4a72f4c834086082825533b1e50d1bf
CPU threads: 8; OS: Windows 10.0 Build 21277; UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL]

nor in:

Version: 7.2.0.0.alpha0+ (x64)
Build ID: 315c7570c4a72f4c834086082825533b1e50d1bf
CPU threads: 8; OS: Windows 10.0 Build 21277; UI render: default; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL