Codenameone scale URLImage -
i tried converting urlimage encodedimage scale turned background black. conversion works fine, problem occurs when scale image. in guides says there size restrictions urlimages not understand how scale properly. if write example on how scale urlimages arbitrary size appreciate it.
here code used
//create form form hi = new form ("urlimage scaling"); try { //create placeholder image encodedimage placeholder = encodedimage.create("/dog.jpg").scaledencoded(492, 290); //get image web urlimage urlimg = urlimage.createtostorage(placeholder, "https://australianbananas.com.au/images/home/ripenessblend.png", "https://australianbananas.com.au/images/home/ripenessblend.png"); //try convert , scale encodedimage scaledimage = encodedimage.createfromimage(urlimg,false).scaledencoded(display.getinstance().getdisplaywidth(), -1); //display image using label label lbl = new label(); lbl.seticon(scaledimage); hi.add(lbl); } catch(exception e) {system.out.println(""+e);} hi.show();
scaling urlimage in way problematic because urlimage's "data" placeholder image until finished downloading. therefore, calling things encodedimage.createfromimage(urlimg, false)
create urlimage's placeholder image encoded image.
better correct size placeholder image before loading urlimage, , use appropriate "scale" parameter in call createtostorage()
image correctly mapped placeholder dimensions.
Comments
Post a Comment