diff options
author | Armin Le Grand (allotropia) <armin.le.grand.extern@allotropia.de> | 2022-11-10 12:03:55 +0100 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@me.com> | 2022-11-13 10:09:20 +0100 |
commit | 651142cbc6305b182a22efbdc4524e614483cf88 (patch) | |
tree | 6d4d36d9c35a99fc88e09e6b1aef676a59fd8fc7 /ridljar | |
parent | 55cd20e6228a06836285c14ca6726adb1bb4ffcb (diff) |
Adapted convertToBitmapEx to simpler BitmapEx creation
As long as not all our mechanisms are changed to RGBA
completely, mixing OutDev with Alpha (2x VDev) and RGB
target rendering is just too dangerous and expensive
and may to wrong or deliver bad quality results (see
comments in code for details).
Nonetheless we need a RGBA result for convert to
BitmapEx. Luckily we are able to create a copmplete
and valid AlphaChannel using 'createAlphaMask'.
Based n that we know the content (RGB result from
renderer), alpha (result from createAlphaMask) and
the start condition (content rendered usually
against COL_WHITE). Tht makes it possible to
calculate back the content, quasi 'remove' that
initial blending against COL_WHITE.
That is what the helper Bitmap::RemoveBlendedStartColor
does. Luckily we only need it for convert To BitmapEx,
not in any other rendering.
This gives good results, it is in principle comparable
with the results using pre-multiplied alpha tooling,
also slightly reducing the range of color values where
high alpha vlaues are used, but in areas that are
highly transparent anyways.
Also important is that this will work with RGB-based
system-dependent renderers, too. The method before
could only work with the VCL-based primitive renderers
by principle (only there - by coincidence - OutputDevice
with Alpha worked).
NOTE: Had to re-add usage of *unused* alpha channel
in convertToBitmapEx due to test SdPNGExportTest. It
somehow creates an Alpha in Bitmap size when I *remove*
Alpha in convertToBitmapEx, so I just keep it for now,
it is created anyways, just wanted to make it sleeker.
Change-Id: I12e47327f5793d6ed87e217a2355c608f528246f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142547
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'ridljar')
0 files changed, 0 insertions, 0 deletions