• 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: NSImageRep Trouble
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSImageRep Trouble


  • Subject: Re: NSImageRep Trouble
  • From: Seth Willits <email@hidden>
  • Date: Sat, 23 Nov 2002 07:37:18 -0800

On 11/22/02 7:06 PM, the NSA intercepted the following message from "David
Remahl" <email@hidden>:

> Here you need the full path to the image.
>
> NSString *path = [[NSBundle mainBundle] pathForResource:@"Image"
> ofType:@"tiff"];
> imageRep = [[NSImageRep imageRepWithContentsOfFile:path] retain];

Darn. I just can't get this to work:



- (id)initWithFrame:(NSRect)frame isPreview:(BOOL)isPreview
{
NSString *path = [[NSBundle mainBundle] pathForResource:@"Image"
ofType:@"tiff"];

image = [[[NSImage alloc] initWithContentsOfFile:path] retain];
imageRep = [[image bestRepresentationForDevice:nil] retain];

...
return self;
}


- (void)animateOneFrame
{
...
[imageRep drawAtPoint:point];
return;
}



Each time, imageRep is nil and nothing is drawn. I tried to get the file and
draw it with only an imageRepresentation but that didn't work so I tried
using and NSImage to get and NSImageRep that was valid, but this is still
not working,


I appreciate the help,




Seth Willits
---------------------------------------------------------------------------
President and Head Developer of Freak Software - http://www.freaksw.com
Q&A Columnist for REALbasic Developer Magazine - http://www.rbdeveloper.com

"If God did not exist, it would be necessary to invent Him."
-- Voltaire
---------------------------------------------------------------------------
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: NSImageRep Trouble
      • From: Scott Anguish <email@hidden>
References: 
 >Re: NSImageRep Trouble (From: David Remahl <email@hidden>)

  • Prev by Date: Re: Newbie with a Q?
  • Next by Date: Re: Setting the subclass for an NSTextView... in IB..
  • Previous by thread: Re: NSImageRep Trouble
  • Next by thread: Re: NSImageRep Trouble
  • Index(es):
    • Date
    • Thread