[textView drawRect:whichRect]
[textView drawRect:whichRect]
- Subject: [textView drawRect:whichRect]
- From: Lorenzo <email@hidden>
- Date: Mon, 11 Jul 2005 13:56:02 +0200
Hi,
I have to draw a small area of a NSTextView to a NSImage.
I create a NSImage with the same size of the textView.
Then I lock the focus of the image and I draw the "whole" textView to the
image.
[textView drawRect:[textView bounds]];
>From this big image I extract the portion of the image using
[textImage compositeToPoint:imagePoint fromRect:croppedRect
operation:NSCompositeCopy];
I succeed when the textView is not so big, but when it is big e.g. 1024 x
48000, I donĀ¹t' succeed because the big image cannot be cashed.
So I thought to draw the portion of the textView directly to a small image.
NSImage *imageP = [[NSImage alloc] initWithSize:croppedSize];
[imageP setFlipped:YES];
[textView drawRect:croppedRect];
[imageP unlockFocus];
But this way I get strange results because I cannot manage the origin point
of the destination image. I think I need something like drawRect-FromRect.
I didn't find yet the method I need for the NSTextView class, so I tried to
move the origin of the textView, unsuccessfully.
Also, I have found
[textView dataWithEPSInsideRect:croppedRect];
which works well. Unfortunately it is very slow when I have thousands of
images.
Do you know a better solution?
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