[cairo] Do MeshGradients not respect cairo_pattern_set_extend() ?

Travis Griggs travisgriggs at gmail.com
Wed Mar 28 00:32:08 PDT 2012


First of all. Mucho HUGE Gracias to those who pushed the mesh gradient stuff in. I've been waiting for this for a while. It is tres cool!

I'm playing a little with them in the updated 1.12.0 binding for Smalltalk and it's fun what you can do. I've had luck using them with ImageSurfaces. But not with a Quartz windows surface yet. BUT… that may be a side effect of the Smalltalk virtual machine, need to look into that some more. And it may be that it's because I'm using a binary that appears to have been just a bit before 1.12.0 was finally pushed out, so maybe there's an issue there.

What I did notice with ImageSurface and MeshGradient though, is that it doesn't seem to matter what I set using cairo_pattern_set_extend(), it's always just bound by the patch. Is that to be expected? Here's the code I used (it's Smalltalk, but I think the general jst there)

image := ImageSurface format: CairoFormat argb32 extent: 400 @ 400.
box := Point zero extent: image extent.
image newCairoContextWhile: 
		[:cr |
		mesh := MeshGradient new.
		mesh patchWhile: 
				[mesh moveTo: box topCenter.
				mesh lineTo: box rightCenter.
				mesh lineTo: box bottomCenter.
				mesh lineTo: box leftCenter.
				#(#red #green #blue #yellow)
					keysAndValuesDo: [:index :name | mesh setCorner: index color: (ColorValue perform: name)].
				mesh setControlPoint: 1 point: box topLeft.
				mesh setControlPoint: 2 point: box topRight.
				mesh setControlPoint: 3 point: box bottomRight.
				mesh setControlPoint: 4 point: box bottomLeft].
		mesh extend: ExtendStyle pad. "<<<<---THIS LINE RIGHT HERE"
		cr source: mesh.
		cr paint].
image writeToPng: '/Users/travis/Desktop/mesh.png'

That marked line, I've tried all 4 different ExtendStyles (reflect, none, pad, repeat), they all seem to basically do the same thing. I guess I naively expected, for example, that if I put repeat in there, it would tile my diamond (see attached output). Is it because the patches don't indicate an implicit symmetry whereby to apply the extending?

--
Travis Griggs
Objologist
"The best way to know you have a mind is to change it" -Judge Pierre Level





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20120328/41fbad5c/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mesh.png
Type: image/png
Size: 56825 bytes
Desc: not available
URL: <http://lists.cairographics.org/archives/cairo/attachments/20120328/41fbad5c/attachment-0001.png>


More information about the cairo mailing list