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
Created attachment 164448 [details] testing file File I tested with.
Created attachment 164449 [details] screenshot of expected output Screen grab of the document's window, showing the expected output.
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.
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.
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.
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.
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
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.
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?
(In reply to Mike Kaganski from comment #9) > 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? Exports using the TIFF format (both whole slide and as a selection) do not exhibit any of the problems this or my previous bug listed (but I need PNG files). Perhaps model the PNG export after however TIFF handles it?
Could that be the issue when you're not working with pre-multiplied alpha? https://ciechanow.ski/alpha-compositing/
(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?
Please tell me this disaster isn't going to make it into the final release of 7.1
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
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.
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
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?
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
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.
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
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