Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filters progress #2362

Open
8 of 13 tasks
jakex7 opened this issue Jul 23, 2024 · 3 comments
Open
8 of 13 tasks

Filters progress #2362

jakex7 opened this issue Jul 23, 2024 · 3 comments

Comments

@jakex7
Copy link
Member

jakex7 commented Jul 23, 2024

Hi everyone!
We've been working on implementing filters in react-native-svg for a while now. This update is intended to inform you about our progress and facilitate discussion on implementation and future plans.

Progress

Here is a list of the filters along with annotations on their current status:

Filter component

Filters

Example usage

import React from 'react';
import { FeColorMatrix, Filter, Rect, Svg } from 'react-native-svg';

export default () => {
  return (
    <Svg height="300" width="300">
      <Filter id="myFilter">
        <FeColorMatrix type="saturate" values="0.2" />
      </Filter>
      <Rect
        x="0"
        y="0"
        width="300"
        height="300"
        fill="red"
        filter="url(#myFilter)"
      />
    </Svg>
  );
};

This issue is the successor to #150 and address the #176 #635 #883 #1216

@jakex7 jakex7 self-assigned this Jul 23, 2024
@jakex7 jakex7 changed the title Filters Filters progress Jul 23, 2024
@github-actions github-actions bot added the Missing info The user didn't precise the problem enough label Jul 23, 2024
@jakex7 jakex7 removed the Missing info The user didn't precise the problem enough label Jul 23, 2024
@github-actions github-actions bot added Missing repro This issue need minimum repro scenario Missing info The user didn't precise the problem enough labels Jul 23, 2024
@software-mansion software-mansion deleted a comment from github-actions bot Jul 23, 2024
@jakex7 jakex7 removed Missing repro This issue need minimum repro scenario Missing info The user didn't precise the problem enough labels Jul 23, 2024
@github-actions github-actions bot added the Missing repro This issue need minimum repro scenario label Jul 23, 2024
@software-mansion software-mansion deleted a comment from github-actions bot Jul 23, 2024
@jakex7 jakex7 removed the Missing repro This issue need minimum repro scenario label Jul 23, 2024
@github-actions github-actions bot added the Missing repro This issue need minimum repro scenario label Jul 23, 2024
@jakex7 jakex7 removed the Missing repro This issue need minimum repro scenario label Jul 23, 2024
@software-mansion software-mansion deleted a comment from github-actions bot Jul 23, 2024
@github-actions github-actions bot added the Missing repro This issue need minimum repro scenario label Jul 23, 2024

This comment was marked as off-topic.

@jakex7 jakex7 pinned this issue Jul 23, 2024
@jakex7 jakex7 removed the Missing repro This issue need minimum repro scenario label Jul 23, 2024
@bohdanprog bohdanprog unpinned this issue Jul 23, 2024
@bohdanprog bohdanprog pinned this issue Jul 23, 2024
@github-actions github-actions bot added Missing repro This issue need minimum repro scenario Missing info The user didn't precise the problem enough labels Jul 25, 2024
@software-mansion software-mansion deleted a comment from github-actions bot Jul 25, 2024
@jakex7 jakex7 removed Missing repro This issue need minimum repro scenario Missing info The user didn't precise the problem enough labels Jul 25, 2024
@github-actions github-actions bot added Missing repro This issue need minimum repro scenario Missing info The user didn't precise the problem enough labels Jul 26, 2024

This comment was marked as off-topic.

@jakex7 jakex7 added Maintainer issue and removed Missing repro This issue need minimum repro scenario Missing info The user didn't precise the problem enough labels Jul 26, 2024
jakex7 added a commit that referenced this issue Jul 31, 2024
# Summary

As mentioned in #2362
Introduce new filters:
* `FeMerge`
* `FeMergeNode`

## Example usage

```tsx
<Svg width="200" height="200">
  <Filter id="mergeWithOffset" width="180" height="180">
    <FeOffset dx="50" dy="50" result="test" />
    <FeOffset dx="100" dy="100" in="SourceGraphic" />
    <FeMerge>
      <FeMergeNode in="SourceGraphic" />
      <FeMergeNode in="test" />
      <FeMergeNode />
    </FeMerge>
  </Filter>
  <Rect
    x="0"
    y="0"
    width="100"
    height="100"
    stroke="black"
    fill="red"
    filter="url(#mergeWithOffset)"
  />
</Svg>
```

<img width="207" alt="image"
src="https://github.com/user-attachments/assets/9cb3ded6-f939-4b2b-8ece-df54e64fe898">

## Test Plan

`Example` app -> `Filters` -> `FeMerge`

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| iOS     |    ✅     |
| Android |    ✅     |

## Checklist

- [x] I have tested this on a device and a simulator
- [x] I added documentation in `README.md`
- [x] I updated the typed files (typescript)
@bohdanprog bohdanprog unpinned this issue Aug 5, 2024
@bohdanprog bohdanprog pinned this issue Aug 5, 2024
@jakex7 jakex7 mentioned this issue Oct 14, 2024
jakex7 added a commit that referenced this issue Oct 15, 2024
# Summary

Continuation of #2362 implementing `FeFlood` filter
https://www.w3.org/TR/SVG11/filters.html#feFloodElement

## Test Plan

Example app → Filters → `FeFlood`

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| iOS     |    ✅      |
| macOS   |    ✅ _*_      |
| Android |    ✅      |
| Web     |    ✅      |

_* `canvasWidth/canvasHeight` is incorrect on macOS, so there might be
some problems_
@jakex7 jakex7 mentioned this issue Oct 16, 2024
jakex7 added a commit that referenced this issue Oct 16, 2024
# Summary

Continuation of #2362 implementing `FeBlend` filter
https://www.w3.org/TR/SVG11/filters.html#feBlendElement

## Test Plan

Example app → Filters → `FeBlend`

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| iOS     |    ✅      |
| macOS   |    ✅ _*_      |
| Android |    ✅      |
| Web     |    ✅      |
jakex7 added a commit that referenced this issue Oct 28, 2024
# Summary

Continuation of #2362 introducing highly requested ✨ `FeDropShadow` ✨
filter. This addition is straightforward since it's essentially a
shorthand (as specified in the spec) for filters that are already
implemented: https://www.w3.org/TR/filter-effects-1/#feDropShadowElement

<img width="532" alt="image"
src="https://github.com/user-attachments/assets/b221ee4c-d8b0-469b-acb0-71224fb2b1e0">

## Test Plan

Example app -> Filters -> FeDropShadow

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| iOS     |    ✅      |
| macOS   |    ✅      |
| Android |    ✅      |
| Web     |    ✅      |
jakex7 added a commit that referenced this issue Nov 4, 2024
# Summary

Closes #2523
Since `FeBlend`, `FeComposite`, `FeDropShadow` and `FeFlood` is already
supported (see: #2362) we should remove it from
`warnUnimplementedFilter` list
@gezquinndesign
Copy link

@jakex7 Any way I can help you on this? Looks like you're near the finish line...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants