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

Add possibility to "repeat" in image background #334

Open
tinchodias opened this issue Oct 18, 2023 · 1 comment
Open

Add possibility to "repeat" in image background #334

tinchodias opened this issue Oct 18, 2023 · 1 comment

Comments

@tinchodias
Copy link
Collaborator

To form patterns such as:

image

Source:
https://stackoverflow.com/questions/28755265/cairo-fill-a-polygon-with-a-hatch-pattern

In cairo it's simple to do it. Alexandrie-Cairo provides bindings to cairo API: AeCairoExtendMode repeat.

@tinchodias
Copy link
Collaborator Author

In fact, there are more possibilities in Cairo for the "extend mode", more than "repeat":

See the class comment of AeCairoExtendMode:

I am a Cairo FFI binding for cairo_extend_t.

It is used to describe how pattern color/alpha will be determined for areas "outside" the pattern's natural area, (for example, outside the surface bounds or outside the gradient geometry).

Mesh patterns are not affected by the extend mode.

The default extend mode is CAIRO_EXTEND_NONE for surface patterns and CAIRO_EXTEND_PAD for gradient patterns.

Members:

•	CAIRO_EXTEND_NONE: pixels outside of the source pattern are fully transparent (Since 1.0)
•	CAIRO_EXTEND_REPEAT: the pattern is tiled by repeating (Since 1.0)
•	CAIRO_EXTEND_REFLECT: the pattern is tiled by reflecting at the edges (Since 1.0; but only implemented for surface patterns since 1.6)
•	CAIRO_EXTEND_PAD: pixels outside of the pattern copy the closest pixel from the source (Since 1.2; but only implemented for surface patterns since 1.6)


See: https://www.cairographics.org/manual/cairo-cairo-pattern-t.html#cairo-extend-t

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