@@ -172,14 +172,41 @@ PGRectEdgeMask PGReadingDirectionAndLocationToRectEdgeMask(PGPageLocation loc, P
172
172
173
173
#pragma mark PGOrientation
174
174
175
+ PGOrientation PGOrientationWithTIFFOrientation (NSUInteger orientation)
176
+ {
177
+ switch (orientation) {
178
+ case 2 : return PGFlippedHorz;
179
+ case 3 : return PGUpsideDown;
180
+ case 4 : return PGFlippedVert;
181
+ case 5 : return PGRotated90CCW | PGFlippedHorz;
182
+ case 6 : return PGRotated90CW;
183
+ case 7 : return PGRotated90CCW | PGFlippedVert;
184
+ case 8 : return PGRotated90CCW;
185
+ default : return PGUpright;
186
+ }
187
+ }
175
188
PGOrientation PGAddOrientation (PGOrientation o1, PGOrientation o2)
176
189
{
177
190
PGOrientation n1 = o1, n2 = o2;
178
- if (o1 & PGRotated90CC && !(o2 & PGRotated90CC )) n2 = ((o2 & PGFlippedHorz) >> 1 ) | ((o2 & PGFlippedVert) << 1 );
191
+ if (o1 & PGRotated90CCW && !(o2 & PGRotated90CCW )) n2 = ((o2 & PGFlippedHorz) >> 1 ) | ((o2 & PGFlippedVert) << 1 );
179
192
PGOrientation r = n1 ^ n2;
180
- if (o1 & PGRotated90CC && o2 & PGRotated90CC ) r ^= PGUpsideDown;
193
+ if (o1 & PGRotated90CCW && o2 & PGRotated90CCW ) r ^= PGUpsideDown;
181
194
return r;
182
195
}
196
+ NSString *PGLocalizedStringWithOrientation (PGOrientation orientation)
197
+ {
198
+ // TODO: Add these to the Localizable.strings files.
199
+ switch (orientation) {
200
+ case PGFlippedHorz: return NSLocalizedString(@" Flipped Horizontally" , nil );
201
+ case PGUpsideDown: return NSLocalizedString(@" Upside Down" , nil );
202
+ case PGFlippedVert: return NSLocalizedString(@" Flipped Vertically" , nil );
203
+ case PGRotated90CCW | PGFlippedHorz: return NSLocalizedString(@" Rotated CCW & Flipped Horizontally" , nil );
204
+ case PGRotated90CW: return NSLocalizedString(@" Rotated CW" , nil );
205
+ case PGRotated90CCW | PGFlippedVert: return NSLocalizedString(@" Rotated CCW & Flipped Vertically" , nil );
206
+ case PGRotated90CCW: return NSLocalizedString(@" Rotated CCW" , nil );
207
+ default : return NSLocalizedString(@" Upright" , nil );
208
+ }
209
+ }
183
210
184
211
#pragma mark PGInset
185
212
0 commit comments