Re: CGShading line, triangle?
Re: CGShading line, triangle?
- Subject: Re: CGShading line, triangle?
- From: Alastair Houghton <email@hidden>
- Date: Tue, 9 Dec 2003 09:45:43 +0000
On 9 Dec 2003, at 02:33, Alex Eddy wrote:
>
Is there any straightforward way to gradient fill a triangle in Cocoa
>
or CoreGraphics, where each corner has a different color?
>
>
For that matter, what about gradient filling a thick line, taking into
>
account the line pattern and end cap style?
>
>
It looks like CGShading only supplies linear and radial fills which
>
won't do the triangle case, and it just fills the current clip path,
>
which means to fill a wide line with round end caps I'll have to do
>
all the geometry calculations myself to build the line.
>
>
Is it really this un-featured? Is there a clever workaround?
I think you can probably do what you want with a triangle using
multiple linear CGShadings (hint: you can fade the colour at the corner
down to transparent towards the other end of the triangle). My
intuition suggests that two CGShadings should be sufficient, although
using three might make it easier.
As far as doing a gradient fill of a thick line, I don't know any way
of getting the line's outline as a path, which is what you'd need in
order to do this. I think you'd have to convert it to a path manually;
it doesn't look stunningly tricky to do the necessary geometry.
BTW, the triangle thing would be easier (and hardware accelerated) in
OpenGL, if that's an option.
Kind regards,
Alastair.
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.