• 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
[textView drawRect:whichRect]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[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

  • Prev by Date: Re: Documentation frustrations
  • Next by Date: Re: Need Help With Creating NSMutableNumber Class
  • Previous by thread: Re: NSUrlResponse
  • Next by thread: Button Bezel Styles
  • Index(es):
    • Date
    • Thread