
/*
	NSImage: Normalize bitmap's size to 72DPI
	Original Source: <http://cocoa.karelia.com/AppKit_Categories/NSImage__Normalize_.m>
	(See copyright notice at <http://cocoa.karelia.com>)
*/

/*" If a bitmap image, fix the size of the bitmap so that it is equal to the exact pixel dimensions. "*/

- (NSImage *) normalizeSize
{
	NSBitmapImageRep *theBitmap = nil;
	NSSize newSize;
	NSArray *reps = [self representations];
	int i;
	
	for (i = 0 ; i < [reps count] ; i++ )
	{
		NSImageRep *theRep = [reps objectAtIndex:i]; 
		if ([theRep isKindOfClass:[NSBitmapImageRep class]])
		{
			theBitmap = (NSBitmapImageRep *)theRep;
			break;
		}
	}
	if (nil != theBitmap)
	{
		newSize.width = [theBitmap pixelsWide];
		newSize.height = [theBitmap pixelsHigh];
		[theBitmap setSize:newSize];
		[self setSize:newSize];
	}
	return self;
}