Skip to content

Commit 979728e

Browse files
committed
add composite operator example to README.md
1 parent b44dc78 commit 979728e

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

README.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ int main(void)
9191
- [Out](#composite-out)
9292
- [Atop](#composite-atop)
9393
- [Xor](#composite-xor)
94-
- [Arithmetic](#arithmetic-composite)
94+
- [Arithmetic](#arithmetic)
9595
9696
## Roadmap
9797
@@ -276,3 +276,34 @@ Blends two surfaces using the specified blend mode. The source surface (`in1`) i
276276
| <a id="blend-soft-light"></a>Soft Light | ![in1](examples/zhang-hanyun.jpg) | ![in2](examples/royal-purple.png) | ![out](tests/zhang-hanyun-royal-purple-blend-soft-light.jpg) |
277277
| <a id="blend-difference"></a>Difference | ![in1](examples/zhang-hanyun.jpg) | ![in2](examples/royal-purple.png) | ![out](tests/zhang-hanyun-royal-purple-blend-difference.jpg) |
278278
| <a id="blend-exclusion"></a>Exclusion | ![in1](examples/zhang-hanyun.jpg) | ![in2](examples/royal-purple.png) | ![out](tests/zhang-hanyun-royal-purple-blend-exclusion.jpg) |
279+
280+
## Composite
281+
282+
```c
283+
void plutofilter_composite(plutofilter_surface_t in1, plutofilter_surface_t in2, plutofilter_surface_t out, plutofilter_composite_operator_t op);
284+
```
285+
286+
Composites two surfaces using a Porter–Duff compositing operator. The source surface (`in1`) is composited over the backdrop (`in2`) using the specified operator. The result is written to `out`.
287+
288+
| Operator | Input 1 | Input 2 | Output |
289+
| -------- | --------------------------------- | ---------------------------- | ----------------------------- |
290+
| <a id="composite-over"></a>Over | ![in1](examples/zhang-hanyun.jpg) | ![in2](examples/wavy-ribbon.png) | ![out](tests/zhang-hanyun-wavy-ribbon-composite-over.jpg) |
291+
| <a id="composite-in"></a>In | ![in1](examples/zhang-hanyun.jpg) | ![in2](examples/wavy-ribbon.png) | ![out](tests/zhang-hanyun-wavy-ribbon-composite-in.png) |
292+
| <a id="composite-out"></a>Out | ![in1](examples/zhang-hanyun.jpg) | ![in2](examples/wavy-ribbon.png) | ![out](tests/zhang-hanyun-wavy-ribbon-composite-out.png) |
293+
| <a id="composite-atop"></a>Atop | ![in1](examples/zhang-hanyun.jpg) | ![in2](examples/wavy-ribbon.png) | ![out](tests/zhang-hanyun-wavy-ribbon-composite-atop.png) |
294+
| <a id="composite-xor"></a>Xor | ![in1](examples/zhang-hanyun.jpg) | ![in2](examples/wavy-ribbon.png) | ![out](tests/zhang-hanyun-wavy-ribbon-composite-xor.png) |
295+
296+
### Arithmetic
297+
298+
```c
299+
void plutofilter_composite_arithmetic(plutofilter_surface_t in1, plutofilter_surface_t in2, plutofilter_surface_t out, float k1, float k2, float k3, float k4);
300+
```
301+
302+
Blends two input surfaces using a flexible arithmetic combination of their color values. The output is based on the colors from both inputs, combined according to the four constants: `k1`, `k2`, `k3`, and `k4`.
303+
304+
| Input 1 | Input 2 | k1 | k2 | k3 | k4 | Output |
305+
|---------|---------|----|----|----|-----|--------|
306+
| ![in1](examples/zhang-hanyun.jpg) | ![in2](examples/wavy-ribbon.png) | `0` | `1` | `0.5` | `0` | ![out](tests/zhang-hanyun-wavy-ribbon-arithmetic-0-1-0.5-0.jpg) |
307+
| ![in1](examples/zhang-hanyun.jpg) | ![in2](examples/wavy-ribbon.png) | `0` | `1` | `1` | `0.5` | ![out](tests/zhang-hanyun-wavy-ribbon-arithmetic-0-1-1-0.5.jpg) |
308+
| ![in1](examples/zhang-hanyun.jpg) | ![in2](examples/wavy-ribbon.png) | `0` | `1` | `1` | `0` | ![out](tests/zhang-hanyun-wavy-ribbon-arithmetic-0-1-1-0.jpg) |
309+
| ![in1](examples/zhang-hanyun.jpg) | ![in2](examples/wavy-ribbon.png) | `4` | `1` | `1` | `-0.5` | ![out](tests/zhang-hanyun-wavy-ribbon-arithmetic-4-1-1--0.5.png) |

0 commit comments

Comments
 (0)