On 23/04/2009, at 14:11 , Naresh Kongara wrote:

I have a NSView which i want to divide into to required sub views.

I implemented it using NSView's dataWithPDFInsideRect: (NSRect )aRect, i.e constructed a image view with the data i got .
This process is taking long time if the view is large one..

Is there any other way to get the required part of a View.


Ironically (or perhaps fortuitously) I've been dealing with this issue reasonly and just posted a result of my research and experiments at

<http://www.stairways.com/blog/2009-04-21-nsimage-from-nsview>

The end result was a category on NSView:

- (NSImage *)imageWithSubviews
{
        NSSize mySize = self.bounds.size;
        NSSize imgSize = NSMakeSize( mySize.width, mySize.height );
        
NSBitmapImageRep *bir = [self bitmapImageRepForCachingDisplayInRect: [self bounds]];
        [bir setSize:imgSize];
        [self cacheDisplayInRect:[self bounds] toBitmapImageRep:bir];
        
        NSImage* image = [[[NSImage alloc]initWithSize:imgSize] autorelease];
        [image addRepresentation:bir];
        return image;
}
Based on Greg Knobs post <http://www.cocoabuilder.com/archive/message/cocoa/2007/11/17/193329 >.
Enjoy,
   Peter.

--
     Run macros from your iPhone with Keyboard Maestro Control!
         or take a break with Derzle for your iPhone

Keyboard Maestro <http://www.keyboardmaestro.com/> Macros for your Mac
Aragom Space War <http://www.stairways.com/iphone/aragom> Don't get killed!
Derzle <http://www.stairways.com/iphone/derzle> Enjoy a relaxing puzzle.
<http://www.stairways.com/>           <http://download.stairways.com/>




_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to