Re: CGShading
Re: CGShading
- Subject: Re: CGShading
- From: Ricky Sharp <email@hidden>
- Date: Sun, 1 Aug 2004 11:27:06 -0500
On Aug 1, 2004, at 9:13 AM, Ricky Sharp wrote:
I have yet no idea how the following would compare speed-wise (I do
plan to profile them over the next week as I too need a gradient
solution):
(1) For very simple linear gradients, what I used to do in Carbon was
to create a GWorld. Say I wanted a linear gradient going from top to
bottom for a 200 x 200 pixel area. The GWorld would be 1 pixel wide
and 200 pixels tall. Then, for all 200 pixels, I would directly draw
into the GWorld (Direct Pixel Access) the appropriate colored point.
Finally, I would use CopyBits with dither mode to draw the GWorld into
the 200 x 200 area. You'd get a nice dithered gradient at any
bit-depth. A similar solution should definitely existing if working
with NSImage
(2) Draw directly into an NSImage. 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>
(3) Use CGShading.
(4) Believe it or not, it appears you can use QuickTime. I found this
in some older (1999) documentation:
<http://developer.apple.com/documentation/QuickTime/REF/
refVectors.39.htm#pgfId=34866>
And one more I left out which is to use a graphics app (e.g.
Illustrator) to create a gradient to fill a path, and save it as a PDF.
Let's call this (5).
When I do my profiling, I plan to compare (2), (3) and (5).
___________________________________________________________
Ricky A. Sharp
mailto:email@hidden
Instant Interactive(tm)
http://www.instantinteractive.com
_______________________________________________
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.