Giter VIP home page Giter VIP logo

Comments (4)

koust avatar koust commented on May 24, 2024

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.

ChristianElam avatar ChristianElam commented on May 24, 2024

@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.

koust avatar koust commented on May 24, 2024

@ChristianElam I need to review codes. after, I can say something.

from brightroom.

ankur432020 avatar ankur432020 commented on May 24, 2024

How to hide filter tab in PixelEditViewController
filter

from brightroom.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.