How to get the enclosed subpaths from a CGPath - ios

I am working on a drawing app. I have implemented the drawing string feature using CGPath. The next feature is that I can click on the view. If where I click includes an enclosed area, I can fill it with other colors. I am thinking that I need to get the enclosed subpath first, then fill color to it. Very much appreciate it if anyone can give me any idea. Thanks.
For you to understand it, I post a picture.

Okay, finally I found what I want is the "Flood Fill" Algorithm. If anyone wants to look for the referring article, please see here

Related

How to create a complex SVG layer fill animation based on CAShapeLayer

As you can understand from the title of this question I am trying to achieve fill animation of CALayer(CAShapeLayer) of SVG file.
How complex should be animation you can see from the images I attached.
I decided to start just with a circle and animate it to fill a layer below. Everything works pretty well.
So, I started building UIBezierPath or something like that but it looks like I am going the wrong direction.
I would really appreciate if you can just give me different ideas how to achieve it.
For SVG I use SVGKit. Maybe by using these set of classes, I can do something.
Thank you!

Core Plot - Filling color for multiple plots with bounded confidence intervals

I would like to plot multiple curves on a graph. These plots would have shading of a different color for each with certain bounds around them. Please let me know if anyone has any suggestions. I will really appreciate it.
Thank you,
Santosh
P.S.: I was not able to attach an image as illustration to understand the problem statement. My apologies. I have posted this question on the Google groups. Once approved, I will edit this post to add the link from there for the image.
This isn't easy right now. You might be able to make it work by creating a closed shape with the plot. Give it data points from left to right along the top of the curve and more points that define the bottom of the curve from right to left.
Core Plot issues 13 and 99 will address this problem, although there is no timeline for a fix right now.

Creating a new MKPolygon from two intersecting polygons

I know that there is exactly one specific question that talks about this but its a bit old and I wanted to get a little more technical about it if possible.
First of all take a look at this screenshot: https://www.dropbox.com/s/f94q3qaxrog0ec9/intersections.png
Want I want to have happen is say "I see where they both intersect and where that happens I do not want to draw those 'parts' of the polygon". In this case i would like to draw both polygons but not draw the 'path' of the yellow polygon that is inside the orange polygon. This include not only the line but the fill color as well.
Obviously this gets tricky because you aren't always going to have exact points along the path of each polygon that intersect exactly with other points along another polygon path. As you can see from this screenshot, in order to make this possible, I think, I need to get the points back where they do intersect.
After that and assuming that I can do this, I do not know if there is a way to use the CGPathRef class to do what i need to do. Obviously I am going to have re-create a polygon but according to the docs you cant fill it in unless it is a closed path. So how do you fill in the polygon that is not interesecting without closing the path??
The only thing that i can think of would be to "hide" the parts of the polygon that intersect but unsure how to do this. Can anyone offer any help/insight to this problem??
Here you go. I wrote an Objective-C wrapper around Alan's GPC library. Check out MKPolygon-GPC
Ok guys! well i went off and created my own MKPolygon category to solve what i needed to solve. I hope it is also useful to others!
the github link is: https://github.com/geeksweep/MKPolygon-GSPolygonIntersections
After days of investigation, here is the solution I found for Swift 4:
1) Go here and clone the project
2) Drag and drop the following in your project:
- MKPolygon+GPC.m
- MKPolygon+GPC.h
- gpc232 (folder)
3) Create a bridging header (here is a tutorial)
4) Open your bridging header file and add the following :
#import "MKPolygon+GPC.h"
5) In your View Controller , use this method to union your two Polygons :
let mergedPolygon = polygon1.fromUnion(with:polygon2)
NOTE : there is a crash in the current library, I fixed it but I am waiting my pull request to be reviewed. Thanks to SunGard-Labs for the framework !

Can glscissor clip multiple area?

i am stucked in a problem and looking for help here.
I want to clip the screen, only part of the screen can be displayed. I used glscissor and met a problem. It seems like glscissor can only difine ONE rectangle on the screen, but i hava to display multiple areas at the same time, can anyone tell me how to do?
thanks.
forgive my poor english
The scrissor is limited to one rectangle, indeed. If you want to clip to multiple rectangles, you can either draw everything once per clip-rectangle, or use the stencil buffer to mask the different areas.

How can I draw same images along a path using cocos2D iOS?

I trying to draw same images along a straight path.
I already know where the path begins and ends.
How can I make it?
Please Help.
Always thanks.
can you please Explain the condition,So that i can understand the way you want draw images...
As I understand your problem you want to draw series of same image along with a path, in that case you can use CCRibbon.

Resources