I want to make a path that has a png as it’s pattern, or if you could or think it would be easier to make my own pattern, then tell me that also. I will be greatful to anyone who can put up some code. Thanks in advance
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I don’t know if I understand your question correctly. Are you trying to fill or stroke the path with the pattern? I guess the way to go is:
CGPatternCreate(). This function takes a lot of parameters, among them a pointer to a drawing callback function that will be called whenever the pattern is used. So you would place your code to draw the PNG image in this function. Create aCGImageand useCGContextDrawImage()to draw it into the graphics context provided by the callback function.CGContextSetFillColorSpace()orCGContextSetStrokeColorSpace()withCGColorSpaceCreatePattern()to set a pattern color space (necessary for the next step).CGContextSetFillPattern()orCGContextSetStrokePattern()to tell Quartz to use your pattern for filling/stroking.CGContextDrawPath()to draw the path.Refer to the docs for more info on all these functions.