W3C home > Mailing lists > Public > www-style@w3.org > November 2010

Re: [css3-images] Repeating oblique gradients

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 30 Nov 2010 10:04:42 -0800
Message-ID: <AANLkTi=+egFw_G8vU=u5FC-ny=5KjKRpYoL37w4-SXkS@mail.gmail.com>
To: Brad Kemper <brad.kemper@gmail.com>
Cc: Leif Arne Storset <lstorset@opera.com>, Rik Cabanier <cabanier@adobe.com>, www-style list <www-style@w3.org>
On Tue, Nov 30, 2010 at 9:42 AM, Brad Kemper <brad.kemper@gmail.com> wrote:
> On Nov 30, 2010, at 9:06 AM, Leif Arne Storset wrote:
>> The spread argument can be 'repeat', 'reflect' or 'extend' (default if not given). I called the default "extend" since it seemed more intuitive than "clamp", the internal name for it. See the attached image for a demonstration.
> I don't understand. What is the difference between "extend" and "none"?

There isn't any difference.

>> I'm not formally proposing it yet, but if we want to repeat along the gradient line I think this is a more elegant way to express it than using 'background-repeat': what concerns only gradients can stay in the gradient function. It does require 'background-repeat: extend' in order to have visible effects.
> It does require 'background-repeat: extend' ? But it is more elegant than using 'background-repeat'? Those two statements sound contradictory.
> I think that repeating a pattern in one or two directions should stay in the background-repeat property, as it is already and has been for many years. It has to do it anyway; it is just a matter of whether it will do it elegantly or not. So if we look at that property, we see that for any diagonal gradient the results are ugly and unlikely to be what any author would want (generally speaking). So we can either add some magic to it to automatically turn 'background-repeat: repeat-y' into 'background-repeat:repeat-in-the-direction-of-the-gradient-angle' or something (which someone pointed out problems with some time ago, although I don't recall the specific argument), or we can add another value or two to 'background-repeat'. But the point is, once this is solved for backgrounds that use images, then it doesn't need to re-solved for the images themselves. Unless someone can prove that this is really also an important need for images in other places (like filters) that don't have their own flexibility of sizing, repeating, and moving the image around.

Pushing gradient repetition into background-repeat still isn't a good
idea, as I argued in the past.  Background-repeat really just
describes how to transform a finite-size background image into an
infinite background layer.  For raster images the only sensible
options are to do nothing (transparent everywhere outside the view
box) or to tile it in some way (we chose simple tiling in one or both
directions).  Gradients theoretically have infinite paint, so
background-repeat:extend needs to be defined to give the option "just
use the rest of the image outside of the view box".

Whether or not a gradient repeats, though, has nothing to do with the
above.  It's purely a function of the color-stops.  You can have a
normal gradient with background-repeat of none, repeat, or extend.
You can similarly have a repeating gradient with any of those.

If we decide that using gradients for things like a corduroy texture
are sufficient to introduce repeating gradients, then I suspect we'd
want to allow this for border-image as well as background-image, not
to mention filters.

> I'm not sure why "you can interpolate if they're the same function" is any better or worse than "you can interpolate if they have the same keyword there". But, whatever.

Simon prefers the simplicity of the former, and I don't have any
preference on the matter myself, so I'm going with his preference.

Received on Tuesday, 30 November 2010 18:07:20 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:41 UTC