WGradient does not render properly with alpha

Added by Ulf Johnsson 9 months ago

The image to the left shows how it should be rendered and the image to the right shows how it is rendered in Wt using WGradient.
No red should be visible at all in this gradient.

The gradient that is used is a linear-gradient using 2 color stops:
1) rgba(255,0,0,0) // fully transperant red
2) rgba(0,0,255,255) // fully visible blue

When trying this on w3schools.com it renders like the first left image.

BR, Ulf Johnsson.


Replies (3)

RE: WGradient does not render properly with alpha - Added by Roel Standaert 9 months ago

I've tried it out and double-checked it with Inkscape, and there's definitely supposed to be more red in there than there is in the left image. I'm pretty confident that the render on the right is the correct way to render it. How are you rendering the left image, exactly?

RE: WGradient does not render properly with alpha - Added by Ulf Johnsson 9 months ago

The left image is rendered using the same settings through the gradient system in Qt.
But it is also rendered like the left image using html/css

<!DOCTYPE html>
<html>
<head>
<style>
#grad1 {
    height: 200px;
    background: linear-gradient(to right, rgba(255,0,0,0), rgba(0,0,255,1));
}
</style>
</head>
<body>
<div id="grad1"></div>
</body>
</html>

BR, Ulf.

RE: WGradient does not render properly with alpha - Added by Roel Standaert 6 months ago

Looks like Qt and CSS have different color interpolation behavior than SVG and <canvas>, causing Wt to have different behavior than Qt. I'm not sure what can be done about that, though.

Regards,
Roel

(1-3/3)