Re: Background image cropping

On Jun 10, 2014, at 5:30 PM, Marat Tanalin <mtanalin@yandex.ru> wrote:

> 10.06.2014, 19:58, "Sylvain Galineau" <galineau@adobe.com>:
>> On Jun 10, 2014, at 8:16 AM, Marat Tanalin <mtanalin@yandex.ru> wrote:
>>>  10.06.2014, 18:44, "Dirk Schulze" <dschulze@adobe.com>:
>>>>  I believe Mozilla has a -moz-image-rect() [1] image function that clips the input image argument. It is not specified though.
>>>> 
>>>>  Dirk
>>>> 
>>>>  [1] https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-image-rect
>>>  By the way, Mozilla's `-moz-image-rect()` functional notation looks much better than Media Fragments in CSS for several reasons
>> Yes, I agree the readability and usability of a URI fragment are poor. A functional notation that would result in the client requesting the image using the corresponding media fragment URI sounds interesting. As long as it does not result in the kind of poor user experience described above.
> 
> To be clear: my point is that while Media Fragments in general may make some sense as a compact way to pack some meta data into URL for the purpose of somewhat easy sharing the URL as a standalone thing, I doubt we should stick with Media Fragments _in CSS_ while there are more intuitive, usable and flexible options consistent with the rest part of CSS.
> 
> After all, Media Fragments and pure-CSS solutions are not mutually exclusive.

Precisely.

> Media Fragments could be used in CSS for some simplest cases, while pure-CSS solutions could be used as a more flexible and usable alternative when needed.
> 
> For example, how would following expression be expressed in terms of Media Fragments?
> 
>    /* Here we have 4em-size center part of the image: */
>    -moz-image-rect(
>        calc(50% - 2em),
>        calc(50% - 2em),
>        calc(50% - 2em),
>        calc(50% - 2em)
>    )

In cases like this you'd need the full image to compute the result anyway, so it's not really a scenario for MF. 

This thread started with background sprites as they are currently built on the web. Those can certainly use MF, though some syntactic sugar to build the fragment may be nice...

Received on Wednesday, 11 June 2014 00:53:18 UTC