//
//  ANImageHelper.h
//  AvisNocturnaCrossCore
//
//  Created by Mendel Kucharzeck on 19.12.11.
//  Copyright 2011 AvisNocturna Software. All rights reserved.
//



@interface ANImageHelper : NSObject

//Saving & Reading to Preferences
+ (NSData*) dataForPreferencesFromPlatformImage:(id)plattformImage;
+ (id) platformImageFromDataFromPreferences:(NSData*)data;

//Attributes
+ (CGSize) sizeOfPlattformImage:(id)image;

//Plattform Images
+ (id) platformImageFromCGImage:(CGImageRef)imageRef;
+ (id) platformImageFromPNGData:(NSData*)data;
+ (id) platformImageFromPNGNamed:(NSString*)name;
+ (NSData*) pngDataFromPlatformImage:(id)image;
+ (CGImageRef) imageRefFromPlattformImage:(id)image;

//PNGs
+ (CGImageRef) createImageRefFromPNGData:(NSData*)data;
+ (CGImageRef) createImageRefFromPNGNamed:(NSString*)name;
+ (NSData*) pngDataFromCGImageRef:(CGImageRef)imageRef;
+ (NSData*) pngDataFromCGImageRef:(CGImageRef)imageRef withDPIInformation:(NSInteger)dpi;

//JPEGs
+ (CGImageRef) createImageRefFromJPEGData:(NSData*)data;
+ (NSData*) jpegDataFromCGImageRef:(CGImageRef)imageRef;
+ (NSData*) jpegDataFromCGImageRef:(CGImageRef)imageRef withDPIInformation:(NSInteger)dpi;

//PDFs
+ (NSData*) pdfDataFromCGImageRef:(CGImageRef)imageRef;
+ (CGPDFDocumentRef) pdfDocumentFromCGImageRef:(CGImageRef)imageRef;

//CIImages
+ (void) drawCIImage:(CIImage*)image fromRect:(CGRect)fromRect toRect:(CGRect)toRect inContext:(CGContextRef)context;

//Alpha
+ (BOOL) isCGImageOpaque:(CGImageRef)image; //Expensive!

@end
