@ Override protected boolean prepare ( final Context2D context , final Attributes attr , final double alpha ) { final double w = attr . getWidth ( ) ; final double h = attr . getHeight ( ) ; final double r = attr . getCornerRadius ( ) ; if ( ( w > 0 ) && ( h > 0 ) ) { context . beginPath ( ) ; if ( ( r > 0 ) && ( r < ( w / 2 ) ) && ( r < ( h / 2 ) ) ) { context . moveTo ( r , 0 ) ; context . lineTo ( w - r , 0 ) ; context . arc ( w - r , r , r , ( Math . PI * 3 ) / 2 , 0 , false ) ; context . lineTo ( w , h - r ) ; context . arc ( w - r , h - r , r , 0 , Math . PI / 2 , false ) ; context . lineTo ( r , h ) ; context . arc ( r , h - r , r , Math . PI / 2 , Math . PI , false ) ; context . lineTo ( 0 , r ) ; context . arc ( r , r , r , Math . PI , ( Math . PI * 3 ) / 2 , false ) ; } else { context . rect ( 0 , 0 , w , h ) ; } context . closePath ( ) ; return true ; } return false ; }
Draws this rectangle .