How to get the list of filter names in CIFilter class?

后端 未结 7 1783
感情败类
感情败类 2021-01-30 23:40

I am using the following code for exposure adjustment and its working. I need the filter names for sharpen, denoise, highlighs, color temperature, shadows, blur, etc.

         


        
7条回答
  •  梦毁少年i
    2021-01-31 00:00

    iOS 14, Swift 5

    Must confess not easy to read, but an answer that is comparable to the first one on Objective C.

    for filtername in filters {
      print("filter \(filtername)")
      print("attributes \(CIFilter.init(name: filtername)?.attributes.keys.description)")
    }
    

    Produces this ...

    filter CIAccordionFoldTransition
    attributes Optional("[\"inputImage\", \"CIAttributeFilterDisplayName\",     \"inputTargetImage\", \"CIAttributeFilterAvailable_iOS\", \"CIAttributeFilterAvailable_Mac\", \"inputNumberOfFolds\", \"inputFoldShadowAmount\", \"inputBottomHeight\", \"CIAttributeReferenceDocumentation\", \"inputTime\", \"CIAttributeFilterCategories\", \"CIAttributeFilterName\"]")
    filter CIAdditionCompositing
    attributes Optional("[\"CIAttributeFilterCategories\", \"CIAttributeFilterName\", \"CIAttributeFilterDisplayName\", \"inputImage\", \"CIAttributeReferenceDocumentation\", \"CIAttributeFilterAvailable_iOS\", \"CIAttributeFilterAvailable_Mac\", \"inputBackgroundImage\"]")
    

    So the info is there in these long strings, you just need to pick it out :)

提交回复
热议问题