forked from netshade/Cocoa-Touch-Barcodes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUIImage-Normalize.m
executable file
·71 lines (67 loc) · 2.3 KB
/
UIImage-Normalize.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// -----------------------------------------------------------------------------------
// UIImage-Normalize.m
// -----------------------------------------------------------------------------------
// Created by Jeff LaMarche on Sun May 12 2002.
// �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-Normalize.h"
@implementation UIImage (normalize)
// -----------------------------------------------------------------------------------
- (UIImage *) normalizeSize
// -----------------------------------------------------------------------------------
{
/*
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 (theBitmap != nil)
{
newSize.width = [theBitmap pixelsWide];
newSize.height = [theBitmap pixelsHigh];
[theBitmap setSize:newSize];
[self setSize:newSize];
}
*/
return self;
}
// -----------------------------------------------------------------------------------
- (UIImage *) setDPI:(int)dpi
// -----------------------------------------------------------------------------------
{
/*
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 (theBitmap != nil)
{
newSize.width = (float)([theBitmap pixelsWide])/dpi*72;
newSize.height = (float)([theBitmap pixelsHigh])/dpi*72;
[theBitmap setSize:newSize];
[self setSize:newSize];
}
*/
return self;
}
@end