• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Gluing two images together question...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Gluing two images together question...


  • Subject: Gluing two images together question...
  • From: Jerry LeVan <email@hidden>
  • Date: Mon, 17 Dec 2007 19:11:43 -0500

Hi,

I am trying to add a "display two images side by side" feature to
one of my apps.

The following snippet does the job by the resulting image is a
low res image does not zoom without pixelation. Is there a
way to glue two images together into a single image that keeps
the approximate resolution of the components?

In the following code each of tmp1 and tmp2 are jpgs that
can be zoomed a great deal and not show pixelation.

The resulting image "displayed" image winds up have
pixel size = point size. Not good for zooming ;(

Thanks

Jerry

NSImage * tmp1 = [[NSImage alloc] initWithContentsOfFile: (NSString*) [fileNameList objectAtIndex:slideNumber]];
NSImage * tmp2 = [[NSImage alloc] initWithContentsOfFile: (NSString*) [fileNameList objectAtIndex:nextSlide]];
int x1 = [tmp1 size].width; int x2 = [tmp2 size].width;
int y1 = [tmp1 size].height; int y2 = [tmp2 size].height;
float newHeight;
if (y1 > y2){
newHeight = y1;
}
else {
newHeight=y2;
}
displayedImage = [[NSImage alloc] initWithSize: NSMakeSize(x1+x2,newHeight)];
[displayedImage lockFocus];
[tmp1 drawAtPoint:NSMakePoint(0.0,0.0) fromRect: NSMakeRect(0,0,x1,y1) operation:NSCompositeCopy fraction:1.0];
[tmp2 drawAtPoint:NSMakePoint(x1,0.0) fromRect: NSMakeRect(0,0,x2,y2) operation:NSCompositeCopy fraction:1.0];
[displayedImage unlockFocus];
//NSLog(@"dispImg=%@" ,displayedImage);
[tmp1 release]; [tmp2 release];
_______________________________________________


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


  • Follow-Ups:
    • Re: Gluing two images together question...
      • From: "Ken Ferry" <email@hidden>
  • Prev by Date: Re: Making custom key-commands
  • Next by Date: Re: Making custom key-commands
  • Previous by thread: Re: setWantsLayer causes text fields to draw focus ring incorrectly
  • Next by thread: Re: Gluing two images together question...
  • Index(es):
    • Date
    • Thread