On Mon, 2009-06-29 at 14:41 +0100, Richard Wilson wrote: > > [mailto:[email protected]] On Behalf Of > > John-Mark Bell > > On Mon, 2009-06-29 at 10:21 +0100, Richard Wilson wrote: > > <snip> > > > > The second change is to extend the bitmap API slightly to > > support the > > > CSS3 image-orientation tag > > (http://www.w3.org/TR/css3-page/#orienting) > > > I'd suggest that the simplest manner to support this is to > > just add an > > > extra parameter to both bitmap and bitmap_tile. > > > > > > bool (*bitmap)(void *pw, const plot_rect *rect, struct > > bitmap *bitmap, > > > colour_t bg_colour, float orientation); bool > > (*bitmap_tile)(void *pw, > > > const plot_rect *rect, struct bitmap *bitmap, colour_t bg_colour, > > > float orientation, bool repeat_x, bool repeat_y); > > > > I wonder if the orientation can be sorted out in the core. > > Thus bitmaps presented to the plotters are always oriented correctly. > > The specification states (http://www.w3.org/TR/css3-page/#orienting, > section 7) "In terms of the order of transformations, the image is first > rotated, then sized, then positioned." If I've interpretted this correctly > it means that if you had a 45 degree rotated background image of Soulja Boy > tiled across your MySpace page, it would show the background through: > > /\../\../\ < rotate, plot /\**/\**/\ > **\/**\/** probably correct **\/**\/** > **/\**/\** **/\**/\** > \/..\/..\/ plot rotated > \/**\/**\ > /\../\../\ more Soulja Boy /\**/\**/\ > **\/**\/** but wrong **\/**\/**
Surely that entirely depends upon how you advance the x/y coordinates when tiling? Consider: ___ | | |___| Rotate 45 degrees: /\ / \ \ / \/ Now, given that everything plots rectangles you'd have a rotated bitmap, thus: ------ |./\.| |/ \| |\ /| |.\/.| ------ With the '.'s being transparent. To get your first background, you'd tile this larger, rotated image, advancing x/y to the bounds of the larger bitmap. I'm struggling to see how you'd achieve your second background in a generic way. It's certainly possible to tesselate some rotated images in the way you suggest, but non-square, non-multiple-of-45-degree rotations won't. However, I think this is all moot. The current draft of the specification makes it clear that image-orientation can only be a multiple of 90 degrees and is applied as a one-off transform to the source image data: http://dev.w3.org/csswg/css3-page/#image-orientation That said, CSS3 does have modules for 2D and 3D transforms. The former is the standard 2d transform matrix. The latter, I've not investigated. At some point in the future, therefore, we will need a solution that permits transformed rendering of everything. I'm not inclined to start considering this in detail now, though. It may well be that we end up feeding the current transformation matrix to the plotters. Note that transforms can affect layout, however, so they're somewhat complicated. > This gives us the best of both worlds (I'm unlikely to ever implement > rotated plotting in Tinct, but would possibly implement Tinct_Rotate to go > in bitmap_rotate to quickly generate the rotated images.) Talking of Tinct; can you stick the sources in SVN, please? :) J.
