Created
February 28, 2016 12:53
-
-
Save codenameone/2515be7528ef3e402ec0 to your computer and use it in GitHub Desktop.
Demonstrates the URLImage mask adapter usage in Codename One. This mask adapter will turn all downloaded images into circular images
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Image roundMask = Image.createImage(placeholder.getWidth(), placeholder.getHeight(), 0xff000000); | |
Graphics gr = roundMask.getGraphics(); | |
gr.setColor(0xffffff); | |
gr.fillArc(0, 0, placeholder.getWidth(), placeholder.getHeight(), 0, 360); | |
URLImage.ImageAdapter ada = URLImage.createMaskAdapter(roundMask); | |
Image i = URLImage.createToStorage(placeholder, "fileNameInStorage", "http://xxx/myurl.jpg", ada); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sample usage of URLImage.
From the Codename One project