core-image

kCGImageAlphaNone unresolved identifier in swift

扶醉桌前 提交于 2019-12-01 06:39:18
I am trying to convert images/textures (for SpriteKit) to grayscale with CoreImage in Swift : I found this answer : https://stackoverflow.com/a/17218546/836501 which I try to convert to swift for iOS7/8 But kCGImageAlphaNone doesn't exist. Instead I can use CGImageAlphaInfo.None but the function CGBitmapContextCreate() doesn't like it as its last parameter. I am obliged to use the enum CGBitmapInfo but there doesn't seem to be the kCGImageAlphaNone equivalent inside. This is the full line with the wrong parameter (last one) : var context = CGBitmapContextCreate(nil, UInt(width), UInt(height),

kCGImageAlphaNone unresolved identifier in swift

你离开我真会死。 提交于 2019-12-01 05:58:59
问题 I am trying to convert images/textures (for SpriteKit) to grayscale with CoreImage in Swift : I found this answer : https://stackoverflow.com/a/17218546/836501 which I try to convert to swift for iOS7/8 But kCGImageAlphaNone doesn't exist. Instead I can use CGImageAlphaInfo.None but the function CGBitmapContextCreate() doesn't like it as its last parameter. I am obliged to use the enum CGBitmapInfo but there doesn't seem to be the kCGImageAlphaNone equivalent inside. This is the full line

How to apply full-screen SKEffectNode for post-processing in SpriteKit

核能气质少年 提交于 2019-12-01 05:27:24
I'm trying out SpriteKit with the following setup: An SKScene with two child nodes used merely for grouping other nodes: foreground and background. background is really empty as of now, but would eventually hold some type of background sprite / layers. foreground is a SKEffectNode and whenever the user taps on the screen, a new intance of a SKnode subclass which represents a game element is added as child to it. This SKNode subclass basically creates 3 SKShapeNodes and two labels: an outter circumference, an inner circumference, 2 labels and an inner quarter circumference. The inner quarter

Flip NSImage on both axes

∥☆過路亽.° 提交于 2019-12-01 04:24:35
I'm trying to flip an NSImage created with a NSImageBitmapRep representation. After some digging ( Flipping Quicktime preview & capture and Mirroring CIImage/NSImage ) I tried two ways via a CIImage and applying a scaling transformation with -1 for both factors. First using CIImage imageByApplyingTransform: NSBitmapImageRep *imgRep = ... CGImageRef cgi = [imgRep CGImage]; CIImage *cii = [CIImage imageWithCGImage:cgi]; CGAffineTransform at = CGAffineTransformTranslate(CGAffineTransformMakeScale(-1, -1), 0, 0); NSCIImageRep *ciiRep = [NSCIImageRep imageRepWithCIImage:[cii

How to apply full-screen SKEffectNode for post-processing in SpriteKit

六眼飞鱼酱① 提交于 2019-12-01 03:58:35
问题 I'm trying out SpriteKit with the following setup: An SKScene with two child nodes used merely for grouping other nodes: foreground and background. background is really empty as of now, but would eventually hold some type of background sprite / layers. foreground is a SKEffectNode and whenever the user taps on the screen, a new intance of a SKnode subclass which represents a game element is added as child to it. This SKNode subclass basically creates 3 SKShapeNodes and two labels: an outter

What can be the solution of a deprecated of “EAGLContext”?

别等时光非礼了梦想. 提交于 2019-12-01 01:38:15
I want to use the native filters for my app, the function works but I want to avoid methods that will be removed from the documentation. I search over the whole internet and no solution. I search over the whole internet and i haven't found any solution at my problem. public func applyFilterTo(image: UIImage, filterEffect: Filter) -> UIImage? { guard let cgImage = image.cgImage, let openGLContext = EAGLContext(api: .openGLES3) else { return nil } let context = CIContext(eaglContext: openGLContext) let ciImage = CIImage(cgImage: cgImage) let filter = CIFilter(name: filterEffect.filterName)

Getting a CGImage from CIImage

房东的猫 提交于 2019-11-30 17:17:27
I have a UIImage which is loaded from a CIImage with: tempImage = [UIImage imageWithCIImage:ciImage]; The problem is I need to crop tempImage to a specific CGRect and the only way I know how to do this is by using CGImage . The problem is that in the iOS 6.0 documentation I found this: CGImage If the UIImage object was initialized using a CIImage object, the value of the property is NULL. A. How to convert from CIImage to CGImage? I'm using this code but I have a memory leak (and can't understand where): +(UIImage*)UIImageFromCIImage:(CIImage*)ciImage { CGSize size = ciImage.extent.size;

is there a way to run 2 NSAnimation objects simultaneously?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 14:06:28
问题 I created 2 NSAnimation objects of flipping the view with another view. I'd like to run 2 these animations simultaneously. I cannot use NSViewAnimation , since it's now about animating any of view properties. Here is the animation creation: self.animation = [[[TransitionAnimation alloc] initWithDuration:1.0 animationCurve:NSAnimationEaseInOut] autorelease]; [self.animation setDelegate:delegate]; [self.animation setCurrentProgress:0.0]; [self.animation startAnimation]; I tried to link 2

Remove background from Image & take only Image part for save in iOS

二次信任 提交于 2019-11-30 11:40:05
问题 This is what i need to achieve: Take image from camera or Gallery Remove background from image & save it Background should be anything black or white Also need to remove shadow along with the background Result Example: Original Image Result Image This is what i have tried: CGFloat colorMasking[6]={222,255,222,255,222,255}; CGImageRef imageRef = CGImageCreateWithMaskingColors([IMG CGImage], colorMasking); UIImage *resultThumbImage = [UIImage imageWithCGImage:imageRef scale:ThumbImage.scale

Remove background from Image & take only Image part for save in iOS

六眼飞鱼酱① 提交于 2019-11-30 00:52:47
This is what i need to achieve: Take image from camera or Gallery Remove background from image & save it Background should be anything black or white Also need to remove shadow along with the background Result Example: Original Image Result Image This is what i have tried: CGFloat colorMasking[6]={222,255,222,255,222,255}; CGImageRef imageRef = CGImageCreateWithMaskingColors([IMG CGImage], colorMasking); UIImage *resultThumbImage = [UIImage imageWithCGImage:imageRef scale:ThumbImage.scale orientation:IMG.imageOrientation]; Its only work on white background. Its not more effective. I need to