You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
when rendering pixels with opacity (like backgrounds, fill-areas, halos, ..) as the first layer, the color-values are multiplied by the opacity factor. e.g.
rgba(255,255,255,0.5) gets to rgba(128,128,128,0.5)
rgba(255,0,0,0.8) gets to rgba(204,0,0,0.8)
In OpenGL, we use premultiplied colors because it simplifies color blending a lot. Once we have finished rendering the image, we retrieve it from the GPU. In the case of the command line utilities, we're using encodePNG, which gets the image data, and then "unpremultiplies" it, since PNG only supports non-premultiplied colors.
The Node binding however, returns the premultiplied image buffer as is, and expects the encoder to unpremultiply in case they need to convert it to a PNG. We do it this way, because some users of the library require premultiplied colors as input (e.g. when blending it with further images before encoding as PNG).
I suggest you check the library you use whether it supports premultiplied input, or request that feature from its author.
Platform:
Node
Mapbox SDK version:
mapbox-gl-native@3.5.2
when rendering pixels with opacity (like backgrounds, fill-areas, halos, ..) as the first layer, the color-values are multiplied by the opacity factor. e.g.
rgba(255,255,255,0.5) gets to rgba(128,128,128,0.5)
rgba(255,0,0,0.8) gets to rgba(204,0,0,0.8)
Steps to trigger behavior
run the attached test-script: opacitytest.zip
Expected behavior
an image with color: rgba(255,0,0,0.8)
Actual behavior
an image with color: rgba(204,0,0,0.8)
thanks for help!
regards. max.
The text was updated successfully, but these errors were encountered: