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
<naresh.kong...@prithvisolutions.com> 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 (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/naresh.kongara%40prithvisolutions.com

This email sent to naresh.kong...@prithvisolutions.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