Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
42 lines (36 sloc) 1.58 KB
// -----------------------------------------------------------------------------------
// NSImage-NKDBarcode.m
// -----------------------------------------------------------------------------------
// Created by Jeff LaMarche on Wed May 01 2002.
// Copyright (c) 2002 Naked Software. All rights reserved.
// -----------------------------------------------------------------------------------
// THIS SOURCE CODE IS PROVIDED AS-IS WITH NO WARRANTY OF ANY KIND
// -----------------------------------------------------------------------------------
// You may use and redistribute this source code without limitation
// -----------------------------------------------------------------------------------
#import "UIImage-NKDBarcode.h"
@implementation UIImage(NKDBarcode)
+(UIImage *)imageFromBarcode:(NKDBarcode *)barcode
{
NKDBarcodeOffscreenView * view = [[NKDBarcodeOffscreenView alloc] initWithBarcode:barcode];
CGRect rect = [view bounds];
UIImage * image = [view imageInsideRect:rect];
[view release];
return image;
}
+(NSData *)pdfFromBarcode:(NKDBarcode *)barcode {
NKDBarcodeOffscreenView * view = [[NKDBarcodeOffscreenView alloc] initWithBarcode:barcode];
CGRect rect = [view bounds];
NSData * pdf = [view pdfInsideRect:rect];
[view release];
return pdf;
}
+(UIImage *)imageFromBarcode:(NKDBarcode *)barcode inRect:(CGRect) rect
{
NKDBarcodeOffscreenView * view = [[NKDBarcodeOffscreenView alloc] initWithBarcode:barcode];
[view setFrame:rect];
UIImage * image = [view imageInsideRect:rect];
[view release];
return image;
}
@end