•   over 10 years ago

Fill in the UIBezierPath generated from createUIBezierPath

So I've come to understand the following about the UIBezierPath generated from the WILL sdk:

The stroke of the bezier line encloses the 'pen stroke' fill shape.

In other words, what is normally considered the stroke of the bezier path is actually the fill of the bezier path, surrounded by the actual stroke. (That's confusing, I hope I conveyed it correctly!)
So that's all well and good, because it provides a more precise pen stroke shape. However, this means you can't use the bezier's functionality to fill in the bezier path, because it's just filling in the existing pen stroke.

Does the WILL sdk have any way to fill in the actual area of the caShapeLayer it creates when generating the UIBezierPath, and not just the pen stroke? How do I fill in the WILL pen stroke shape?

  • 3 comments

  • Manager   •   over 10 years ago

    Hi Justin Lennox,

    Thanks for your question! Currently the WCMBezierPathUtil can only calculate the bounds only the “pen stroke.” Below is some code that could help.

    The code is a plain conversion from Catmull-Rom to Bezier (each catmull-rom curve is converted to a bezier curve). The bezier curve is then closed.

    Note that the width of the stroke does not play a role.

    Best,
    Serena

    This code extends the Stroke class from the tutorials:

    -(CGPathRef) createClosedCGPath
    {
    CGMutablePathRef path = CGPathCreateMutable();

    int n = self.pointsCount;

    for (int i = 1; i

  •   •   over 10 years ago

    Hey Serena! Thanks for the quick response. Unfortunately I believe it may have been cut short in the middle of the createClosedCGPath method!

  • Manager   •   over 10 years ago

    Oh no! You're right! I'm sorry about that. Here's a link to the full method: https://challenges.s3.amazonaws.com/wacom/Inkathon_WCMBezierPathUtil.docx

    Best,
    Serena

Comments are closed.