MTColorRamp
@MainActor
public final class MTColorRamp : @unchecked Sendable
Swift wrapper over the MapTiler SDK ColorRamp class.
-
Undocumented
Declaration
Swift
@MainActor public let identifier: String -
Creates a custom color ramp using the provided options.
Declaration
Swift
@MainActor public convenience init(options: MTColorRampOptions) -
Creates a custom color ramp using explicit values and stops.
Declaration
Swift
@MainActor public convenience init(min: Double? = nil, max: Double? = nil, stops: [MTColorRampStop]) -
Creates a color ramp from a built-in preset. The preset is cloned to keep the global preset untouched.
Declaration
Swift
@MainActor public static func preset(_ preset: MTColorRampPreset) -> MTColorRamp -
Creates a color ramp from the array definition.
Declaration
Swift
@MainActor public static func fromArrayDefinition(_ definition: [MTColorRampArrayStop]) -> MTColorRamp -
getBounds(in:Asynchronous) Returns bounds of the color ramp.
Declaration
Swift
@MainActor public func getBounds(in mapView: MTMapView) async throws -> MTColorRampBounds -
getColor(at:Asynchronoussmooth: in: ) Returns the color at the provided value.
Declaration
Swift
@MainActor public func getColor( at value: Double, smooth: Bool = true, in mapView: MTMapView ) async throws -> MTRGBAColor -
getColorHex(at:Asynchronoussmooth: includeAlpha: in: ) Returns the color hex string at the provided value.
Declaration
Swift
@MainActor public func getColorHex( at value: Double, smooth: Bool = true, includeAlpha: Bool = false, in mapView: MTMapView ) async throws -> String -
getColorRelative(at:Asynchronoussmooth: in: ) Returns the color for a relative value in [0, 1].
Declaration
Swift
@MainActor public func getColorRelative( at value: Double, smooth: Bool = true, in mapView: MTMapView ) async throws -> MTRGBAColor -
getRawColorStops(in:Asynchronous) Returns raw stops backing the ramp.
Declaration
Swift
@MainActor public func getRawColorStops(in mapView: MTMapView) async throws -> [MTColorRampStop] -
clone(in:Asynchronous) Clones the color ramp.
Declaration
Swift
@MainActor public func clone(in mapView: MTMapView) async throws -> MTColorRamp -
reverse(clone:Asynchronousin: ) Returns a ramp reversed in-place or cloned depending on the
cloneflag.Declaration
Swift
@MainActor public func reverse(clone: Bool = true, in mapView: MTMapView) async throws -> MTColorRamp -
scale(min:Asynchronousmax: clone: in: ) Scales the ramp to the given bounds.
Declaration
Swift
@MainActor public func scale( min: Double, max: Double, clone: Bool = true, in mapView: MTMapView ) async throws -> MTColorRamp -
setStops(_:Asynchronousclone: in: ) Replaces the stops on the ramp.
Declaration
Swift
@MainActor public func setStops( _ stops: [MTColorRampStop], clone: Bool = true, in mapView: MTMapView ) async throws -> MTColorRamp -
resample(_:Asynchronoussamples: in: ) Resamples the ramp using the provided method and sample count.
Declaration
Swift
@MainActor public func resample( _ method: MTColorRampResampleMethod, samples: Int = 15, in mapView: MTMapView ) async throws -> MTColorRamp -
transparentStart(in:Asynchronous) Prepends a transparent stop at the beginning of the ramp.
Declaration
Swift
@MainActor public func transparentStart(in mapView: MTMapView) async throws -> MTColorRamp -
hasTransparentStart(in:Asynchronous) Returns true if the first stop is transparent.
Declaration
Swift
@MainActor public func hasTransparentStart(in mapView: MTMapView) async throws -> Bool -
getCanvasStrip(options:Asynchronousin: ) Renders the ramp to a canvas strip and returns it as
UIImage.Declaration
Swift
@MainActor public func getCanvasStrip( options: MTColorRampCanvasStripOptions = MTColorRampCanvasStripOptions(), in mapView: MTMapView ) async throws -> UIImage -
Deprecated completion-based variant of
getColor(at:smooth:in:).Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor func getColor( at value: Double, smooth: Bool = true, in mapView: MTMapView, completionHandler: ((Result<MTRGBAColor, MTError>) -> Void)? = nil ) -
Deprecated completion-based variant of
getColorHex(at:smooth:includeAlpha:in:).Declaration
-
Deprecated completion-based variant of
getBounds(in:).Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor func getBounds( in mapView: MTMapView, completionHandler: ((Result<MTColorRampBounds, MTError>) -> Void)? = nil ) -
Deprecated completion-based variant of
getRawColorStops(in:).Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor func getRawColorStops( in mapView: MTMapView, completionHandler: ((Result<[MTColorRampStop], MTError>) -> Void)? = nil ) -
Deprecated completion-based variant of
clone(in:).