Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I want to draw line with image pattern. #49

Open
AngelDev0329 opened this issue Jul 25, 2021 · 3 comments
Open

I want to draw line with image pattern. #49

AngelDev0329 opened this issue Jul 25, 2021 · 3 comments

Comments

@AngelDev0329
Copy link

How are you?
I am going to draw line with image pattern.

How can I do for this?
Could you guide me how can I do?

Thank you.

@LinusGeffarth
Copy link
Collaborator

Sorry, I'm not sure what you mean. Can you try to explain please?

@AngelDev0329
Copy link
Author

AngelDev0329 commented Jul 29, 2021

Thank you for your answer.

When draw line, you used this at 163 line of SwiftyDraw.swift file

override open func draw(_ rect: CGRect) {
    super.draw(rect)
    
    guard let context: CGContext = UIGraphicsGetCurrentContext() else { return }

    for item in drawItems {
        context.setLineCap(.round)
        context.setLineJoin(.round)
        context.setLineWidth(item.brush.width)
        context.setBlendMode(item.brush.blendMode.cgBlendMode)
        context.setAlpha(item.brush.opacity)

        if (item.isFillPath)
        {
            context.setFillColor(item.brush.color.uiColor.cgColor)
            context.addPath(item.path)
            context.fillPath()
        }
        else {
            context.setStrokeColor(item.brush.color.uiColor.cgColor)
            context.addPath(item.path)
            context.strokePath()
        }
    }
}

Then it will draw line.
But I want to line using some image pattern.
I didn't find any solution yet.
So I need your help.

Thank you.

@CHPisces
Copy link

draw line with image pattern.

Have you found a solution to this demand?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants