April 7,2005

Cocoa 下直接存取圖檔 pixel 的方式

unsigned char* byte;


//註: 下面(1)(2)兩行可以合成一行
// NSBitmapImageRep* tmpbmp = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes: nil
... blah blah blah];


NSBitmapImageRep* tmpbmp = [NSBitmapImageRep alloc]; //(1)
[tmpbmp initWithBitmapDataPlanes: nil //(2)
pixelsWide: 24
pixelsHigh: 24
bitsPerSample: 1
samplesPerPixel: 1
hasAlpha: NO
isPlanar: YES
colorSpaceName: NSCalibratedWhiteColorSpace
bytesPerRow: 3
bitsPerPixel: 1];

byte = [tmpbmp bitmapData]; // 這個指標指向圖形的像素資料


Posted by toki_kanno at 樂多Roodo! │17:16 │回應(0)引用(1)Cocoa
樂多分類:日記/一般 工具:編輯本文
Ads by Roodo! 

引用URL

http://cgi.blog.roodo.com/trackback/64890
引用列表:
美腿【美腿】 at May 10,2006 19:47