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]; // 這個指標指向圖形的像素資料
//註: 下面(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]; // 這個指標指向圖形的像素資料
引用URL
http://cgi.blog.roodo.com/trackback/64890
引用列表:
美腿【美腿】
at May 10,2006 19:47