Post

Replies

Boosts

Views

Activity

CIFilter documentation for CIMaximumComponent?
I am beginning to work in Core Image and applying some filters. Most that I have encountered are fairly easy to understand but a few are confusing me. As I need a mono image I came across two: CIMaximumComponent and the corresponding CIMinimumComponent. There are others too but the description of these two is pretty sparse. Can someone expand just a little so I can understand the difference? It mentions max(r,g,b) and min of the same, what is the source of r,g,b and how is the result applied?
1
0
857
Jan ’23
Unable to create simple CGContext in Playground. What am I doing wrong?
I am trying to create a simple bitmap image. I was able to create one using an IOS-based (UIKit) playground but I am unable to to do it in a MacOs (Quartz) framework. I think those are the right terms ... I'm a newbee at this! My code, below, is needlessly verbose but I wanted to understand every part. The key is the CGContext call at the bottom, for every iteration it has returned NULL and fails. I have tried it with the current data: nil and supplying a data: &Data reference for the image. Both attempts fail. I must be doing (or assuming) something incorrectly. Here's the code: import PlaygroundSupport import Cocoa import CoreGraphics let tftWidthPixels = 240 let tftHeightPixels = 135 let tftSize = CGSize(width: tftWidthPixels, height: tftHeightPixels) // Border for guideline extensions let topBorderPixels = 200 let leftBorderPixels = 200 let pixelSizeWidth = 10  // This seems to work well let pixelSizeHeight = pixelSizeWidth  // Square let pixelSize = CGSize(width: pixelSizeWidth, height: pixelSizeHeight) // This should (must?) be odd let lineWidth = 3 // We outline every tft pixel let imageVerticalLines = tftWidthPixels + 1 let imageHorizontalLines = tftHeightPixels + 1 let imageHeightPixels = tftHeightPixels * pixelSizeHeight + topBorderPixels let imageWidthPixels = tftWidthPixels * pixelSizeWidth + leftBorderPixels let bitsPerByte = 8 let bytesPerPixel = 4 let bitsPerPixel = bytesPerPixel * bitsPerByte let bytesPerRow = bytesPerPixel * imageWidthPixels let imageSize = CGSize(width: imageWidthPixels, height: imageHeightPixels) let imageSizeBytes = imageWidthPixels * imageHeightPixels * bytesPerPixel let startRow = (lineWidth % 2 + Int(lineWidth/2) - 1) + topBorderPixels // Allow for pixel overlap let startColumn = (lineWidth % 2 + Int(lineWidth/2) - 1) + leftBorderPixels let lineColorNormal = CGColor(gray: 0.5, alpha: 1.0) let lineColorDark = CGColor(gray: 0.25, alpha: 1.0) let borderLineColor = CGColor(gray: 0.1, alpha: 1.0) let pageFillColor = CGColor.white let imageFormat = CIFormat.ARGB8 let imageColorSpace = CGColorSpace(name: CGColorSpace.sRGB)! let imageBitMapInfo = CGBitmapInfo(rawValue: CGBitmapInfo.byteOrder32Big.rawValue | CGImageAlphaInfo.premultipliedFirst.rawValue) let imageIntent = CGColorRenderingIntent.defaultIntent //  Basically this is the cell size to draw, every n lines will be lineColorDark let majorGridVertical = 10 let majorGridHorizontal = 10 let bitmapInfo = CGBitmapInfo.byteOrder32Big.rawValue | CGImageAlphaInfo.none.rawValue print("Byte order mask=\(CGBitmapInfo.byteOrderMask)") let imageCount = imageHeightPixels*imageWidthPixels*bitsPerPixel/bitsPerByte print("Image count=\(imageCount)") print("Context parameters: width=\(imageWidthPixels), height=\(imageHeightPixels), bytesPerRow=\(bytesPerRow), \ncolorSpace=\(imageColorSpace), \nbitMapInfo=\(bitmapInfo)") guard var graphContext = CGContext(data: nil, width: imageWidthPixels, height: imageHeightPixels, bitsPerComponent: bitsPerByte, bytesPerRow: 0, space: imageColorSpace, bitmapInfo: bitmapInfo) else {     fatalError("Unable to create the CGContext") } // All is well, so far. What a wonder!```
1
0
1.3k
Sep ’22
XCode signing says NSHomeKitUsageDescription not supplied, how do I do that?
I get the error: "Provisioning profile "iOS Team Provisioning Profile: ***.***.homekitexporter" doesn't include the NSHomeKitUsageDescription entitlement." I have HomeKit enabled in the .entitlements file and I added the NSHomeKitUsageDescription to that also. I looked at the profile under my development account and I can see the HomeKit entitlement but I see nowhere to add the usage description key and string other than in the .entitlements file. I also tried adding the key and string to the Custom IOS Properties for my Target APP but that didn't work either. What am I missing?
8
0
1.3k
Jul ’22