//
//  BXImageUtils.h
//  Boinx Utility Framework
//
//  Created by Achim Breidenbach on 2/18/05.
//  Copyright 2005 Boinx Software. All rights reserved.
//

#import <Accelerate/Accelerate.h>

@interface BXImageUtils : NSObject

// these methods have moved to an NSBitmapImageRep category

// deprecated; please use -[NSBitmapImageRep isVImageCompatible]
+ (BOOL)check32BitNSBitmapImageRepWithAlpha:(NSBitmapImageRep *)theImageRep;

// deprecated; please use -[NSBitmapImageRep vImageBuffer]
+ (vImage_Buffer)vImageBufferStructFromNSBitmapImageRep:(NSBitmapImageRep *)theImageRep;

// deprecated; please use +[NSBitmapImageRep imageRepForVImageOperationsWithSize:withColorSpaceNamed:]
+ (NSBitmapImageRep *)createNSBitmapImageRepForVImageOperationsWithSize:(NSSize)theImageSize withColorSpaceNamed:(NSString *)inColorSpaceName;

// deprecated; please use vImageFillWithAlpha(&[theImageRep vImageBuffer], format, alpha)
+ (void)fillNSBitmapImageRep:(NSBitmapImageRep *)theImageRep withAlphaValue:(unsigned char)alpha alphaByteFirst:(BOOL)alphaByteFirst;

// deprecated; please use vImageFillWithColor(&[theImageRep vImageBuffer], format, red, green, blue, alpha)
+ (void)fillNSBitmapImageRep:(NSBitmapImageRep *)theImageRep withRed:(unsigned char)red green:(unsigned char)green blue:(unsigned char)blue alpha:(unsigned char)alpha  alphaByteFirst:(BOOL)alphaByteFirst;

// deprecated; please use -[NSBitmapImageRep scaledImageWithSize:formatIsARGB:]
+ (NSImage *)scaleBitmapRep:(NSBitmapImageRep *)sourceImageBitmapRep newImageSize:(NSSize)newImageSize bitmapRepIsPreparedForVImageOperations:(BOOL)bitmapRepIsPreparedForVImageOperations;


// soon to be deprecated; please test -[NSBitmapImageRep permuteInPlaceRGBAtoARGB:]
+ (void)convertNSBitmapImageRep:(NSBitmapImageRep *)theImageRep pixelRGBAtoARGB:(BOOL)pixelRGBAtoARGB;

+ (NSBitmapImageRep *)create32BitNSBitmapImageRepFromNSImage:(NSImage *)theImage prepareForVImageOperations:(BOOL)prepareForVImageOperations NS_RETURNS_RETAINED;

// soon to be deprecated; please test -[NSBitmapImageRep create32BitDataAndPermuteRGBAtoARGB:]
+ (unsigned char *)create32BitDataFromBitmapImageRep:(NSBitmapImageRep *)bitmapImageRep prepareForVImageOperations:(BOOL)prepareForVImageOperations;


// these methods have moved to an NSImage category

// deprecated; please use -[NSImage biggestBitmapImageRep]
+ (NSBitmapImageRep *)findBiggestBitmapImageRep:(NSImage *)theImage;
// deprecated; please use -[NSImage biggestImageRepConsideringBitmapRepsOnly:]
+ (NSImageRep *)findBiggestImageRep:(NSImage *)theImage onlyBitmapReps:(BOOL)onlyBitmaps;
// deprecated; please use -[NSImage pixelAspectRatio]
+ (double)getPixelAspectRatio:(NSImage *)theImage;
// deprecated; please use -[NSImage pixelSize]
+ (NSSize)getPixelSize:(NSImage *)theImage;

// deprecated; please use -[NSImage flippedImageWithOrientation:]
+ (NSImage *)flipImage:(NSImage *)sourceImage withOrientation:(NSInteger)orientation;
// deprecated; please use -[NSImage croppedImageFromRect:]
+ (NSImage *)cropImage:(NSImage *)sourceImage cropRect:(NSRect)cropRect;
// deprecated; please use -[NSImage scaledImageWithSize:]
+ (NSImage *)scaleImage:(NSImage *)image newImageSize:(NSSize)newImageSize;
// deprecated; please use -[NSImage scaledAndCroppedImageWithSize:centered:]
+ (NSImage *)scaleAndCropImage:(NSImage *)sourceImage newImageSize:(NSSize)newImageSize centered:(BOOL)centered;
// deprecated; please use -[NSImage create32BitNSBitmapImageRepAndPrepareForVImageOperations:]

// these should probably move somewhere too
+ (BOOL)isImageFile:(NSString *)filePath;
+ (Rect)convertNSRectToQTRect:(NSRect)theNSRect;
+ (NSRect)convertQTRectToNSRect:(Rect)theRect;
+ (Rect)calcRect:(Rect)sourceRect toFitInRect:(Rect)destinationRect centered:(BOOL)centered;
+ (NSRect)calcNSRect:(NSRect)sourceRect toFitInNSRect:(NSRect)destinationRect centered:(BOOL)centered;
+ (NSRect)calcNSSize:(NSSize)theSourceSize toFitInNSSize:(NSSize)theDestinationSize centered:(BOOL)centered;
+ (NSRect)calcNSSize:(NSSize)sourceSize toCoverNSSize:(NSSize)destinationSize centered:(BOOL)centered;
+ (NSRect)calcFloatNSRect:(NSRect)sourceRect toFitInNSRect:(NSRect)destinationRect centered:(BOOL)centered;

@end
