Skip to content

Commit

Permalink
Merge pull request #4 from ngageoint/develop
Browse files Browse the repository at this point in the history
release 1.1.0
  • Loading branch information
bosborn authored Nov 21, 2017
2 parents 37f2f03 + 98cfe5c commit 95727a9
Show file tree
Hide file tree
Showing 13 changed files with 305 additions and 140 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ Adheres to [Semantic Versioning](http://semver.org/).

---

## 1.0.4 (TBD)
## [1.1.0](https://github.com/ngageoint/geopackage-tiff-ios/releases/tag/1.1.0) (11-21-2017)

* TBD
* TIFF Field Type sample format utilities
* Rasters initializer support for multiple samples per pixel
* Handle missing samples per pixel with default value of 1
* Public access to tiff tags
* String Entry Value getter and setter

## [1.0.3](https://github.com/ngageoint/geopackage-tiff-ios/releases/tag/1.0.3) (07-10-2017)

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ Include this repository by specifying it in a Podfile using a supported option.

Pull from [CocoaPods](https://cocoapods.org/pods/tiff-ios):

pod 'tiff-ios', '~> 1.0'
pod 'tiff-ios', '~> 1.1'

Pull from GitHub:

pod 'tiff-ios', :git => 'https://github.com/ngageoint/geopackage-tiff-iOS.git', :branch => 'master'
pod 'tiff-ios', :git => 'https://github.com/ngageoint/geopackage-tiff-iOS.git', :tag => '1.0.3'
pod 'tiff-ios', :git => 'https://github.com/ngageoint/geopackage-tiff-iOS.git', :tag => '1.1.0'

Include as local project:

Expand Down
2 changes: 1 addition & 1 deletion tiff-ios.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'tiff-ios'
s.version = '1.0.4'
s.version = '1.1.0'
s.license = {:type => 'MIT', :file => 'LICENSE' }
s.summary = 'iOS SDK for Tagged Image File Format'
s.homepage = 'https://github.com/ngageoint/geopackage-tiff-ios'
Expand Down
31 changes: 31 additions & 0 deletions tiff-ios/TIFFFieldTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ enum TIFFFieldType{
*/
+(int) bytes: (enum TIFFFieldType) fieldType;

/**
* Get the number of bits per value
*
* @param fieldType field type
*
* @return number of bits
*/
+(int) bits: (enum TIFFFieldType) fieldType;

/**
* Get the field type
*
Expand All @@ -59,4 +68,26 @@ enum TIFFFieldType{
*/
+(enum TIFFFieldType) typeByValue: (int) value;

/**
* Get the field type of the sample format and bits per sample
*
* @param sampleFormat
* sample format
* @param bitsPerSample
* bits per sample
*
* @return field type
*/
+(enum TIFFFieldType) typeBySampleFormat: (int) sampleFormat andBitsPerSample: (int) bitsPerSample;

/**
* Get the sample format of the field type
*
* @param fieldType
* field type
*
* @return sample format
*/
+(int) sampleFormatByType: (enum TIFFFieldType) fieldType;

@end
78 changes: 78 additions & 0 deletions tiff-ios/TIFFFieldTypes.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

#import "TIFFFieldTypes.h"
#import "TIFFConstants.h"

@implementation TIFFFieldTypes

Expand Down Expand Up @@ -63,8 +64,85 @@ +(int) bytes: (enum TIFFFieldType) fieldType{
return bytes;
}

+(int) bits: (enum TIFFFieldType) fieldType{
return [self bytes:fieldType] * 8;
}

+(enum TIFFFieldType) typeByValue: (int) value{
return (enum TIFFFieldType) value;
}

+(enum TIFFFieldType) typeBySampleFormat: (int) sampleFormat andBitsPerSample: (int) bitsPerSample{

enum TIFFFieldType fieldType = TIFF_FIELD_UNDEFINED;

if(sampleFormat == TIFF_SAMPLE_FORMAT_UNSIGNED_INT){
switch (bitsPerSample) {
case 8:
fieldType = TIFF_FIELD_BYTE;
break;
case 16:
fieldType = TIFF_FIELD_SHORT;
break;
case 32:
fieldType = TIFF_FIELD_LONG;
break;
}
}else if(sampleFormat == TIFF_SAMPLE_FORMAT_SIGNED_INT){
switch (bitsPerSample) {
case 8:
fieldType = TIFF_FIELD_SBYTE;
break;
case 16:
fieldType = TIFF_FIELD_SSHORT;
break;
case 32:
fieldType = TIFF_FIELD_SLONG;
break;
}
}else if(sampleFormat == TIFF_SAMPLE_FORMAT_FLOAT){
switch (bitsPerSample) {
case 32:
fieldType = TIFF_FIELD_FLOAT;
break;
case 64:
fieldType = TIFF_FIELD_DOUBLE;
break;
}
}

if (fieldType == TIFF_FIELD_UNDEFINED) {
[NSException raise:@"Unsupported Sample Format & Bits Per Sample" format:@"Unsupported field type for sample format: %d, bits per sample: %d", sampleFormat, bitsPerSample];
}

return fieldType;
}

+(int) sampleFormatByType: (enum TIFFFieldType) fieldType{

int sampleFormat;

switch (fieldType) {
case TIFF_FIELD_BYTE:
case TIFF_FIELD_SHORT:
case TIFF_FIELD_LONG:
sampleFormat = (int) TIFF_SAMPLE_FORMAT_UNSIGNED_INT;
break;
case TIFF_FIELD_SBYTE:
case TIFF_FIELD_SSHORT:
case TIFF_FIELD_SLONG:
sampleFormat = (int) TIFF_SAMPLE_FORMAT_SIGNED_INT;
break;
case TIFF_FIELD_FLOAT:
case TIFF_FIELD_DOUBLE:
sampleFormat = (int) TIFF_SAMPLE_FORMAT_FLOAT;
break;
default:
[NSException raise:@"Unsupported Field Type" format:@"Unsupported sample format for field type: %d", fieldType];
break;
}

return sampleFormat;
}

@end
115 changes: 114 additions & 1 deletion tiff-ios/TIFFFileDirectory.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@
*
* @return samples per pixel
*/
-(NSNumber *) samplesPerPixel;
-(int) samplesPerPixel;

/**
* Set the samples per pixel
Expand Down Expand Up @@ -748,6 +748,119 @@
*/
-(enum TIFFFieldType) fieldTypeForSample: (int) sampleIndex;

/**
* Get a short entry value
*
* @param fieldTagType
* field tag type
* @return short value
*/
-(NSNumber *) shortEntryValueWithFieldTag: (enum TIFFFieldTagType) fieldTagType;

/**
* Set an unsigned short entry value for the field tag type
*
* @param value
* unsigned short value (16 bit)
* @param fieldTagType
* field tag type
*/
-(void) setUnsignedShortEntryValue: (unsigned short) value withFieldTag: (enum TIFFFieldTagType) fieldTagType;

/**
* Get a number entry value
*
* @param fieldTagType
* field tag type
* @return number value
*/
-(NSNumber *) numberEntryValueWithFieldTag: (enum TIFFFieldTagType) fieldTagType;

/**
* Set an unsigned long entry value for the field tag type
*
* @param value
* unsigned long value (32 bit)
* @param fieldTagType
* field tag type
*/
-(void) setUnsignedLongEntryValue: (unsigned long) value withFieldTag: (enum TIFFFieldTagType) fieldTagType;

/**
* Get a string entry value for the field tag type
*
* @param fieldTagType
* field tag type
* @return string value
*/
-(NSString *) stringEntryValueWithFieldTag: (enum TIFFFieldTagType) fieldTagType;

/**
* Set string value for the field tag type
*
* @param value
* string value
* @param fieldTagType
* field tag type
*/
-(void) setStringEntryValue: (NSString *) value withFieldTag: (enum TIFFFieldTagType) fieldTagType;

/**
* Get an short list entry value
*
* @param fieldTagType
* field tag type
* @return short list value
*/
-(NSArray<NSNumber *> *) shortListEntryValueWithFieldTag: (enum TIFFFieldTagType) fieldTagType;

/**
* Set an unsigned short list of values for the field tag type
*
* @param value
* unsigned shorts list
* @param fieldTagType
* field tag type
*/
-(void) setUnsignedShortListEntryValue: (NSArray<NSNumber *> *) value withFieldTag: (enum TIFFFieldTagType) fieldTagType;

/**
* Get the max short from short list entry values
*
* @param fieldTagType
* field tag type
* @return max short value
*/
-(NSNumber *) maxShortEntryValueWithFieldTag: (enum TIFFFieldTagType) fieldTagType;

/**
* Get a number list entry value
*
* @param fieldTagType
* field tag type
* @return long list value
*/
-(NSArray<NSNumber *> *) numberListEntryValueWithFieldTag: (enum TIFFFieldTagType) fieldTagType;

/**
* Get a long list entry value
*
* @param fieldTagType
* field tag type
* @return long list value
*/
-(NSArray<NSNumber *> *) longListEntryValueWithFieldTag: (enum TIFFFieldTagType) fieldTagType;

/**
* Set an unsigned long list of values for the field tag type
*
* @param value
* unsigned longs list
* @param fieldTagType
* field tag type
*/
-(void) setUnsignedLongListEntryValue: (NSArray<NSNumber *> *) value withFieldTag: (enum TIFFFieldTagType) fieldTagType;

/**
* Size in bytes of the Image File Directory (all contiguous)
*
Expand Down
Loading

0 comments on commit 95727a9

Please sign in to comment.