• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSImage problem with universal binary
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSImage problem with universal binary


  • Subject: Re: NSImage problem with universal binary
  • From: "Ken Ferry" <email@hidden>
  • Date: Tue, 6 Nov 2007 20:48:21 -0800

> >>                      [ (ImageAndTextCell*)cell setImage: [self iconOfSize:16
> >> fromImage:[ NSImage imageNamed: @"MainLibrary.tiff" ] alpha:1.0]] ;

This will fail on intel if you are not importing ImageAndTextCell.h in
this source file, in which case you would also see a warning for this
line.

The compiler on both ppc and intel will assume that the alpha
parameter is a double if it doesn't see a declaration for the method.
Due to coincidence in the way arguments are passed, it would work
anyway on ppc, but if you were to set a break point on
-[ImageAndTextCell setImage:alpha:] on intel you'd always see 0.0
passed in as the alpha value.

Basically, if you're seeing warnings, get 'em fixed and see if the
problem clears up.

-Ken

On Nov 6, 2007 2:21 PM, Florian Soenens <email@hidden> wrote:
> Hi,
>
> thanks but using png did not solve the problem...
> Anyone has other suggestions?
>
> Regards,
> Flor.
>
>
> On 06 Nov 2007, at 18:43, Ricky Sharp wrote:
>
> >
> > On Nov 6, 2007, at 4:30 AM, Florian Soenens wrote:
> >
> >> 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];
> >> }
> >
> > I would first try another image (e.g. a PNG).  If that works, then
> > the problem will most likely be in the image data itself.  I think
> > it's possible that TIFF can sometimes be platform-specific.
> >
> > ___________________________________________________________
> > Ricky A. Sharp         mailto:email@hidden
> > Instant Interactive(tm)   http://www.instantinteractive.com
> >
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >NSImage problem with universal binary (From: Florian Soenens <email@hidden>)
 >Re: NSImage problem with universal binary (From: Ricky Sharp <email@hidden>)
 >Re: NSImage problem with universal binary (From: Florian Soenens <email@hidden>)

  • Prev by Date: Re: NSImage problem with universal binary
  • Next by Date: Re: Customizing DMG(Apply Background image and Icons)
  • Previous by thread: Re: NSImage problem with universal binary
  • Next by thread: Re: NSImage problem with universal binary
  • Index(es):
    • Date
    • Thread