• 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
Re: NSImage ignoring interpolation: Is this a bug?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSImage ignoring interpolation: Is this a bug?


  • Subject: Re: NSImage ignoring interpolation: Is this a bug?
  • From: Mark Onyschuk <email@hidden>
  • Date: Sat, 25 Nov 2006 16:16:14 -0500


On 24-Nov-06, at 9:15 PM, Scott Stevenson wrote:

Playing around with NSImage I noticed that it's pretty brutal to scaling bitmap images. It looks like it's ignoring the interpolation setting on the context.


This draws the images in a relatively pixelated manner:

	[[NSGraphicsContext currentContext]
		setImageInterpolation: NSImageInterpolationHigh];

NSSize size = { 256, 160 };
float center = [self bounds].size.width * 0.50;
float middle = [self bounds].size.height * 0.50;
NSPoint origin = { center - size.width * 0.50, middle + size.height * 0.5 };


	NSString * path = @"/Library/Desktop Pictures/Aqua Blue.jpg";
	NSImage * image = [[NSImage alloc] initByReferencingFile:path];

	[image setScalesWhenResized:YES];
	[image setSize: size];
	[image compositeToPoint:origin operation:NSCompositeSourceOver];

[image release];

Just a thought, the -[NSImage compositeToPoint:operation:] is a method from back in the NeXTstep days and has some behaviors that are meant to be compatible with code from the days of Display Postscript.


You might find that the -drawInRect:fromRect:operation:fraction: method (that's new in Mac OS X and Quartz) behaves better for you.

-Mark

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: NSImage ignoring interpolation: Is this a bug?
      • From: Scott Stevenson <email@hidden>
    • Re: NSImage ignoring interpolation: Is this a bug?
      • From: Scott Stevenson <email@hidden>
References: 
 >NSImage ignoring interpolation: Is this a bug? (From: Scott Stevenson <email@hidden>)

  • Prev by Date: Re: Debugging an ignored exception
  • Next by Date: Opening a specific helppage with openHelpAnchor
  • Previous by thread: Re: NSImage ignoring interpolation: Is this a bug?
  • Next by thread: Re: NSImage ignoring interpolation: Is this a bug?
  • Index(es):
    • Date
    • Thread