Syntax for image-pattern support in CSS

David Grieve david.grieve at oracle.com
Fri Aug 31 06:15:55 PDT 2012


Instead of url, I'd prefer both be image-pattern, since ImagePattern has a ctor taking just the image. Syntax would be

image-pattern(<string>[,<number>,<number>,<number>,<number>,<boolean>]?)

which, as you mention, maps 1-1 onto ImagePattern. The problem here, though, is how to get tiling without knowing the size of the image since the ImagePattern default is stretch. You propose a url syntax.  Will people be confused by this? I suggest a function 

repeating-image-pattern(<string>)

which gets you the repeat. This is unambiguous and follows what W3C does for gradients (e.g., repeating-radial-gradient).


On Aug 30, 2012, at 9:20 PM, Richard Bair wrote:

> http://javafx-jira.kenai.com/browse/RT-19455
> 
> Anywhere a Paint is allowed:
> 
> url('region/test20x20.png');
> image-pattern('region/test20x20.png', 0, 0, 1, 1, true);
> 
> The syntax is exactly the same as our ImagePattern class. I rather chose the rgb() style function rather than linear, radial gradient style named parameters both because it was less work and less syntax to define, and because there aren't many params and I thought I'd just map directly to the class. I could have tried giving percentage based value support (percent of what? The image, the dest?) but I decided to just stick with plain numbers. Most of the time people will either just use the url version and get tiling for free, or they will use the image-pattern version and get it stretched (as I've done here). Or they can do whatever with the image-pattern version.
> 
> What do you think?
> 
> (I'm attacking this issue right now, incidentally, because I'm working on numerous Region performance and behavior issues, and in my travels I noticed some very useful rendering modes are not supported currently with respect to images, so I thought I would round it all out while I was in the code).
> 
> Richard


David Grieve | Principal Member of Technical Staff
Mobile: +16033121013 
Oracle Java Client UI and Tools
Durham, NH 03824 
 Oracle is committed to developing practices and products that help protect the environment



More information about the openjfx-dev mailing list