FROM : Robert W. Kuhn
DATE : Thu Nov 25 15:29:47 2004
Hello,
can NSImage not handle grayscale (8 bit) images?
ti-pcl2:~/Programmierung/Disparity rkuhn$ file A_000_000.bmp
A_000_000.bmp: PC bitmap data, Windows 3.x format, 1280 x 1020 x 8
But:
mLeftImg = [[NSImage alloc]
initWithContentsOfFile:@"A_000_000.bmp"];
NSLog(@"BPP: %i", [mLeftImg bitsPerPixel]);
gives in the Log:
2004-11-25 15:29:03.447 Disparity[6999] BPP: 32
This is bitsPerPixel:
-(int)bitsPerPixel
{
return [[self bitmapImageRep] bitsPerPixel];
}
with
-(NSBitmapImageRep*)bitmapImageRep
{
NSArray *reps=[self representations];
NSEnumerator *enumerator = [reps objectEnumerator];
id obj;
NSBitmapImageRep *bir=nil;
// cycle through the image reps until we find a suitable one
while ((obj = [enumerator nextObject])) {
bir=nil;
if([obj isKindOfClass: [NSBitmapImageRep class]]) {
bir=(NSBitmapImageRep *)obj;
break;
}
}
return bir;
}
Mit freundlichen Grüßen
Robert W. Kuhn
DATE : Thu Nov 25 15:29:47 2004
Hello,
can NSImage not handle grayscale (8 bit) images?
ti-pcl2:~/Programmierung/Disparity rkuhn$ file A_000_000.bmp
A_000_000.bmp: PC bitmap data, Windows 3.x format, 1280 x 1020 x 8
But:
mLeftImg = [[NSImage alloc]
initWithContentsOfFile:@"A_000_000.bmp"];
NSLog(@"BPP: %i", [mLeftImg bitsPerPixel]);
gives in the Log:
2004-11-25 15:29:03.447 Disparity[6999] BPP: 32
This is bitsPerPixel:
-(int)bitsPerPixel
{
return [[self bitmapImageRep] bitsPerPixel];
}
with
-(NSBitmapImageRep*)bitmapImageRep
{
NSArray *reps=[self representations];
NSEnumerator *enumerator = [reps objectEnumerator];
id obj;
NSBitmapImageRep *bir=nil;
// cycle through the image reps until we find a suitable one
while ((obj = [enumerator nextObject])) {
bir=nil;
if([obj isKindOfClass: [NSBitmapImageRep class]]) {
bir=(NSBitmapImageRep *)obj;
break;
}
}
return bir;
}
Mit freundlichen Grüßen
Robert W. Kuhn
| Related mails | Author | Date |
|---|---|---|
| Robert W. Kuhn | Nov 25, 15:29 | |
| Marcel Weiher | Nov 29, 21:13 | |
| Robert W. Kuhn | Nov 30, 09:26 | |
| Marcel Weiher | Nov 30, 11:56 |






Cocoa mail archive

