Draw a portion of NSTextView
Draw a portion of NSTextView
- Subject: Draw a portion of NSTextView
- From: Lorenzo <email@hidden>
- Date: Fri, 15 Jul 2005 14:34:03 +0200
Hi,
I want to draw a portion of my NSTextView to a NSImage.
textView bounds and frame size are 1024 x 10,000;
image is 1024 x 500.
NSSize imageSize = NSMakeSize(1024, 500);
NSRect imageRect = NSMakeRect(0, 0, imageSize.width, imageSize.height);
image = [[NSImage alloc] initWithSize:imageSize];
[image setFlipped:YES];
[image lockFocus];
[textView drawRect:imageRect];
[imageX unlockFocus];
It works and it draws the top-left portion of the textView in my image.
Fine. Now I want to draw the next portion "i" and I move the bounds origin
of the textView.
[textView setBoundsOrigin:NSMakePoint(0, -500 * i)];
I lock the focus, draw... Good, I get the second image properly.
Now I do the same in a loop for i < 20 and I get a 3rd image just equal to
the second image. The same for the all the next images. They are all equal
to the second image. Why?
Why do I get the first and the second image properly, and I get all the next
images equal to the second image?
Best Regards
--
Lorenzo
email: email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden