File: programming/cocoa/ NiceScaling.m

/* =============================================================================
    PROJECT:    Filie
    FILE:       NSImage+NiceScaling.h
    COPYRIGHT:  (c) 2003-2007 by M. Uli Kusterer, all rights reserved.
    AUTHORS:    M. Uli Kusterer - UK
				Sergey Shapovalov
    LICENSES:   GNU GPL, Modified BSD
		2007-04-07	UK	Added much better version of scaledSize:toFitSize:
						by Sergey Shapovalov. Don't know what I was thinking
						when I wrote the original code.
        2003-12-19  UK  Created.
   ========================================================================== */
// -----------------------------------------------------------------------------
//  Headers:
// -----------------------------------------------------------------------------
#import "NSImage+NiceScaling.h"
"Couldn't scale image %@"// Center it:
// Center h and v.
// Center h, v at top.
// h at left, v at top.
// h at left, center v.
// h at left, v at bottom
// center h, v at bottom.
// h at right, v at bottom.
// h at right, center v.
// h at right, v at top.
"Couldn't scale image %@"/*if( imgSize.width == size.width
		&& imgSize.height == size.height )
		return imgSize;*/

This code uses the PclZip Zip File reading code, which is subject to the GNU LGPL. It also uses the GeSHi syntax highlighter, subject to the GPL. Ask if you want this for your own web site, it's free.