MaplyImageTile

Objective-C

@interface MaplyImageTile : NSObject

Swift

class MaplyImageTile : NSObject

Describes a single tile worth of data, which may be multiple images.

Delegates can pass back a single UIImage or NSData object, but if they want to do anything more complex, they need to do it with this.

  • Initialize with an NSData object containing 32 bit pixels.

    This sets up the tile with an NSData object containing raw pixels. The pixels are 32 bit RGBA even if you’re targeting a smaller pixel format.

    Declaration

    Objective-C

    - (instancetype)initWithRawImage:(NSData *)data
                               width:(int)width
                              height:(int)height
                               viewC:
                                   (NSObject<MaplyRenderControllerProtocol> *)viewC;

    Swift

    init!(rawImage data: Data!, width: Int32, height: Int32, viewC: (NSObjectProtocol & MaplyRenderControllerProtocol)!)

    Parameters

    data

    The NSData object containing 32 bit RGBA pixels.

    width

    The width of the raw image contained in the data object.

    height

    The height of the raw image contained in the data object.

  • Initialize with an NSData object containing 32 bit pixels.

    This sets up the tile with an NSData object containing raw pixels. The pixels are 32 bit RGBA even if you’re targeting a smaller pixel format.

    Declaration

    Objective-C

    - (instancetype)initWithRawImage:(NSData *)data
                               width:(int)width
                              height:(int)height
                          components:(int)comp
                               viewC:
                                   (NSObject<MaplyRenderControllerProtocol> *)viewC;

    Swift

    init!(rawImage data: Data!, width: Int32, height: Int32, components comp: Int32, viewC: (NSObjectProtocol & MaplyRenderControllerProtocol)!)

    Parameters

    data

    The NSData object containing 32 bit RGBA pixels.

    width

    The width of the raw image contained in the data object.

    height

    The height of the raw image contained in the data object.

    comp

    The number of components (1, 2 or 4)

  • Initialize with an NSData object containing pixels of a given format.

    This sets up the tile with an NSData object containing raw pixels. The pixels are defined by the format.

    Declaration

    Objective-C

    - (instancetype)initWithRawImage:(NSData *)data
                              format:(MaplyQuadImageFormat)format
                               width:(int)width
                              height:(int)height
                               viewC:
                                   (NSObject<MaplyRenderControllerProtocol> *)viewC;

    Swift

    init!(rawImage data: Data!, format: MaplyQuadImageFormat, width: Int32, height: Int32, viewC: (NSObjectProtocol & MaplyRenderControllerProtocol)!)

    Parameters

    data

    The NSData object containing pixels.

    format

    The image format the data is already in.

    width

    The width of the raw image contained in the data object.

    height

    The height of the raw image contained in the data object.

  • Initialize with a single UIImage for the tile.

    This sets up the given UIImage as the return for the given tile. You can then set targetSize and such.

    Declaration

    Objective-C

    - (instancetype)initWithImage:(id)image
                            viewC:(NSObject<MaplyRenderControllerProtocol> *)viewC;

    Swift

    init!(image: Any!, viewC: (NSObjectProtocol & MaplyRenderControllerProtocol)!)
  • Initialize with an NSData object containing PNG or JPEG data that can be interpreted by UIImage.

    We’re expecting PNG, JPEG or another self identified format (e.g. PKM). These we can interpret ourselves.

    Declaration

    Objective-C

    - (instancetype)
        initWithPNGorJPEGData:(NSData *)data
                        viewC:(NSObject<MaplyRenderControllerProtocol> *)viewC;

    Swift

    init!(pnGorJPEGData data: Data!, viewC: (NSObjectProtocol & MaplyRenderControllerProtocol)!)
  • Border size that was set on initialization.

    If there’s a built in border as part of the image data passed in during initialization, set it here. Normally this is 0.

    Declaration

    Objective-C

    @property (nonatomic) int borderSize;

    Swift

    var borderSize: Int32 { get set }
  • Target size for the image(s) represented by this tile.

    This instructs the pager to rescale the image(s) to the given target size. This is probably faster than doing it yourself because we can extract the data and rescale in the same step.

    Declaration

    Objective-C

    @property (nonatomic) CGSize targetSize;

    Swift

    var targetSize: CGSize { get set }
  • Preprocess into a simple texture format.

    Extracting from PNG or JPEG or whatever often requires a bit of work. We’ll do that work later, if this isn’t called. But if you do call it here then you can do that work on your own thread.

    Declaration

    Objective-C

    - (void)preprocessTexture;

    Swift

    func preprocessTexture()