MaskImage problem

12 views
Skip to first unread message

Med Amine Chourou

unread,
May 9, 2020, 6:59:54 AM5/9/20
to CodenameOne Discussions
Good morning Sir,
I have a problem in the loading of the image
placeholder = (EncodedImage) resourceObjectInstance.getImage("toolbar-profile-pic.png");

Image img = URLImage.createToStorage(placeholder,"http://localhost/swr/web/uploads/"+ServiceUser.getInstance().affichuser(mail).get(0).getImage(), "http://localhost/swr/web/uploads/"+ServiceUser.getInstance().affichuser(mail).get(0).getImage(), URLImage.RESIZE_SCALE);

Label label1 = new Label(img);

int w = img.getWidth();

int h = img.getHeight();

Image maskImage = Image.createImage(w, h);

Graphics g = maskImage.getGraphics();

g.setAntiAliased(true);

g.setColor(0x000000);

g.fillRect(0, 0, w, h);

g.setColor(0xffffff);

g.fillArc(0, 0, w, h, 0, 360);

Label label2 = new Label(maskImage);

Object mask = maskImage.createMask();

Image maskedImage = img.applyMask(mask);

Label label3 = new Label(maskedImage);

getToolbar().addCommandToRightBar("",maskedImage, e -> {});
this is my code
when i open my account i must go to another page to see my picture

Shai Almog

unread,
May 9, 2020, 11:24:11 PM5/9/20
to CodenameOne Discussions
Hi,
I'm guessing you wrote that code after showing the form already. Ideally you should do these things before if possible. If not you need to revalidate the form.
Reply all
Reply to author
Forward
0 new messages