RoundRect

25 views
Skip to first unread message

Samsung Galaxy

unread,
Jan 2, 2016, 12:14:20 PM1/2/16
to DroidScript
Hi everybody!Happy New Year!
My question is :How to draw rounded edges rectangle ?for beauty.
Sorry for my English.
Thanks

Elmer Martens

unread,
Jan 6, 2016, 1:54:07 PM1/6/16
to DroidScript

//Called when application is started. 
function OnStart() 

    //Create a layout with objects vertically centered. 
    lay = app.CreateLayout( "Linear", "FillXY" );     
     
    //Create a blank image. 
    img = app.CreateImage( null, 0.8, 0.8 ); 
    lay.AddChild( img ); 

    //Add layout to app.     
    app.AddLayout( lay ); 
     
    //Draw our picture. 
    DrawRoundedRect(); 


function DrawRoundedRect() 
{
     img.SetColor( "#FFFFFF" );
     img.SetPaintStyle( "Line" );
     img.SetLineWidth( 2.5 ); 
     img.SetPaintColor( "#ff0000ee"  );

     img.DrawLine( 0.75, 0.3, 0.75, 0.5 );
     img.DrawLine( 0.35, 0.3, 0.35, 0.5 );

     img.DrawLine( 0.4, 0.27, 0.7, 0.27 );
     img.DrawLine( 0.4, 0.53, 0.7, 0.53 );

     img.DrawArc( 0.65, .27, 0.75, 0.33, 0, -90 );
     img.DrawArc( 0.65, 0.47, 0.75, 0.53, 0, 90 );
     img.DrawArc( 0.35, 0.47, 0.45, 0.53, 90, 90 );
     img.DrawArc( 0.35, 0.27, 0.45, 0.33, -90, -90 );
}

Samsung Galaxy

unread,
Jan 9, 2016, 8:54:12 AM1/9/16
to DroidScript
Thanks , looks good
Reply all
Reply to author
Forward
0 new messages