Fix circles inherit alpha #2620 #2622
Merged
+1
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue (#2620) :
When using multiple LineDataSets like the follows:
the circles in
dataSet
will rendered with the alpha fromfadedSet
(0x8A
).The reason for this is that
mRenderPaint
is not reset properly before drawing the circles. The first timedrawCircles(...)
is called theimageCache.fill(...)
method is used where the color is set bymRenderPaint.setColor(set.getCircleColor(i))
, restoring the alpha to0xFF
. The second time homever,imageCache.fill(...)
is not called which means thatmRenderPaint
will use it's old color/alpha, which in this case is fromfadedSet
.Test info:
To trigger the issue, add the following to LineChartActivity1:
and launch the first item in the example app. Notice that the circles of
DataSet1
is now semi-transparent, instead of solid black.Solution:
This commit replaces
mRenderPaint
withnull
when drawing the circle bitmap. If a circleColor has been defined with a semi-transparent color, it will be drawn that way in the cached bitmap, hence the the bitmap itself does not need to be drawn with lower alpha.