FROM : douglas a. welton
DATE : Sat Jun 21 23:41:54 2008
Depending on what you are going to do with the "sub-images" once you
create them, you might want to consider using a CIImage with the
CICrop core image filter.
On Jun 21, 2008, at 9:41 AM, Dharmendra wrote:
> Hi,
> I am trying to get a user-defined image in specific format (m x nm)
> and want
> to generate an array with count n containing m x m sized images. I
> have
> written the following code, but would like to know if there is
> better way to
> do the same:
>
> m=...;
>
> NSImage *userImage=[[NSImage alloc]
> initWithContentsOfFile:@"xxx.gif"];
>
> unsigned int n=[userImage size].width/m;
>
> NSMutableArray *images = [NSMutableArray arrayWithCapacity:n];
>
> for(i=0;i<n;i++) {
>
> NSImage *testImage=[[NSImage alloc] initWithSize:NSMakeSize(m,m)];
>
> [testImage lockFocus];
>
> [userImage drawInRect:NSMakeRect(0,0,m,m) fromRect:NSMakeRect(m*i,
> 0,m,m)
> operation:NSCompositeSourceOver fraction:1.0];
>
> [testImage unlockFocus];
>
> [images addObject:testImage];
>
> }
> _______________________________________________
>
> Cocoa-dev mailing list (<email_removed>)
>
> 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/<email_removed>
>
> This email sent to <email_removed>
DATE : Sat Jun 21 23:41:54 2008
Depending on what you are going to do with the "sub-images" once you
create them, you might want to consider using a CIImage with the
CICrop core image filter.
On Jun 21, 2008, at 9:41 AM, Dharmendra wrote:
> Hi,
> I am trying to get a user-defined image in specific format (m x nm)
> and want
> to generate an array with count n containing m x m sized images. I
> have
> written the following code, but would like to know if there is
> better way to
> do the same:
>
> m=...;
>
> NSImage *userImage=[[NSImage alloc]
> initWithContentsOfFile:@"xxx.gif"];
>
> unsigned int n=[userImage size].width/m;
>
> NSMutableArray *images = [NSMutableArray arrayWithCapacity:n];
>
> for(i=0;i<n;i++) {
>
> NSImage *testImage=[[NSImage alloc] initWithSize:NSMakeSize(m,m)];
>
> [testImage lockFocus];
>
> [userImage drawInRect:NSMakeRect(0,0,m,m) fromRect:NSMakeRect(m*i,
> 0,m,m)
> operation:NSCompositeSourceOver fraction:1.0];
>
> [testImage unlockFocus];
>
> [images addObject:testImage];
>
> }
> _______________________________________________
>
> Cocoa-dev mailing list (<email_removed>)
>
> 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/<email_removed>
>
> This email sent to <email_removed>
| Related mails | Author | Date |
|---|---|---|
| Dharmendra | Jun 21, 15:41 | |
| douglas a. welton | Jun 21, 23:41 | |
| Ken Thomases | Jun 22, 01:47 |






Cocoa mail archive

