Add comprehensive KDoc documentation to FilterHelper (#54350)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54350

Added comprehensive KDoc documentation to the FilterHelper object and its primary public method for parsing and applying CSS filter effects on Android S+ (API 31+).

changelog: [internal] internal

Reviewed By: lenaic

Differential Revision: D85926889

fbshipit-source-id: e20bb0697753e710d66acc3ef4078ab009d6dc5d
This commit is contained in:
David Vacca
2025-10-31 14:42:30 -07:00
committed by meta-codesync[bot]
parent b8f9d982f5
commit 0e3a210be1
@@ -21,9 +21,25 @@ import com.facebook.react.uimanager.PixelUtil.dpToPx
import kotlin.math.cos
import kotlin.math.sin
/**
* Helper object for parsing and applying CSS filter effects on Android S+ (API 31+).
*
* This object provides utilities to convert CSS filter arrays into Android [RenderEffect] chains
* and [ColorMatrixColorFilter] objects. Supports filters like blur, brightness, contrast,
* grayscale, sepia, saturate, hue-rotate, invert, opacity, and drop-shadow.
*
* @see <a href="https://www.w3.org/TR/filter-effects-1/">CSS Filter Effects Module Level 1</a>
*/
@TargetApi(31)
internal object FilterHelper {
/**
* Parses a ReadableArray of CSS filter definitions into a chained [RenderEffect].
*
* @param filters The array of filter definitions, or null
* @return A chained RenderEffect representing all filters, or null if no filters provided
* @throws IllegalArgumentException if an invalid filter name is encountered
*/
@JvmStatic
fun parseFilters(filters: ReadableArray?): RenderEffect? {
filters ?: return null