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

[css-images] Add a way to composite multiple images #7666

Open
SebastianZ opened this issue Aug 31, 2022 · 3 comments
Open

[css-images] Add a way to composite multiple images #7666

SebastianZ opened this issue Aug 31, 2022 · 3 comments

Comments

@SebastianZ
Copy link
Contributor

In #6807 the use case to composite and blend multiple images into one was mentioned in several comments.

As this seems orthogonal to the use case of manipulating a single image, I filed this issue, so it can be discussed separately.

The general idea is to establish different layers for images similar to how graphics programs have them. For each layer you can define an image (or maybe even multiple ones?) and additional information, e.g. a blending method or the position and size.

In the other issue @Crissov provided this syntax example:

@image --composite {
  @layer --stage {
    src: "backdrop.jpg";
  }
  @layer --scene {
    src: "parallax.png";
  }
  @layer --actor {
    src: "map.svg#sprite";
    position: 200px 300px;
  }
}

Here's a general syntax suggestion to get the ball rolling:

@image <custom-ident> {
  @image-layer <custom-ident>? {
    src: <image>;
    position: <'position'>;
    mix-blend-mode: <'mix-blend-mode'>
    width: <'width'>;
    height: <'height'>;
  }
  ...
}

@image in this example would be a general container for custom images. It might end up being the same one as for image manipulations or be a completely separate one, though in the suggested syntax it's used to generate the composited image.
This image can then be used in <image> values, either directly, i.e. --composite, or via a function like src(--composite) or image(--composite).

Sebastian

@Crissov
Copy link
Contributor

Crissov commented Sep 6, 2022

I’d probably use SVG-inspired fill instead of src.

https://drafts.fxtf.org/fill-stroke/#fill-shorthand

@SebastianZ
Copy link
Contributor Author

I’d probably use SVG-inspired fill instead of src.

I would rather make that the same as for the image manipulation rule. Otherwise it will be confusing why one uses src while the other one uses fill. And also because fill may lead authors to the assumption that stroke works as well.

Sebastian

1 similar comment
@SebastianZ
Copy link
Contributor Author

I’d probably use SVG-inspired fill instead of src.

I would rather make that the same as for the image manipulation rule. Otherwise it will be confusing why one uses src while the other one uses fill. And also because fill may lead authors to the assumption that stroke works as well.

Sebastian

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