Closed GoogleCodeExporter closed 9 years ago
Can you post code and send a screenshot? I can't seem to reproduce. Here is
the code I tried.
public void paint(Graphics g) {
super.paint(g); //To change body of generated methods, choose Tools | Templates.
int x = getX();
int y = getY();
int w = getWidth();
int h = getHeight();
g.setColor(0xff4500);
g.fillRect(x, y, 500, 500);
GeneralPath p = new GeneralPath();
p.moveTo(x+10, y+10);
p.quadTo(x+100, y+20, x+150, y+100);
p.quadTo(x+50, y+150, x+20, y+200);
p.closePath();
g.setColor(0x0000ff);
g.fillShape(p);
}
And screenshot attached.
Original comment by st...@weblite.ca
on 18 Jul 2014 at 4:51
Attachments:
Note that the problem only occurs on iOS hardware, and not in the simulator.
The only difference appears to be that I use lineTo() instead of quadTo() to
build the shape. This is how I build the shape from a list of points:
private Shape buildShape(List<Point> points) {
GeneralPath shape = new GeneralPath();
boolean first = true;
for (Point p : points) {
if (first)
shape.moveTo(p.getX(), p.getY());
else
shape.lineTo(p.getX(), p.getY());
first = false;
}
return shape;
}
Attached you find a picture of the output on iOS.
(The blue area is drawn as a pie shape in clockwise direction on top of the
existing orange disc.)
Original comment by timo.van...@gmail.com
on 21 Jul 2014 at 8:00
Attachments:
Another difference was that I did not explicitly close the path of the shape.
Adding this call, however, makes no difference to the output.
Original comment by timo.van...@gmail.com
on 21 Jul 2014 at 9:02
Can you provide a full minimal working example. That is just a generic shape
builder function, and that is working fine for me with the shapes that I am
putting in. When you say it doesn't happen on the Simulator, do you mean the
codename one simulator, or the iOS simulator that is part of X-Code. I was
using the iOS simulator in Xcode, not the codename one simulator.
Original comment by st...@weblite.ca
on 21 Jul 2014 at 2:52
I was referring to the CN1 simulator.
(The attached image was taken from the screen of my iPad mini.)
Original comment by timo.van...@gmail.com
on 21 Jul 2014 at 2:56
The code below creates a nice white line when run on my iPad mini under iOS
7.1.2.
Interestingly, the (build time) screen shot that is displayed at startup does
not include the white line!
Place this component in the center of a border layout form:
public class Canvas extends Component {
@Override
public void paint(Graphics g) {
int x = getX();
int y = getY();
g.setColor(0x0FF9500);
g.fillRect(x, y, 500, 500);
GeneralPath p = new GeneralPath();
p.moveTo(x + 10, y + 10);
p.lineTo(x + 200, y + 100);
p.lineTo(x + 50, y + 150);
p.closePath();
g.setColor(0x0F7AFD);
g.fillShape(p);
}
}
Original comment by timo.van...@gmail.com
on 21 Jul 2014 at 6:09
Any news on the solution of this issue?
The current version still has this very same problem, and is blocking my
progress on another app...
Worse still, using drawShape() to draw a straight line between two points with
a (very) wide stroke demonstrated a bizarre width reduction when the line is
either horizontal or vertical. (Horizontal / vertical lines as part of a larger
shape appear to not have this problem.)
Is anybody using this code in production?
Original comment by timo.van...@gmail.com
on 5 Jan 2015 at 1:33
Steve, do you have an idea on this?
Original comment by shai.almog
on 5 Jan 2015 at 3:35
I have now reproduced this and fixed it locally. I need to run some tests to
make sure it doesn't introduce any regressions, but I'll have this in SVN
within the next couple of hours.
Original comment by steve.ha...@codenameone.com
on 5 Jan 2015 at 11:47
Fixed. Attached is a screenshot of the example posted running in Xcode's iOS
simulator.
Original comment by steve.ha...@codenameone.com
on 6 Jan 2015 at 12:04
Attachments:
Hi Steve,
Thank you for fixing this issue; you just made my day! :-)
Did you also look into (or fix) the mentioned problem with drawShape() of a
single straight hoizontal/vertical line and a (very) broad stroke on iOS? - It
looks as if the stroke algorithm fails when crossing the horizonal/vertical
axis.
Original comment by timo.van...@gmail.com
on 6 Jan 2015 at 8:41
Can you post a test case?
Original comment by steve.ha...@codenameone.com
on 6 Jan 2015 at 4:10
Hi Steve,
I submitted a new issue #1260 for this, which includes sample source code and a
screen photo from my iPad mini of its screen output.
Original comment by timo.van...@gmail.com
on 6 Jan 2015 at 5:25
I see. No this bug is probably not fixed yet but I think I know what is going
on. I should have a fix soon.
Original comment by steve.ha...@codenameone.com
on 6 Jan 2015 at 5:46
Original issue reported on code.google.com by
timo.van...@gmail.com
on 18 Jul 2014 at 8:02