Does the Shape API works on iOS and simulator?

30 views
Skip to first unread message

Fabrizio Grassi

unread,
Jul 17, 2015, 2:18:48 AM7/17/15
to codenameone...@googlegroups.com


Simulator
Device iOS 6

Hi,
I tried to draw on the screen, everything I draw with Graphics.xxx() methods is shown but Graphics.drawShape(GeneralPath, Stroke).
On Android it works well.

Steve Hannah

unread,
Jul 17, 2015, 2:22:06 AM7/17/15
to codenameone...@googlegroups.com

Yes. It should work.  Can you post some code that isn't working for you?

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discu...@googlegroups.com.
Visit this group at http://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/fe00fc22-e9ef-419a-9903-2f9b8dab293d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Fabrizio Grassi

unread,
Jul 17, 2015, 7:09:34 AM7/17/15
to codenameone...@googlegroups.com
hi steve

Image shine02 = Image.createImage(w,
                h);
        Graphics g = shine02.getGraphics();
        g.setColor(0xcc00cc);
        g.fillRect(0, 0, g.getClipWidth(), g.getClipHeight());
        strokeWidth = g.getClipWidth() / 3;
        strokecolor = 0xff33ff;
        stroke = new Stroke(strokeWidth, Stroke.CAP_SQUARE, Stroke.JOIN_MITER, 4f);
        gp = new GeneralPath();
        gp.moveTo(0, 0);
        gp.lineTo(g.getClipWidth(), g.getClipHeight());
        g.setColor(strokecolor);
        g.drawShape(gp, stroke);
this should produce a purple square with a lighter stripe from NW to SE but on Simulator and on iOS 6 it paints only a purple square.

Shai Almog

unread,
Jul 17, 2015, 10:10:56 AM7/17/15
to codenameone...@googlegroups.com, rbr...@gmail.com
Hi,
these API's are supported when drawing to the screen and not on mutable images in iOS.
Since drawing to mutable images is inherently slower on iOS you should try to avoid it if areMutableImagesSlow() returns true.

Steve Hannah

unread,
Jul 17, 2015, 10:27:02 AM7/17/15
to codenameone...@googlegroups.com, rbr...@gmail.com
This should work on the CN1 simulator though.  Can you confirm that it isn't working for you on the simulator?

Steve

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discu...@googlegroups.com.
Visit this group at http://groups.google.com/group/codenameone-discussions.

For more options, visit https://groups.google.com/d/optout.



--
Steve Hannah
Software Developer
Codename One

Fabrizio Grassi

unread,
Jul 17, 2015, 10:47:51 AM7/17/15
to codenameone...@googlegroups.com
Yes, I confirm but I also noticed that the simulator behave differently: the color of the rectangle is not the one I chose, instead it is of the color of the shape(the lighter one)...
Shai, is there an alternative method to create images on the fly?

Shai Almog

unread,
Jul 18, 2015, 12:34:32 AM7/18/15
to codenameone...@googlegroups.com, rbr...@gmail.com
No. I think there is an RFE to add this to images on iOS. Its just a completely different code base.
Reply all
Reply to author
Forward
0 new messages