Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Path gradient/shading



Quartz does not support path based gradients. Unfortunately there aren't common enough and aren't part of the shadings in the  PDF specification, which is where most of the shading features come from in Quartz. 

Anyways, I'm not sure your proach to subdivide into triangles is going to work given an arbitrary path, because bezier curves will not look good with a triangle.

Back to what you were asking about regarding stitching shaded shapes together. Unfortunately, antialiasing throws a wrench in this, so I can't recommend a workaround or a solution here. 

The only way to to really do this right (at some cost) is to rasterize the shading yourself (but it does mean bitmaps when printing or generating PDF). 
__
haroon sheikh هارون شيخ


On Jun 24, 2005, at 4:08 PM, Tomasz Kukielka wrote:

Hello,

I am trying to implement a complicated gradient/shading filling using
Quartz.
I need something like path gradient in GDI+ on Windows. The examples of path
gradient are:
t4.png>
I would like to divide the shape into triangles with one corner in the
center point of the shape and other 2 corners in the shape path. In the
first example it would be 3 triangles inside the big triangle, in the 2nd
example it would be 4 triangles inside the rectangle.
Each triangle would use the regular linear shading created with
CGShadingCreateAxial().
But the problem is when you draw 2 shaded triangles side by side, they do
not "stick" together nicely. There is an antialiased edge between them. So
the end effect is that you see the lines where those triangles are
connected. I tried to turn off antialiasing by calling
CGContextSetShouldAntialias(context, false) and the effect is that the edges
of neighbor triangles overlap. It looks OK with opaque colors but
unfortunately it shows edge when you use transparency (the same happens if I
try to expand the triangle size by 1 pixel so  the edges overlap).

Any advice how to glue shaded shapes together in a way that the edges don't
show?

Thanks,
Tom



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartz-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartz-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartz-dev/email@hidden

This email sent to email@hidden

References: 
 >Path gradient/shading (From: Tomasz Kukielka <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.