FROM : Florian Soenens
DATE : Tue Nov 06 11:30:52 2007
Hello list,
i have the following problem:
in a custom nsoutlineview i have set the cells to display an image.
Everything works fine on a ppc but the images do not show on an intel
machine.
Am i overlooking something?
Help is much appreciated!
- (void)outlineView:(NSOutlineView *)olv willDisplayCell:(NSCell *)
cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item
{
NSTableColumn *myColumn;
myColumn = [libraryTableView tableColumnWithIdentifier:@"Name"];
if (tableColumn == myColumn)
{
NSFont *font = [NSFont controlContentFontOfSize:11.0];
[(ImageAndTextCell*)cell setFont:font];
if( [[item objectForKey:@"Name"] isEqualToString:kMainLibraryName])
{
[ (ImageAndTextCell*)cell setImage: [self iconOfSize:16 fromImage:
[ NSImage imageNamed: @"MainLibrary.tiff" ] alpha:1.0]] ;
}
}
}
- (NSImage *)iconOfSize:(int)size fromImage:(NSImage *)image alpha:
(float)alpha
{
if(!image)
return nil
NSImage *icon = [[NSImage alloc] initWithSize:NSMakeSize
(size,size)];
[icon lockFocus];
[[NSGraphicsContext currentContext]
setImageInterpolation:NSImageInterpolationHigh];
[image drawInRect:NSMakeRect(0,0,size,size)
fromRect:NSMakeRect(0,0,[image size].width,[image size].height)
operation:NSCompositeSourceOver
fraction:alpha];
[icon unlockFocus];
return [icon autorelease];
}
DATE : Tue Nov 06 11:30:52 2007
Hello list,
i have the following problem:
in a custom nsoutlineview i have set the cells to display an image.
Everything works fine on a ppc but the images do not show on an intel
machine.
Am i overlooking something?
Help is much appreciated!
- (void)outlineView:(NSOutlineView *)olv willDisplayCell:(NSCell *)
cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item
{
NSTableColumn *myColumn;
myColumn = [libraryTableView tableColumnWithIdentifier:@"Name"];
if (tableColumn == myColumn)
{
NSFont *font = [NSFont controlContentFontOfSize:11.0];
[(ImageAndTextCell*)cell setFont:font];
if( [[item objectForKey:@"Name"] isEqualToString:kMainLibraryName])
{
[ (ImageAndTextCell*)cell setImage: [self iconOfSize:16 fromImage:
[ NSImage imageNamed: @"MainLibrary.tiff" ] alpha:1.0]] ;
}
}
}
- (NSImage *)iconOfSize:(int)size fromImage:(NSImage *)image alpha:
(float)alpha
{
if(!image)
return nil
NSImage *icon = [[NSImage alloc] initWithSize:NSMakeSize
(size,size)];
[icon lockFocus];
[[NSGraphicsContext currentContext]
setImageInterpolation:NSImageInterpolationHigh];
[image drawInRect:NSMakeRect(0,0,size,size)
fromRect:NSMakeRect(0,0,[image size].width,[image size].height)
operation:NSCompositeSourceOver
fraction:alpha];
[icon unlockFocus];
return [icon autorelease];
}
| Related mails | Author | Date |
|---|---|---|
| Florian Soenens | Nov 6, 11:30 | |
| Ricky Sharp | Nov 6, 18:43 | |
| Florian Soenens | Nov 6, 23:21 | |
| Ken Ferry | Nov 7, 05:48 |






Cocoa mail archive

