Re: Dividing NSView to subviews
Re: Dividing NSView to subviews
- Subject: Re: Dividing NSView to subviews
- From: Naresh Kongara <email@hidden>
- Date: Mon, 27 Apr 2009 09:46:05 +0530
Hi,
To get the image, I added the below method (what peter has given) in
NSView's category
- (NSImage *)imageFromRect:(NSRect) sourceRect
{
NSSize imgSize = sourceRect.size;
NSBitmapImageRep *bir = [self
bitmapImageRepForCachingDisplayInRect:sourceRect];
[bir setSize:imgSize];
[self cacheDisplayInRect:sourceRect toBitmapImageRep:bir];
NSImage* image = [[[NSImage alloc] initWithSize:imgSize] autorelease];
[image addRepresentation:bir];
return image;
}
in the view drawing code i didn't changed any thing.
After preparing the view from which i need to get the images, i just
replaced the line
NSImage *img = [[[NSImage alloc] initWithData:[view
dataWithPDFInsideRect:sourceRect]] autorelease];
with
NSImage *img = [view imageFromRect:sourceRect];
The view drawing is same for both the cases,
but -(NSImage *)imageFromRect:(NSRect) is giving me a some what
blurred image...
Thanks,
NareshK
On Apr 25, 2009, at 5:52 AM, Michael Ash wrote:
On Fri, Apr 24, 2009 at 8:02 AM, Naresh Kongara
<email@hidden> wrote:
Thanks peter for your reply,
Now there is some improvement in the performance , but the image is
not that
much clear as the image we are getting with dataWithPDFInsideRect:
is there any way to remove that blur.
The technique that Peter showed will produce *exactly* the same pixels
that get rendered to the screen. If you have blur, it's either because
your view is blurry itself, or your drawing code is blurry. Either
way, we can't tell you what's going wrong unless you post your code.
Mike
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden