Img not working

57 views
Skip to first unread message

nikhil baby

unread,
Mar 19, 2016, 11:50:01 AM3/19/16
to DroidScript
This code is not working
the image is not drawn
what is wrong with this? ??

//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.
DrawPicture();
}

function DrawPicture()
{
//Fill image with solid white.
img.SetColor( "#ffffffff" );


img.DrawImage( "/Sys/Img/Hello.png", 0.2, 0.5, 0.2, 0.2);
}

Steve Garman

unread,
Mar 19, 2016, 12:03:09 PM3/19/16
to DroidScript
DrawImage doesn't take a file, it takes an image.

Try:


function DrawPicture()
{
//Fill image with solid white.
img.SetColor( "#ffffffff" );

var hello =app.CreateImage( "/Sys/Img/Hello.png");
img.DrawImage( hello,0.2, 0.5, 0.2, 0.2);
}

nikhil baby

unread,
Mar 19, 2016, 12:15:20 PM3/19/16
to DroidScript
Thanks!
I forgot that!

Syed Munawer Hassan

unread,
Mar 30, 2016, 3:25:56 AM3/30/16
to DroidScript
You can also change image at any time by using img.SetImage("image path") property 
Reply all
Reply to author
Forward
0 new messages