HERE iOS SDK Developer's Guide

NMAImage

Class Summary

class NMAImage

Derived from: NSObject

Encapsulates an image file.

Include: NMAKit.framework/headers/NMAImage.h

Inheritance Diagrams

Figure 1. Public inheritance diagram for NMAImage

[For complete information, see the section Class Details]

Public Property Summary

Table 1. Public Properties
Public Properties

[readable, assign] CGSize  size

The size of the NMAImage in points

[readable, assign] BOOL  valid

The BOOL indicating whether the NMAImage contains a valid image

Instance Method Summary

Table 2. Instance Methods
Instance Method Summary

-(nullable UIImage *) UIImageRepresentation

Provides a UIImage representation of the NMAImage

-(nonnull instancetype) init

Initializes an NMAImage

-(nullable instancetype) initWithData:(nonnull NSData *) data

Initializes an NMAImage from raw data; see the class description for supported file types

-(nullable instancetype) initWithUIImage:(nonnull UIImage *) image

Initializes an NMAImage from an UIImage.

-(nullable instancetype) initWithURL:(nonnull NSString *) url

Initializes an NMAImage from a local image file URL; the path may be absolute or relative to the main bundle

Class Method Summary

Table 3. Class Methods
Class Methods

+(nullable instancetype) imageWithData:(nonnull NSData *) data

Constructs an NMAImage from raw data; see the class description for supported file types

+(nullable instancetype) imageWithUIImage:(nonnull UIImage *) image

Constructs an NMAImage from an UIImage.

+(nullable instancetype) imageWithURL:(nonnull NSString *) url

Constructs an NMAImage from a local image file URL; the path may be absolute or relative to the main bundle

Class Details

Encapsulates an image file.

Notes on NMAImage objects:
  • BMP, JPEG and PNG data formats are supported
  • BMP data format support is limited to either standard BMP v3 with 24/32 bits per pixel (without compression) or BMP v4/v5 (newer BMP formats) with 24/32 bits per pixel plus bitfields compression and A8R8G8B8 pixel formatting
  • Only basic parsing of the BMP header is done, while gamma correction and color profile information is ignored
Note:

PNG compression may be enabled by default in Xcode; files compressed this way cannot be loaded into an NMAImage through raw data or URL. These files may be first loaded into a UIImage and then used to create an NMAImage.

Public Property Details

[readable, assign] CGSize size

The size of the NMAImage in points.

[readable, assign] BOOL valid

The BOOL indicating whether the NMAImage contains a valid image.

Instance Method Details

-(nullable UIImage *) UIImageRepresentation

Provides a UIImage representation of the NMAImage.

Note:

Will return nil if the image could not be converted.

-(nonnull instancetype) init

Initializes an NMAImage.

-(nullable instancetype) initWithData:(nonnull NSData *) data

Initializes an NMAImage from raw data; see the class description for supported file types.

SVG format files are not supported

-(nullable instancetype) initWithUIImage:(nonnull UIImage *) image

Initializes an NMAImage from an UIImage.

When converting a UIImage to an NMAImage, the scale of the original image is compared against the scale of the device. If they are different, the image is resized so that the scale of the final image is the same as the device scale.

For example, if a 100x100 pixel UIImage with a scale of 2x is converted to an NMAImage on a 3x scale device, the NMAImage will have dimensions of 150x150 (and an implicit scale of 3x to match the device).

SVG format is not supported

-(nullable instancetype) initWithURL:(nonnull NSString *) url

Initializes an NMAImage from a local image file URL; the path may be absolute or relative to the main bundle.

SVG format files are not supported

Class Method Details

+(nullable instancetype) imageWithData:(nonnull NSData *) data

Constructs an NMAImage from raw data; see the class description for supported file types.

SVG format files are not supported

+(nullable instancetype) imageWithUIImage:(nonnull UIImage *) image

Constructs an NMAImage from an UIImage.

When converting a UIImage to an NMAImage, the scale of the original image is compared against the scale of the device. If they are different, the image is resized so that the scale of the final image is the same as the device scale.

For example, if a 100x100 pixel UIImage with a scale of 2x is converted to an NMAImage on a 3x scale device, the NMAImage will have dimensions of 150x150 (and an implicit scale of 3x to match the device).

SVG format is not supported

+(nullable instancetype) imageWithURL:(nonnull NSString *) url

Constructs an NMAImage from a local image file URL; the path may be absolute or relative to the main bundle.

SVG format files are not supported