Incorrect results for gradient mask
mgrudzinska opened this issue · comments
Mira Grudzinska commented
//Rect
auto shape1 = tvg::Shape::gen();
shape1->appendRect(100, 100, 600, 600);
shape1->fill(0, 0, 255);
shape1->strokeWidth(100);
shape1->strokeFill(0, 255, 0);
//Mask
auto mask1 = tvg::Shape::gen();
mask1->appendCircle(400, 400, 450, 450);
auto fill1 = tvg::LinearGradient::gen();
fill1->linear(0, 400, 800, 400);
tvg::Fill::ColorStop colorStops1[2];
colorStops1[0] = {0,255,0,0,255};
colorStops1[1] = {1,0,0,255,255};
fill1->colorStops(colorStops1, 2);
mask1->fill(std::move(fill1));
shape1->composite(std::move(mask1), tvg::CompositeMethod::AlphaMask);
canvas->push(std::move(shape1));
No gradient should be observed since AlphaMask should use only the alpha value and for both colors 255 is set
Hermet Park commented
ThorVG composes a mask image using 8-bit channel data, currently, the gradient mask does not utilize this.