On 04-06-2019 04:17, Alex X wrote:
I'm simply trying to draw some lines on in a Drawing Area but for some reason the lines always have some transparency even with Alpha set to 1(it seems about 50% ish).
I was using setLineWidth at 0.75 trying to get a "finer" line. I just set it to 1 and it seemed to reduce the transparency.. and if I set it to 2 then there is no transparency but is this because they are overlapping? I don't understand why the line with would modify the alpha in any way(except for > 1 which would be overlap).
...
Any ideas? It's as if there is some global setting that set's the alpha then everything else is with respect to it. If I draw the same line over itself it gets darker(which is a solution but then requires me drawing everything more than once and doesn't explain what is going on).
Cairo uses the OVER
operator by default, which will blend the
background and what your drawing together. So for your case you will
want to change it to SOURCE
.
cr.setOperator(CairoOperator.SOURCE);
More information about the operators: https://cairographics.org/operators/