• 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
Problem: drawing NSView to NSImage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem: drawing NSView to NSImage


  • Subject: Problem: drawing NSView to NSImage
  • From: Max Seelemann <email@hidden>
  • Date: Fri, 22 Aug 2003 15:46:30 +0200

Hi guys.

I got a problem:
I want a special section of an NSView drawn in an NSImage (for an Dragging session).
If I do this with dataWithPDFInsideRect: it's very slow, too slow.
As I don't need subviews, I tried drawRect: but this doesn't give the expected result. The image
contains the view, but it's incorrectly (maybe a mirrored coordinate system error). So both ways
don't work (good) for me. Can you help me fixing the error in the second way? My code:

<--- snip --->

// rect is the NSRect that should be in the NSImage

img1 = [[NSImage alloc] initWithSize: [self frame].size];
[img1 lockFocus];
[self drawInRect: [self frame]];
[img1 unlockFocus];

img2 = [[NSImage alloc] initWithSize: rect.size];
[img2 lockFocus];
[img1 drawInRect:NSMakeRect(0, 0, rect.size.width, rect.size.height) fromRect:rect operation:NSCompositeCopy fraction:0.7];
[img2 unlockFocus];

<--- snip --->


thanks,

MAX
_______________________________________________
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.

  • Prev by Date: Re: Unicode and NSTextView
  • Next by Date: Progress Bars and Notification Manager?
  • Previous by thread: Re: Unicode and NSTextView
  • Next by thread: Progress Bars and Notification Manager?
  • Index(es):
    • Date
    • Thread