Git Product home page Git Product logo

Comments (8)

barisnurlu avatar barisnurlu commented on June 30, 2024 1

You are the king! Really appreciate for your support.

from fmphotopicker.

congnd avatar congnd commented on June 30, 2024

Thanks for those kind words.
Can you post your current configuration here? Then I can give you some suggestion.

from fmphotopicker.

barisnurlu avatar barisnurlu commented on June 30, 2024

Hi again,

Into FMFilter.swift file, I've added my new filter, where applicable.

Then, in Const.swift file, I've added new filter name into kDefaultAvailableFilters.

Now at the end of the slide, I can see the new filter name, however it does not have any functionality, and I cannot find where to add the filter code.

from fmphotopicker.

congnd avatar congnd commented on June 30, 2024

@barisnurlu
Can you post your configuration? It's easy for me to understand how you are using the lib.

from fmphotopicker.

barisnurlu avatar barisnurlu commented on June 30, 2024

Let me put it in this way. I implemented BBMetalImage pod into my project. It is simply working as following:

let source = BBMetalStaticImageSource(image: myImage!)
source.add(consumer: BBMetalAddBlendFilter())
myImage = BBMetalAddBlendFilter().bbimage

So I want to run this code when user clicks.

from fmphotopicker.

congnd avatar congnd commented on June 30, 2024

Firstly, you have to define your custom filters type by adopting the FMFilterable protocol.

For example:

struct MyFilter1: FMFilterable {
  func filter(image: UIImage) -> UIImage {
    // do whatever to get the filtered image synchronously.
    // https://github.com/Silence-GitHub/BBMetalImage#process-image-synchronously 
  }
  func filterName() -> String {
    // return the name that will be used in the filter screen
  }  
}

Then define all filters you want to use by assigning them to the availableFilters.

config.availableFilters = [
  MyFilter1(),
  MyFilter2(),
  MyFilter3(),
  // ...
]

Then instantiate FMPhotoPickerViewController or FMImageEditorViewController using the configuration above

let editor = FMImageEditorViewController(config: config, sourceImage: yourImage)

let picker = FMPhotoPickerViewController(config: config)

And now you can see your custom filters in the filter screen.

from fmphotopicker.

barisnurlu avatar barisnurlu commented on June 30, 2024

I really really appreciate for your support. It did work!

One more question: When I add config.availableFilters = [MyFilter()], it removes all previously built filters. How can I append, instead of overwrite the existing ones.

from fmphotopicker.

congnd avatar congnd commented on June 30, 2024

You can config like this:

config.availableFilters = [
    FMFilter.None,
    FMFilter.CIPhotoEffectChrome,
    FMFilter.CIPhotoEffectInstant,
    FMFilter.CIPhotoEffectMono,
    FMFilter.CIPhotoEffectProcess,
    FMFilter.CIPhotoEffectTransfer,
    FMFilter.CISepiaTone,
    FMFilter.CIPhotoEffectNoir,
    FMFilter.CIMinimumComponent,
    FMFilter.CIColorPosterize,
    FMFilter.CIColorMonochrome,
    FMFilter.CIColorCrossPolynomial,
    FMFilter.CIColorCube,
    FMFilter.CIColorCubeWithColorSpace,
    FMFilter.CIColorInvert,
    FMFilter.CIFalseColor,
    FMFilter.CIPhotoEffectFade,
    FMFilter.CIPhotoEffectTonal,
    FMFilter.CIVignette, 

    MyFilter1(),
    MyFilter2(),
    MyFilter3(),
    // ...
]

from fmphotopicker.

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.