Re: NSImage -> 1-bit NSBitmapImageRep
Re: NSImage -> 1-bit NSBitmapImageRep
- Subject: Re: NSImage -> 1-bit NSBitmapImageRep
- From: Sanford Selznick <email@hidden>
- Date: Fri, 11 Feb 2005 09:58:28 -0700
Now I know why NSReadPixel is so slow... it has to handle all
planer/resolution/alpha combinations.
I just looked into supporting alpha/planar images, and between that
and all the different resolutions, it seems like quite a Herculean
task.
Unless there's other way?
-Sanford
At 7:52 AM -0600 2/9/05, Ricky Sharp wrote:
See the MonochromeImage sample code at Apple's site. It shows you
how to work with an original NSImage and use its data to construct a
monochrome image rep.
Note that you'll need to modify the parameters to
initWithBitmapDataPlanes:pixelsWide... in order to specify 1 bpp.
Things to consider:
* The sample uses NSReadPixel which is very slow. What I've been
doing is using "direct pixel access". i.e. I get a pointer into the
source and destination data streams by using [someImageRep
bitmapData].
* The original source rep may have alpha (hasAlpha returns YES) and
may be planar (isPlanar returns YES). Your code should be modified
to work with such data.
_______________________________________________
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