• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: CGShading line, triangle?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: CGShading line, triangle?
      • From: Henry McGilton <email@hidden>
References: 
 >CGShading line, triangle? (From: Alex Eddy <email@hidden>)

  • Prev by Date: Re: best way to save document level settings?
  • Next by Date: Re: .webloc files and Safari (newbie)
  • Previous by thread: CGShading line, triangle?
  • Next by thread: Re: CGShading line, triangle?
  • Index(es):
    • Date
    • Thread