I need to get a CGColor from a CGGradientRef, and use the color as a stroke colour in a drawing app for iOS 7. Is that possible?
Can I get a CGColor from CGGradient?
709 Views Asked by maharet313 At
1
There are 1 best solutions below
Related Questions in IOS
- Overlapping UICollectionView in storyboard
- Cannot pod spec lint because of undeclared type errors
- Is the transactionReceipt data present in dataWithContentsOfURL?
- UIWebView Screen Fitting Issue
- ZXingObjC encoding issues
- iOS: None of the valid provisioning profiles allowed the specific entitlements
- How to hide "Now playing url" in control center
- CloudKit: Preventing Duplicate Records
- Slow performance on ipad erasing image
- Swift code with multiple NSDateFormatter - optimization
- iOS 8.3 Safari crashes on input type=file
- TTTTimeIntervalFormatter always returns strings in English
- How do I add multiple in app purchases in Swift Spritekit?
- Setup code for xibs in iOS. -awakFromNb:
- iOS Voice Over only reads out the title of any alert views
Related Questions in CORE-GRAPHICS
- Drawing in UIView on touch points gives blurr drawing effect on boundaries
- Resolution Loss when generating an Image from UIImageView
- Draw/Paint like sketch color inside a bezier path in UIView
- Best performant way to check if an image is all white?
- How can I animate some subviews of a UIViewController "off" the screen, and other views "on" the screen?
- How to draw an arrow inside a disk?
- How can I set the UINavigationbar with gradient color?
- How to get displayID of display application currently displayed on?
- How to cut the shape of a logo(png image) from another image programmatically in Swift?
- UIGraphicsGetImageFromCurrentImageContext crash when using a queue
- Change CGSize with a variable
- Add a semi-transparent layer to UIImage using Core Graphics
- CGDisplayCopyAllDisplayModes leaves out one valid mode
- Gradient defined by trigonometric function in core graphics
- How does CALayer geometryFlipped behave exactly?
Related Questions in DRAWRECT
- Is it safe to call [subview setNeedsDisplay] inside [superview drawRect:]?
- Why are 2 lines rendered with this code (drawRect)?
- UIBezierPath only renders part in clip rect when drawn from a view's drawRect/draw(_:)?
- CALayer drawrect Anti-Aliasing didn't worked
- How many ways to calculate the FPS (Frames per second) of an iOS App programmatically?
- iOS : WHO'S in charge of refreshing UI/Screen while UITableView's scrolling?
- Create hundreds of uiview and move them from right to left then dealloc them
- iOS drawing goes wrong when drawing view is transformed
- DrawRect, FillRect and DrawOval anomaly
- UIView class properties seemingly disappear when I call drawRect:
- Drawrect memory leak
- Gesture Recognizer Blocking TouchesEnded
- Custom NSProgressIndicator drawrect always called while hidden
- inserting an image in view or delegate
- DrawRect Square/Rectangle user values
Related Questions in CGPATH
- Remove self intersections from Bezier Path
- Swift 3 (SpriteKit): Change the properties of each line in CGPath
- How to get the correctly region to crop an UIImage?
- Sprite Kit/ SKShapeNode: excluding overlap of shapes
- Calculate points for borders inside and outside of a polygon
- SKAction followPath, creating the path
- Swift 3 Gesture Recognizers path.boundingBox is infinite
- How to animate drawing part of CGPath
- Is it possible to covert CGRect into CGPathRef ? - Objective C
- Cut CGPath from UIView
- How to get point on the graph in iPhone Line graph
- combine multiple CAAnimation sequentially
- Constructing CAShapeLayer from a multiple CGpaths
- CAShapeLayer Slow User Interaction
- CGPath masked off CGPoints
Related Questions in CGCOLOR
- How do I get the RGB values of a UIColor?
- How to get cgcolor from nscolor with pattern image using swift?
- swift 5.3 - CGColor.init(red: r, green: g, blue: b, alpha: 1.0) returns NSObject for macOs
- Efficiently Modifying CGColor
- Got [Not A Type class]: message sent to deallocated instance error?
- Change color of an UIImage with masking and replacing that image with a colored image
- UIImageView Border Color
- Can I get a CGColor from CGGradient?
- Best way to manage memory with NSColor and CGColor
- Why CGContextSetFillColorWithColor filling wrong color in a rectangle area in ios
- Colorwithpattern for coreimage color
- Can you mix views of different colours to create new colours?
- How to store CGColor in Core Data?
- How do I convert a CGColor into an NSObject when using Monotouch?
- Convert CGColorRef address to UIColor
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
You could draw the gradient to an image context, get the pixel buffer for the image, then create a color from that pixel (see this post).
Otherwise,
CGGradientRefis an opaque type, and there isn't any way to get information out of it. For my own apps, I've also created a wrapper object aroundCGGradientRefthat creates the gradient and stores the colors / locations it was created with.