• 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
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CGShading


  • Subject: Re: CGShading
  • From: "R. Scott Thompson" <email@hidden>
  • Date: Tue, 12 Oct 2004 15:41:09 -0500

Just a note, I don't think that CGShading will let you create the same kind of gradient in the sample (at least not easily).

It can, you just need to use more than one gradient and composite one over the other.

That's why I said "(at least not easily)" :-) You might try using four radial shadings, one centered at each of the four corners and set them up to fade to 0 by the time you get to the opposite corner. That would get something close, but not the same, as the barycentric shading.

You can't really use axial shadings because an axial shading can only vary in one direction (i.e. you could get it to fade in the x direction, but for the barycentric effect, you also want it to fade in y and you can't do both with CGShading). What you might be able to do is use a separate CGShading for each row of pixels... but if the goal is to get an image with that kind of effect you'd probably see much better performance (and simpler code) if you set up an offscreen OpenGL context and plotted a quad with the different colors at each corner.

Another thing to watch out for is the fact that some printers may have trouble with transparent colors in CGShadings. So long as you treat the result of your shadings as a single image then you'll be OK. If you try to put out a circle (for example) that has four shadings with transparency the printer may choke on it.

Scott

--
Macintosh Software Engineering Consulting Services
Visit my resume at <http://homepage.mac.com/easco/RSTResume.html>

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

This email sent to email@hidden
  • Follow-Ups:
    • Re: CGShading
      • From: "John C. Randolph" <email@hidden>
References: 
 >Re: CGShading (From: "John C. Randolph" <email@hidden>)
 >Re: CGShading (From: "John C. Randolph" <email@hidden>)
 >Re: CGShading (From: "R. Scott Thompson" <email@hidden>)
 >Re: CGShading (From: "John C. Randolph" <email@hidden>)

  • Prev by Date: Re: CGShading
  • Next by Date: Borderless NSPopUpButton too wide in NSToolbar
  • Previous by thread: Re: CGShading
  • Next by thread: Re: CGShading
  • Index(es):
    • Date
    • Thread