• 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
Draw a portion of NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Draw a portion of NSTextView
      • From: "John C. Randolph" <email@hidden>
  • Prev by Date: Re: Creating an XML document
  • Next by Date: Re: Scheduling tasks
  • Previous by thread: Re:Getting the download location selected by the user in Safari
  • Next by thread: Re: Draw a portion of NSTextView
  • Index(es):
    • Date
    • Thread