It appears that the Dc.setFill()
function is not working as expected.
Below is some sample code that draws a toggle switch and demonstrates the issue:
public function setEnabled( isEnabled as Boolean ) as Void {
var dc = _bufferedBitmap.getDc();
dc.clear();
if( isEnabled ) {
//dc.setColor( 0xe64a19, Graphics.COLOR_BLACK );
dc.setFill( 0xe64a19 );
} else {
//dc.setColor( Graphics.COLOR_LT_GRAY, Graphics.COLOR_BLACK );
dc.setFill( Graphics.COLOR_LT_GRAY );
}
var radius = dc.getWidth() / 2;
var lowerYCenter = dc.getHeight() - radius;
dc.fillCircle( radius, radius, radius );
dc.fillCircle( radius, lowerYCenter, radius );
dc.fillRectangle( 0, radius, dc.getWidth(), lowerYCenter - radius );
//dc.setColor( Graphics.COLOR_GREEN, Graphics.COLOR_BLACK );
dc.setFill( Graphics.COLOR_GREEN );
var toggleCenter = isEnabled ? radius : lowerYCenter;
dc.fillCircle( radius, toggleCenter, radius * 0.8 );
}
Expected Behavior:
When running the code using setColor()
, the result looks correct and as intended.
Observed Behavior:
When using Dc.setFill()
, the rendered output does not appear as it should.
-
It seems that
Dc.fillCircle()
is ignoring the fill color set byDc.setFill()
. -
Additionally, a call to
setFill()
after afillRectangle()
call still appears to affect the already drawn rectangle, which should not happen.