Re: NSImage copy from custom view
Re: NSImage copy from custom view
- Subject: Re: NSImage copy from custom view
- From: Ian was here <email@hidden>
- Date: Wed, 22 Jun 2005 20:44:02 -0700 (PDT)
Something like this...
NSBitmapImageRep *bmRep;
NSImage *newImage =
[[NSImage alloc] initWithSize[myView bounds]];
// Copy bits from my view into a bitmap image
representation.
[myView lockFocus];
bmRep = [[NSBitmapImageRep alloc]
initWithFocusedViewRect [myView bounds]];
[myView unlockFocus];
// Draw the bitmapped view image into the new image.
[newImage lockFocus];
[bmRep drawAtPoint:NSMakePoint( 0.0, 0.0 );
[newImage unlockFocus];
[bmRep release];
--- Michael Carter <email@hidden> wrote:
> Hello all... quick question for the group:
>
> I have composited a couple images into a custom
> NSView. Now I'd like
> to take a 150x150px area from the composite and copy
> that into an
> NSImage that I can save to a file. How does one go
> about copying bits
> from one view into another NSImage?
>
> Thanks in advance.
> _________________________
> Mike Carter
> Aviate.Org :: Systems Admin
> iChat: PilotMike :: PGP-0x71E5B44C
>
> > _______________________________________________
> 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
__________________________________
Discover Yahoo!
Get on-the-go sports scores, stock quotes, news and more. Check it out!
http://discover.yahoo.com/mobile.html
_______________________________________________
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