Comments (4)
Hi,
First of all, you can write an extension like below for colorcubestorage. But you can also find this example on demo.
extension ColorCubeStorage {
static func loadToDefault() {
do {
try autoreleasepool {
let bundle = Bundle.main
let rootPath = bundle.bundlePath as NSString
let fileList = try FileManager.default.contentsOfDirectory(atPath: rootPath as String)
let filters = fileList
.filter { ($0.hasSuffix(".png") || $0.hasSuffix(".PNG")) && $0.hasPrefix("Filter_")}
.sorted()
.concurrentMap { path -> FilterColorCube in
let url = URL(fileURLWithPath: rootPath.appendingPathComponent(path))
let data = try! Data(contentsOf: url)
let image = UIImage(data: data)!
let name = path
.replacingOccurrences(of: "LUT_", with: "")
.replacingOccurrences(of: ".png", with: "")
.replacingOccurrences(of: ".PNG", with: "")
return FilterColorCube.init(
name: name,
identifier: path,
lutImage: image,
dimension: 64
)
}
self.default.filters = filters
}
} catch {
assertionFailure("\(error)")
}
}
}
extension Collection where Index == Int {
fileprivate func concurrentMap<U>(_ transform: (Element) -> U) -> [U] {
var buffer = [U?].init(repeating: nil, count: count)
let lock = NSLock()
DispatchQueue.concurrentPerform(iterations: count) { i in
let e = self[i]
let r = transform(e)
lock.lock()
buffer[i] = r
lock.unlock()
}
return buffer.compactMap { $0 }
}
}
After, you should initialize...
let controller:PixelEditViewController = PixelEditViewController(image: image,colorCubeStorage: ColorCubeStorage.default)
Router.shared.push(from: self, to: controller, animated: true)
Note: Don't forget, you have to add filters.you can already find them on demo.
Note2: Don't forget, you should check replacingOccurrences functions to yourself.
from brightroom.
@koust Great that worked perfect! Do you mind answering my last question on making the image view bigger and the editing panel smaller where there's less white space? I've tried going into the constraints of it but can't figure it out. I would really appreciate it!
from brightroom.
@ChristianElam I need to review codes. after, I can say something.
from brightroom.
How to hide filter tab in PixelEditViewController
from brightroom.
Related Issues (20)
- ld: library not found for -lBrightroom HOT 1
- Crash from missing asset HOT 2
- Can't assign xcassets to the main target on Xcode 11 HOT 1
- Change image in runtime HOT 3
- CIFilter outputImage: Unexpectedly found nil while unwrapping an Optional value HOT 2
- How to provide initial crop to PhotosCropViewController
- Xcode 13 Compile failed HOT 2
- Color profile is changing without applying any filter - SwiftUICropView HOT 6
- xcode 13 SPM compile error: The package product 'BrightroomEngine' cannot be used as a dependency of this target because it uses unsafe build flags. HOT 1
- Compilation error : missing required module 'VergeObjcBridge'
- How to implement a custom filter? HOT 1
- MetalImageView displays image with wrong-color if the image in DisplayP3
- Wrong Installation Guide link. HOT 1
- Crash from SwiftUIDemo App
- Crash in ImageSource.init(image:)
- Value of optional type 'CGImage??' must be unwrapped to a value of type 'CGImage?' HOT 2
- Readme error
- Flipped preview image (MetalImageView) on iOS 17 simulator HOT 2
- Unable to run Demo app in xCode simulator HOT 1
- Lock crop area?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from brightroom.