[HTML5 - Canvas/WebGL - Lime 7.2.0 - Openfl 8.7.0] BitmapData.draw ignores source alpha


#1

Hi,
after the upgrade to the latest libs I’m having an additional problem with BitmapData: the draw function ignores the alpha applied to the source image.
In

source.alpha = 0.1;
bmd.draw(source,...);

draw ignores 0.1 and draws source with alpha = 1;

I had to go back to Lime 7.1.1+Openfl 8.6.4.

Additionally, Matrix is still unable to resample the source correctly.


#2

This is expected:

You will need to use ColorTransform if you want to draw with an alpha transformation, otherwise the displayObject.alpha is ignored :slight_smile:

Are you sampling up or down? What are you rendering?


#3

Good, alpha fixed! Thank you, are there other similar changes in BitmapData? I am not sure it is reported in the Changelog…

Sampling down, but I would expect a correct resampling on both up and down, right?


#4

This was a side-effect of the canvas renderer ignoring the renderer-specific alpha multiplier. We use this to ignore the alpha of an object when we call bitmapData.draw, but it only behaved this way when using native targets, not HTML5, due to this overlooked mistake in the canvas renderer.

It was represented in the changelog as “Improved the rendering of cacheAsBitmap objects with alpha” as it fixed some bugs in cacheAsBitmap rendering.

We effectively perform a render with a scale applied. How a scaled down render is accomplished is a little different depending on the renderer. Does the smoothing property make a difference? :slight_smile:


#5

No, I tried to set smoothing in the BitmapData, in the Bitmap, everywhere was possible but nothing changed.