Re: NSImage handling...
Re: NSImage handling...
- Subject: Re: NSImage handling...
- From: Geoffrey H Wathen <email@hidden>
- Date: Wed, 29 Oct 2003 13:00:48 -0700
Code snippets:
My application is a Cocoa document based application. It has a custom
NSWindowController subclass. In that controller .m file, I have the
code:
- (IBAction)runEvents:(id)sender
{
int index, numEvents;
NSImage *image=[[self document] activeImage];
GRCrystal *growth=[[GRCrystal alloc] init];
numEvents=[totalEvents intValue];
[view setImage:image];
for ( index = 0; index < numEvents; index++)
{
image=[[growth Grow:image] retain];
}
[view setImage:image];
[growth release];
}
runEvents is keyed off of a button and a text field in the window.
totalEvents is a text field. GRCrystal is a custom class containing
the method Grow which simply goes through the NSImageRep of the NSImage
that's passed to it, pixel by pixel, and makes certain random changes.
Then it returns the modified NSImage. However, when it's called again,
it clearly starts from the original loaded image when making its
modifications. Is this enough, or would more code help?
On Tuesday, October 28, 2003, at 08:59 PM, Greg Hulands wrote:
Providing some code snippets would help diagnose the problem. even
pseudo code.
On 29/10/2003, at 11:49 AM, Geoffrey H Wathen wrote:
Hi everyone,
I've got a peculiar problem. Clearly, I'm not understanding
something. I have an application that is making modifications to an
NSImage object, using a repetitive method. The problem I've come up
against is that every time I repeat the method, it reverts to the
original form of the image, not preserving the changes that were made
the previous time the method was run. Does anyone have any ideas?
Geoff.
_______________________________________________
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.
_______________________________________________
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.