How the obtain an NSImage with the content of a view ?

I need an NSImage filled with a NSView content at some point in my code…
I need to test some pixel color and alpha values in a NSImage…