• 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: "John C. Randolph" <email@hidden>
  • Date: Tue, 12 Oct 2004 13:29:38 -0700


On Oct 12, 2004, at 12:30 PM, R. Scott Thompson wrote:



Here's some sample code that creates a pretty cool gradient by using a Category for NSImage:

<http://developer.apple.com/samplecode/Transformed_Image/ Transformed_Image.html>



When I wrote that code, CGShading wasn't available. If I were writing that sample today, I'd use GCShading. I should also point out that the code assumes that bytesPerRow == pixelsWide, which isn't necessarily the case.


Correction: I meant to say it assumes that bytesPerRow == (pixelsWide * 4), which isn't necessarily true. In future versions of AppKit and CoreImage, bitmaps may get padded to allow for word or long word alignment for optimization.


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.

-jcr





John C. Randolph <email@hidden> (408) 974-8819
Sr. Cocoa Software Engineer,
Apple Worldwide Developer Relations
http://developer.apple.com/cocoa/index.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: "R. Scott Thompson" <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>)

  • Prev by Date: Re: [ANN] Growl initial release
  • Next by Date: Re: CGShading
  • Previous by thread: Re: CGShading
  • Next by thread: Re: CGShading
  • Index(es):
    • Date
    • Thread