package maplibre
import "maplibre.org/maplibre-native-ffi/bindings/go/maplibre"
Package maplibre is the low-level Go binding for the MapLibre Native C API.
A program links the C library by importing the module of a preset, such as maplibre.org/maplibre-native-ffi/go-native/linux-gnu-x64-vulkan, for its side effect. With the mln_pkgconfig build tag, it links a C library that pkg-config finds instead.
The first RenderSessionHandle.ServiceDriverWork call fixes a caller-driver session's graphics thread, and the Go scheduler moves goroutines between OS threads. Call runtime.LockOSThread on the goroutine that services the session and hold it for the session's lifetime.
Acquired frames expose their texture only inside a callback such as AcquiredFrameHandle.WithOpenGLTexture, on the callback's OS thread. Keep servicing a caller-driver render session while its attachment or detachment is pending.
Calls from inside a log or Vulkan queue-lock callback return StatusInvalidState. A callback may wait for a submission's acceptance but not for its completion, which can deadlock native work that needs the callback to return. A scoped response such as HTTPHeaderTransformResponseScope works only during its callback, on the callback's thread.
Each call of a Go callback enters the Go runtime from a native thread. A host whose wake or queue lock is already a C function passes it as a native registration from NewNativeWake or NewNativeQueueLock, with the C function pointers and context as uintptr values. The first call that carries a native registration consumes it, and a later call returns StatusInvalidState. Native code releases the context of a call that it accepts, and the binding calls the release for any other call.
JSON crosses as a string. An absent JSON result, such as an undefined layer property, is "", since present JSON is never empty.
A callback whose C type returns a status returns an error instead. Nil answers StatusOk, and a failure Status or an *Error with one, or an error that wraps either, answers that status on purpose. Any other error is a bug: the binding logs it with log/slog.Error on the default logger and answers the callback's failure status.
The binding recovers a callback's panic, returns the callback's failure value to native, and logs the panic with log/slog.Error on the default logger. Go cleanup disposes an owner that the host abandoned and logs it with log/slog.Warn.
Code generated by tools/bindgen; DO NOT EDIT.
Index
- Constants
- func CVersion() uint32
- func ClearLogCallback() error
- func GetPluginRegisterFunctionV1() uintptr
- func LogicalExtentPhysicalSize(extent LogicalExtent) (width uint32, height uint32, err error)
- func SetLogAsyncSeverityMask(mask LogSeverityFlag) error
- func SetLogCallback(handler LogHandler) error
- func SetNetworkStatus(status NetworkStatus) error
- type AbiVersionMismatchError
-
type AcquiredFrameHandle
- func (receiver *AcquiredFrameHandle) Discard() error
- func (handle *AcquiredFrameHandle) ID() uint64
- func (handle *AcquiredFrameHandle) IsClosed() bool
- func (receiver *AcquiredFrameHandle) Release(consumerCompletion GPUSync) error
- func (receiver *AcquiredFrameHandle) Result() (RenderFrameResult, error)
- func (handle *AcquiredFrameHandle) String() string
- func (receiver *AcquiredFrameHandle) WithDmaBuf(callback func(DmaBufFrameView) error) error
- func (receiver *AcquiredFrameHandle) WithOpenGLTexture(callback func(OpenGLTextureFrameView) error) error
- func (receiver *AcquiredFrameHandle) WithProducerSync(callback func(GPUSyncView) error) error
- func (receiver *AcquiredFrameHandle) WithVulkanTexture(callback func(VulkanTextureFrameView) error) error
- type AnchoredMomentum
- type AndroidHardwareBufferFrame
-
type AndroidHardwareBufferFrameView
- func (view AndroidHardwareBufferFrameView) Height() uint32
- func (view AndroidHardwareBufferFrameView) ScaleFactor() float64
- func (view AndroidHardwareBufferFrameView) Slot() uint32
- func (view AndroidHardwareBufferFrameView) UnsafeBuffer() (uintptr, error)
- func (view AndroidHardwareBufferFrameView) Width() uint32
- type AndroidHardwareBufferRingDescriptor
- type AndroidSurfaceDescriptor
- type AndroidSurfaceReplacement
- type AnimationOptions
- type BoundOptions
- type CacheDatabaseOperation
- type Camera
- type CameraBounds
- type CameraChangeMode
- type CameraChangeSource
- type CameraDelta
- type CameraFitOptions
- type CameraFitUpdate
- type CameraOptions
- type CameraQueryResult
- type CameraTransitionEnd
- type CameraTransitionHandler
- type CameraTransitionOutcome
- type CameraUpdate
- type CameraUpdateMode
- type CameraVelocity
- type CanonicalTileID
- type CommandCompletion
- type ConstrainMode
- type CustomGeometrySourceOptions
- type CustomVectorSourceOptions
- type DmaBufFormat
- type DmaBufFrame
-
type DmaBufFrameView
- func (view DmaBufFrameView) Fourcc() uint32
- func (view DmaBufFrameView) Height() uint32
- func (view DmaBufFrameView) Modifier() uint64
- func (view DmaBufFrameView) Planes() ([]DmaBufPlane, error)
- func (view DmaBufFrameView) ScaleFactor() float64
- func (view DmaBufFrameView) Slot() uint32
- func (view DmaBufFrameView) Width() uint32
- type DmaBufPlane
- type DmaBufRingDescriptor
- type DxgiSharedTextureFrame
-
type DxgiSharedTextureFrameView
- func (view DxgiSharedTextureFrameView) Format() uint32
- func (view DxgiSharedTextureFrameView) Height() uint32
- func (view DxgiSharedTextureFrameView) ScaleFactor() float64
- func (view DxgiSharedTextureFrameView) Slot() uint32
- func (view DxgiSharedTextureFrameView) UnsafeHandle() (uintptr, error)
- func (view DxgiSharedTextureFrameView) Width() uint32
- type DxgiSharedTextureRingDescriptor
- type EGLContextDescriptor
- type EdgeInsets
- type Error
- type FeatureID
- type FeatureIDDoubleValueVariant
- type FeatureIDIntValueVariant
- type FeatureIDStringValueVariant
- type FeatureIDUintValueVariant
- type FeatureStateSelector
- type FrameDemand
- type FrameDemandFlag
- type FramePacerHandle
- type FramePacerOptions
- type FreeCamera
- type FreeCameraOptions
- type Future
- type GPUSync
- type GPUSyncKind
- type GPUSyncKindFlag
- type GPUSyncView
- type GeoJSONSourceOptions
- type GestureMomentum
- type GesturePhase
- type HTTPHeader
- type HTTPHeaderRule
- type HTTPHeaderTransform
- type HTTPHeaderTransformResponseScope
- type ImageContent
- type ImageStretch
- type IoSurfaceFrame
- type IoSurfaceFrameView
- type IoSurfaceRingDescriptor
- type LatLng
- type LatLngBounds
- type LogEvent
- type LogHandler
- type LogSeverity
- type LogSeverityFlag
- type LogicalExtent
- type LogicalSize
- type MapDebugFlag
-
type MapHandle
- func (receiver *MapHandle) AddCustomGeometrySource(sourceID string, options CustomGeometrySourceOptions) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) AddCustomVectorSource(sourceID string, options CustomVectorSourceOptions) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) AddGeoJSONSource(sourceID string, options *GeoJSONSourceOptions, attribution string) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) AddImageSourceImage(sourceID string, coordinates []LatLng, image PremultipliedRgba8Image) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) AddStyleLayerJSON(layerJSON string, beforeLayerID string) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) AddStyleSourceJSON(sourceID string, sourceJSON string) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) ApplyCameraDelta(delta CameraDelta) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) AttachDmaBufRing(descriptor DmaBufRingDescriptor, device *VulkanDeviceHandle, ...) (session *RenderSessionHandle, ready *Future[struct{}], err error)
- func (receiver *MapHandle) AttachOffscreen(descriptor OffscreenDescriptor, options RenderSessionAttachOptions, ...) (session *RenderSessionHandle, ready *Future[struct{}], err error)
- func (receiver *MapHandle) AttachOhosSurface(descriptor OhosSurfaceDescriptor, device *VulkanDeviceHandle, ...) (session *RenderSessionHandle, ready *Future[struct{}], err error)
- func (receiver *MapHandle) AttachOpenGLBorrowedTexture(descriptor OpenGLBorrowedTextureDescriptor, options RenderSessionAttachOptions) (session *RenderSessionHandle, ready *Future[struct{}], err error)
- func (receiver *MapHandle) AttachOpenGLSurface(descriptor OpenGLSurfaceDescriptor, options RenderSessionAttachOptions) (session *RenderSessionHandle, ready *Future[struct{}], err error)
- func (receiver *MapHandle) AttachVulkanBorrowedTexture(descriptor VulkanBorrowedTextureDescriptor, options RenderSessionAttachOptions) (session *RenderSessionHandle, ready *Future[struct{}], err error)
- func (receiver *MapHandle) AttachVulkanSurface(descriptor VulkanSurfaceDescriptor, options RenderSessionAttachOptions) (session *RenderSessionHandle, ready *Future[struct{}], err error)
- func (receiver *MapHandle) AttachWaylandSurface(descriptor WaylandSurfaceDescriptor, device *VulkanDeviceHandle, ...) (session *RenderSessionHandle, ready *Future[struct{}], err error)
- func (receiver *MapHandle) BeginCommandGroup() (*Future[CommandCompletion], error)
- func (receiver *MapHandle) CameraForGeometry(geometry string, fitOptions *CameraFitOptions) (*Future[CameraOptions], error)
- func (receiver *MapHandle) CameraForLatLngBounds(bounds LatLngBounds, fitOptions *CameraFitOptions) (*Future[CameraOptions], error)
- func (receiver *MapHandle) CameraForLatLngs(coordinates []LatLng, fitOptions *CameraFitOptions) (*Future[CameraOptions], error)
- func (receiver *MapHandle) CancelCameraTransitions() (*Future[CommandCompletion], error)
- func (receiver *MapHandle) CancelCameraTransitionsWithID(transitionID uint64) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) Discarding() MapHandleDiscarding
- func (receiver *MapHandle) Dispose() error
- func (receiver *MapHandle) DumpDebugLogs() (*Future[CommandCompletion], error)
- func (receiver *MapHandle) EndCommandGroup() (*Future[CommandCompletion], error)
- func (receiver *MapHandle) FitCameraToGeometry(geometry string, update CameraFitUpdate) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) FitCameraToLatLngBounds(bounds LatLngBounds, update CameraFitUpdate) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) FitCameraToLatLngs(coordinates []LatLng, update CameraFitUpdate) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) GetCamera() (*Future[CameraQueryResult], error)
- func (receiver *MapHandle) GetFeatureState(selector FeatureStateSelector) (*Future[string], error)
- func (receiver *MapHandle) GetGlobalState() (*Future[string], error)
- func (receiver *MapHandle) GetImageSourceCoordinates(sourceID string) (*Future[[]LatLng], error)
- func (receiver *MapHandle) GetLoadedStyleJSON() (*Future[string], error)
- func (receiver *MapHandle) GetStyleImage(imageID string) (*Future[*StyleImageInfo], error)
- func (receiver *MapHandle) GetStyleLayer(layerID string) (*Future[*StyleLayerInfo], error)
- func (receiver *MapHandle) GetStyleLayerJSON(layerID string) (*Future[string], error)
- func (receiver *MapHandle) GetStyleLayerProperty(layerID string, propertyName string) (*Future[string], error)
- func (receiver *MapHandle) GetStyleLightProperty(propertyName string) (*Future[string], error)
- func (receiver *MapHandle) GetStyleSource(sourceID string) (*Future[*StyleSourceInfo], error)
- func (receiver *MapHandle) GetStyleTransitionOptions() (*Future[StyleTransitionOptions], error)
- func (receiver *MapHandle) GetStyleURL() (*Future[string], error)
- func (handle *MapHandle) ID() uint64
- func (receiver *MapHandle) InvalidateCustomGeometrySourceRegion(sourceID string, bounds LatLngBounds) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) InvalidateCustomGeometrySourceTile(sourceID string, tileID CanonicalTileID) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) InvalidateCustomVectorSourceRegion(sourceID string, bounds LatLngBounds) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) InvalidateCustomVectorSourceTile(sourceID string, tileID CanonicalTileID) (*Future[CommandCompletion], error)
- func (handle *MapHandle) IsClosed() bool
- func (receiver *MapHandle) LatLngBoundsForCamera(camera CameraOptions) (*Future[LatLngBounds], error)
- func (receiver *MapHandle) ListStyleLayers() (*Future[[]StyleLayerInfo], error)
- func (receiver *MapHandle) ListStyleSources() (*Future[[]StyleSourceInfo], error)
- func (receiver *MapHandle) MoveStyleLayer(layerID string, beforeLayerID string) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) Release() (*Future[struct{}], error)
- func (receiver *MapHandle) RemoveFeatureState(selector FeatureStateSelector) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) RemoveStyleImage(imageID string) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) RemoveStyleLayer(layerID string) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) RemoveStyleSource(sourceID string) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) RequestRepaint() (*Future[CommandCompletion], error)
- func (receiver *MapHandle) RequestStillImage() (*Future[struct{}], error)
- func (receiver *MapHandle) Resize(logicalSize LogicalSize) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) SetBounds(options BoundOptions) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) SetCustomGeometrySourceTileData(sourceID string, tileID CanonicalTileID, data string) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) SetCustomGeometrySourceTileError(sourceID string, tileID CanonicalTileID, message string) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) SetCustomVectorSourceTileData(sourceID string, tileID CanonicalTileID, encoding StyleVectorTileEncoding, ...) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) SetCustomVectorSourceTileError(sourceID string, tileID CanonicalTileID, message string) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) SetDebugFlags(flags MapDebugFlag) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) SetEventMask(mask RuntimeEventFlag) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) SetFeatureState(selector FeatureStateSelector, state string) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) SetFreeCameraOptions(options FreeCameraOptions) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) SetGeoJSONSourceData(sourceID string, data string) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) SetGeoJSONSourceSynchronousTiling(sourceID string, enabled bool) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) SetGeoJSONSourceURL(sourceID string, url string) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) SetGlobalStateProperty(propertyName string, value string) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) SetImageSourceCoordinates(sourceID string, coordinates []LatLng) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) SetImageSourceImage(sourceID string, image PremultipliedRgba8Image) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) SetImageSourceURL(sourceID string, url string) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) SetProjectionMode(options ProjectionModeOptions) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) SetRenderingStatsViewEnabled(enabled bool) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) SetStyleImage(imageID string, image PremultipliedRgba8Image, options *StyleImageOptions) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) SetStyleJSON(json string) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) SetStyleLayerProperty(layerID string, propertyName string, value string) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) SetStyleLightJSON(lightJSON string) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) SetStyleLightProperty(propertyName string, value string) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) SetStyleSourceVolatile(sourceID string, isVolatile bool) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) SetStyleTransitionOptions(options StyleTransitionOptions) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) SetStyleURL(url string) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) SetTileOptions(options MapTileOptions) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) SetViewportOptions(options MapViewportOptions) (*Future[CommandCompletion], error)
- func (receiver *MapHandle) Snapshot() (MapSnapshot, error)
- func (handle *MapHandle) String() string
- func (receiver *MapHandle) UpdateCamera(update CameraUpdate) (*Future[CommandCompletion], error)
-
type MapHandleDiscarding
- func (view MapHandleDiscarding) AddCustomGeometrySource(sourceID string, options CustomGeometrySourceOptions) error
- func (view MapHandleDiscarding) AddCustomVectorSource(sourceID string, options CustomVectorSourceOptions) error
- func (view MapHandleDiscarding) AddGeoJSONSource(sourceID string, options *GeoJSONSourceOptions, attribution string) error
- func (view MapHandleDiscarding) AddImageSourceImage(sourceID string, coordinates []LatLng, image PremultipliedRgba8Image) error
- func (view MapHandleDiscarding) AddStyleLayerJSON(layerJSON string, beforeLayerID string) error
- func (view MapHandleDiscarding) AddStyleSourceJSON(sourceID string, sourceJSON string) error
- func (view MapHandleDiscarding) ApplyCameraDelta(delta CameraDelta) error
- func (view MapHandleDiscarding) BeginCommandGroup() error
- func (view MapHandleDiscarding) CancelCameraTransitions() error
- func (view MapHandleDiscarding) CancelCameraTransitionsWithID(transitionID uint64) error
- func (view MapHandleDiscarding) DumpDebugLogs() error
- func (view MapHandleDiscarding) EndCommandGroup() error
- func (view MapHandleDiscarding) FitCameraToGeometry(geometry string, update CameraFitUpdate) error
- func (view MapHandleDiscarding) FitCameraToLatLngBounds(bounds LatLngBounds, update CameraFitUpdate) error
- func (view MapHandleDiscarding) FitCameraToLatLngs(coordinates []LatLng, update CameraFitUpdate) error
- func (view MapHandleDiscarding) InvalidateCustomGeometrySourceRegion(sourceID string, bounds LatLngBounds) error
- func (view MapHandleDiscarding) InvalidateCustomGeometrySourceTile(sourceID string, tileID CanonicalTileID) error
- func (view MapHandleDiscarding) InvalidateCustomVectorSourceRegion(sourceID string, bounds LatLngBounds) error
- func (view MapHandleDiscarding) InvalidateCustomVectorSourceTile(sourceID string, tileID CanonicalTileID) error
- func (view MapHandleDiscarding) MoveStyleLayer(layerID string, beforeLayerID string) error
- func (view MapHandleDiscarding) RemoveFeatureState(selector FeatureStateSelector) error
- func (view MapHandleDiscarding) RemoveStyleImage(imageID string) error
- func (view MapHandleDiscarding) RemoveStyleLayer(layerID string) error
- func (view MapHandleDiscarding) RemoveStyleSource(sourceID string) error
- func (view MapHandleDiscarding) RequestRepaint() error
- func (view MapHandleDiscarding) Resize(logicalSize LogicalSize) error
- func (view MapHandleDiscarding) SetBounds(options BoundOptions) error
- func (view MapHandleDiscarding) SetCustomGeometrySourceTileData(sourceID string, tileID CanonicalTileID, data string) error
- func (view MapHandleDiscarding) SetCustomGeometrySourceTileError(sourceID string, tileID CanonicalTileID, message string) error
- func (view MapHandleDiscarding) SetCustomVectorSourceTileData(sourceID string, tileID CanonicalTileID, encoding StyleVectorTileEncoding, ...) error
- func (view MapHandleDiscarding) SetCustomVectorSourceTileError(sourceID string, tileID CanonicalTileID, message string) error
- func (view MapHandleDiscarding) SetDebugFlags(flags MapDebugFlag) error
- func (view MapHandleDiscarding) SetEventMask(mask RuntimeEventFlag) error
- func (view MapHandleDiscarding) SetFeatureState(selector FeatureStateSelector, state string) error
- func (view MapHandleDiscarding) SetFreeCameraOptions(options FreeCameraOptions) error
- func (view MapHandleDiscarding) SetGeoJSONSourceData(sourceID string, data string) error
- func (view MapHandleDiscarding) SetGeoJSONSourceSynchronousTiling(sourceID string, enabled bool) error
- func (view MapHandleDiscarding) SetGeoJSONSourceURL(sourceID string, url string) error
- func (view MapHandleDiscarding) SetGlobalStateProperty(propertyName string, value string) error
- func (view MapHandleDiscarding) SetImageSourceCoordinates(sourceID string, coordinates []LatLng) error
- func (view MapHandleDiscarding) SetImageSourceImage(sourceID string, image PremultipliedRgba8Image) error
- func (view MapHandleDiscarding) SetImageSourceURL(sourceID string, url string) error
- func (view MapHandleDiscarding) SetProjectionMode(options ProjectionModeOptions) error
- func (view MapHandleDiscarding) SetRenderingStatsViewEnabled(enabled bool) error
- func (view MapHandleDiscarding) SetStyleImage(imageID string, image PremultipliedRgba8Image, options *StyleImageOptions) error
- func (view MapHandleDiscarding) SetStyleJSON(json string) error
- func (view MapHandleDiscarding) SetStyleLayerProperty(layerID string, propertyName string, value string) error
- func (view MapHandleDiscarding) SetStyleLightJSON(lightJSON string) error
- func (view MapHandleDiscarding) SetStyleLightProperty(propertyName string, value string) error
- func (view MapHandleDiscarding) SetStyleSourceVolatile(sourceID string, isVolatile bool) error
- func (view MapHandleDiscarding) SetStyleTransitionOptions(options StyleTransitionOptions) error
- func (view MapHandleDiscarding) SetStyleURL(url string) error
- func (view MapHandleDiscarding) SetTileOptions(options MapTileOptions) error
- func (view MapHandleDiscarding) SetViewportOptions(options MapViewportOptions) error
- func (view MapHandleDiscarding) UpdateCamera(update CameraUpdate) error
- type MapLoadError
- type MapMode
- type MapOptions
- type MapProjectionCameraResult
-
type MapProjectionHandle
- func NewMapProjection(view MapView) (*MapProjectionHandle, error)
- func (receiver *MapProjectionHandle) Camera() (MapProjectionCameraResult, error)
- func (handle *MapProjectionHandle) ID() uint64
- func (handle *MapProjectionHandle) IsClosed() bool
- func (receiver *MapProjectionHandle) LatLngForPixel(point ScreenPoint) (LatLng, error)
- func (receiver *MapProjectionHandle) LatLngForPixelUnwrapped(point ScreenPoint) (LatLng, error)
- func (receiver *MapProjectionHandle) LatLngsForPixels(points []ScreenPoint) ([]LatLng, error)
- func (receiver *MapProjectionHandle) LatLngsForPixelsUnwrapped(points []ScreenPoint) ([]LatLng, error)
- func (receiver *MapProjectionHandle) MetersPerPixelAtLatitude(latitude float64) (float64, error)
- func (receiver *MapProjectionHandle) PixelForLatLng(coordinate LatLng) (ScreenPoint, error)
- func (receiver *MapProjectionHandle) PixelsForLatLngs(coordinates []LatLng) ([]ScreenPoint, error)
- func (receiver *MapProjectionHandle) Release() error
- func (receiver *MapProjectionHandle) SetCamera(camera CameraOptions) error
- func (handle *MapProjectionHandle) String() string
- type MapSnapshot
- type MapTileOptions
- type MapTileSettings
- type MapView
- type MapViewport
- type MapViewportOptions
- type MetalBorrowedTexture
- type MetalBorrowedTextureDescriptor
- type MetalBorrowedTextureReplacement
- type MetalContextDescriptor
- type MetalSurfaceDescriptor
- type MetalSurfaceReplacement
- type MetalTextureFrame
-
type MetalTextureFrameView
- func (view MetalTextureFrameView) Height() uint32
- func (view MetalTextureFrameView) PixelFormat() uint64
- func (view MetalTextureFrameView) ScaleFactor() float64
- func (view MetalTextureFrameView) Slot() uint32
- func (view MetalTextureFrameView) UnsafeDevice() (uintptr, error)
- func (view MetalTextureFrameView) UnsafeTexture() (uintptr, error)
- func (view MetalTextureFrameView) Width() uint32
- type MomentumDecay
- type MomentumDecayModel
- type MomentumSnap
- type NetworkStatus
- type NorthOrientation
- type OfflineGeometryRegionDefinition
- type OfflineRegionDefinition
- type OfflineRegionDefinitionGeometryVariant
- type OfflineRegionDefinitionTilePyramidVariant
- type OfflineRegionDownloadState
- type OfflineRegionInfo
- type OfflineRegionStatus
- type OfflineTilePyramidRegionDefinition
- type OffscreenDescriptor
- type OffscreenDeviceHandle
- type OffscreenDeviceOptions
- type OhosSurfaceDescriptor
- type OhosSurfaceReplacement
- type OpenGLBorrowedTexture
- type OpenGLBorrowedTextureDescriptor
- type OpenGLBorrowedTextureReplacement
- type OpenGLClientAPI
- type OpenGLContextDescriptor
- type OpenGLContextDescriptorData
- type OpenGLContextDescriptorDataEGLVariant
- type OpenGLContextDescriptorDataWGLVariant
- type OpenGLContextDescriptorDataWebGLVariant
- type OpenGLContextOwnership
- type OpenGLContextProviderFlag
- type OpenGLSurfaceDescriptor
- type OpenGLSurfaceReplacement
- type OpenGLTextureFrame
-
type OpenGLTextureFrameView
- func (view OpenGLTextureFrameView) Height() uint32
- func (view OpenGLTextureFrameView) ScaleFactor() float64
- func (view OpenGLTextureFrameView) Slot() uint32
- func (view OpenGLTextureFrameView) Target() uint32
- func (view OpenGLTextureFrameView) Texture() (uint32, error)
- func (view OpenGLTextureFrameView) Width() uint32
- type PanMomentum
- type PremultipliedRgba8Image
- type ProjectedMeters
- type ProjectionMode
- type ProjectionModeOptions
- type Quaternion
- type QueueLock
- type RenderAbandonDisposition
- type RenderAbandonResult
- type RenderBackendFlag
- type RenderDriverKind
- type RenderFrameResult
- type RenderMode
- type RenderResult
- type RenderSessionAttachOptions
- type RenderSessionCapabilities
- type RenderSessionCapabilityFlag
-
type RenderSessionHandle
- func (receiver *RenderSessionHandle) Abandon() (RenderAbandonResult, error)
- func (receiver *RenderSessionHandle) AcquireFrame() (*AcquiredFrameHandle, error)
- func (receiver *RenderSessionHandle) Barrier() (*Future[struct{}], error)
- func (receiver *RenderSessionHandle) Capabilities() (RenderSessionCapabilities, error)
- func (receiver *RenderSessionHandle) ClearData() (*Future[struct{}], error)
- func (receiver *RenderSessionHandle) DemandFrame(demand FrameDemand) error
- func (receiver *RenderSessionHandle) Detach() (*Future[struct{}], error)
- func (receiver *RenderSessionHandle) Discarding() RenderSessionHandleDiscarding
- func (receiver *RenderSessionHandle) Dispose() error
- func (receiver *RenderSessionHandle) DrainFrameResults() ([]RenderFrameResult, error)
- func (receiver *RenderSessionHandle) DumpDebugLogs() (*Future[struct{}], error)
- func (receiver *RenderSessionHandle) GetClusterChildren(sourceID string, clusterID uint32) (*Future[string], error)
- func (receiver *RenderSessionHandle) GetClusterExpansionZoom(sourceID string, clusterID uint32) (*Future[uint32], error)
- func (receiver *RenderSessionHandle) GetClusterLeaves(sourceID string, clusterID uint32, limit uint32, offset uint32) (*Future[string], error)
- func (receiver *RenderSessionHandle) GetFailure() (string, error)
- func (handle *RenderSessionHandle) ID() uint64
- func (handle *RenderSessionHandle) IsClosed() bool
- func (receiver *RenderSessionHandle) QueryRenderedFeatures(geometry RenderedQueryGeometry, options *RenderedFeatureQueryOptions) (*Future[[]RenderedFeature], error)
- func (receiver *RenderSessionHandle) QuerySourceFeatures(sourceID string, options *SourceFeatureQueryOptions) (*Future[[]SourceFeature], error)
- func (receiver *RenderSessionHandle) ReadTexture() (*Future[TextureReadbackResult], error)
- func (receiver *RenderSessionHandle) ReduceMemoryUse() (*Future[struct{}], error)
- func (receiver *RenderSessionHandle) Release() (*Future[struct{}], error)
- func (receiver *RenderSessionHandle) ReleaseTarget() (*Future[struct{}], error)
- func (receiver *RenderSessionHandle) Resize(logicalSize LogicalSize) (*Future[CommandCompletion], error)
- func (receiver *RenderSessionHandle) ServiceDriverWork() error
- func (receiver *RenderSessionHandle) SetFramePacer(pacer *FramePacerHandle) error
- func (receiver *RenderSessionHandle) SetOhosSurfaceTarget(replacement OhosSurfaceReplacement) (*Future[struct{}], error)
- func (receiver *RenderSessionHandle) SetOpenGLBorrowedTextureTarget(replacement OpenGLBorrowedTextureReplacement) (*Future[struct{}], error)
- func (receiver *RenderSessionHandle) SetOpenGLSurfaceTarget(replacement OpenGLSurfaceReplacement) (*Future[struct{}], error)
- func (receiver *RenderSessionHandle) SetVulkanBorrowedTextureTarget(replacement VulkanBorrowedTextureReplacement) (*Future[struct{}], error)
- func (receiver *RenderSessionHandle) SetVulkanSurfaceTarget(replacement VulkanSurfaceReplacement) (*Future[struct{}], error)
- func (receiver *RenderSessionHandle) SetWaylandSurfaceTarget(replacement WaylandSurfaceReplacement) (*Future[struct{}], error)
- func (receiver *RenderSessionHandle) Snapshot() (RenderSessionSnapshot, error)
- func (handle *RenderSessionHandle) String() string
- type RenderSessionHandleDiscarding
- type RenderSessionSnapshot
- type RenderSessionState
- type RenderedFeature
- type RenderedFeatureQueryOptions
- type RenderedQueryGeometry
- type RenderedQueryGeometryBoxVariant
- type RenderedQueryGeometryLineStringVariant
- type RenderedQueryGeometryPointVariant
- type RenderingStats
- type ResourceErrorReason
- type ResourceKind
- type ResourceKindFlag
- type ResourceLoadingMethod
- type ResourcePriority
- type ResourceProvider
- type ResourceRange
- type ResourceRequestCancelHandler
-
type ResourceRequestHandle
- func (receiver *ResourceRequestHandle) Complete(response ResourceResponse) error
- func (handle *ResourceRequestHandle) ID() uint64
- func (receiver *ResourceRequestHandle) IsCancelled() (bool, error)
- func (handle *ResourceRequestHandle) IsClosed() bool
- func (receiver *ResourceRequestHandle) PassThrough() error
- func (receiver *ResourceRequestHandle) Release() error
- func (receiver *ResourceRequestHandle) SetCancelCallback(handler ResourceRequestCancelHandler) (bool, error)
- func (handle *ResourceRequestHandle) String() string
- type ResourceRequestInfo
- type ResourceResponse
- type ResourceResponseStatus
- type ResourceRoute
- type ResourceStoragePolicy
- type ResourceTransform
- type ResourceTransformError
-
type ResourceTransformRequestHandle
- func (receiver *ResourceTransformRequestHandle) Complete(url string) error
- func (receiver *ResourceTransformRequestHandle) Fail(error ResourceTransformError) error
- func (handle *ResourceTransformRequestHandle) ID() uint64
- func (handle *ResourceTransformRequestHandle) IsClosed() bool
- func (receiver *ResourceTransformRequestHandle) Release() error
- func (handle *ResourceTransformRequestHandle) String() string
- type ResourceTransformRule
- type ResourceUsage
- type RuntimeEvent
- type RuntimeEventCameraChange
- type RuntimeEventFlag
- type RuntimeEventGlyphs
- type RuntimeEventHandler
- type RuntimeEventLoadingFailed
- type RuntimeEventOfflineRegionResponseError
- type RuntimeEventOfflineRegionStatus
- type RuntimeEventOfflineRegionTileCountLimit
- type RuntimeEventPayload
- type RuntimeEventPayloadCameraChangeVariant
- type RuntimeEventPayloadGlyphsVariant
- type RuntimeEventPayloadLoadingFailedVariant
- type RuntimeEventPayloadOfflineRegionResponseErrorVariant
- type RuntimeEventPayloadOfflineRegionStatusVariant
- type RuntimeEventPayloadOfflineRegionTileCountLimitVariant
- type RuntimeEventPayloadRenderFrameVariant
- type RuntimeEventPayloadSourceChangedVariant
- type RuntimeEventPayloadSpriteVariant
- type RuntimeEventPayloadStyleImageVariant
- type RuntimeEventPayloadTileActionVariant
- type RuntimeEventRenderFrame
- type RuntimeEventSourceChanged
- type RuntimeEventSourceType
- type RuntimeEventSprite
- type RuntimeEventStyleImage
- type RuntimeEventTileAction
- type RuntimeEventType
-
type RuntimeHandle
- func NewRuntime(options *RuntimeOptions) (*RuntimeHandle, error)
- func (receiver *RuntimeHandle) ClearEventHandler() (*Future[CommandCompletion], error)
- func (receiver *RuntimeHandle) ClearHTTPHeaderTransform() (*Future[CommandCompletion], error)
- func (receiver *RuntimeHandle) ClearResourceProvider() (*Future[CommandCompletion], error)
- func (receiver *RuntimeHandle) ClearResourceTransform() (*Future[CommandCompletion], error)
- func (receiver *RuntimeHandle) CreateMap(options MapOptions) (mapHandle *MapHandle, ready *Future[struct{}], err error)
- func (receiver *RuntimeHandle) CreateOfflineRegion(definition OfflineRegionDefinition, metadata []byte) (*Future[OfflineRegionInfo], error)
- func (receiver *RuntimeHandle) DeleteOfflineRegion(regionID int64) (*Future[struct{}], error)
- func (receiver *RuntimeHandle) Discarding() RuntimeHandleDiscarding
- func (receiver *RuntimeHandle) Dispose() error
- func (receiver *RuntimeHandle) GetOfflineRegion(regionID int64) (*Future[*OfflineRegionInfo], error)
- func (receiver *RuntimeHandle) GetOfflineRegionStatus(regionID int64) (*Future[OfflineRegionStatus], error)
- func (handle *RuntimeHandle) ID() uint64
- func (receiver *RuntimeHandle) InvalidateOfflineRegion(regionID int64) (*Future[struct{}], error)
- func (handle *RuntimeHandle) IsClosed() bool
- func (receiver *RuntimeHandle) ListOfflineRegions() (*Future[[]OfflineRegionInfo], error)
- func (receiver *RuntimeHandle) MergeOfflineRegions(sideDatabasePath string) (*Future[[]OfflineRegionInfo], error)
- func (receiver *RuntimeHandle) Release() (*Future[struct{}], error)
- func (receiver *RuntimeHandle) RunCacheDatabaseOperation(operation CacheDatabaseOperation) (*Future[struct{}], error)
- func (receiver *RuntimeHandle) SetEventHandler(handler RuntimeEventHandler) (*Future[CommandCompletion], error)
- func (receiver *RuntimeHandle) SetHTTPHeaderTransform(transform HTTPHeaderTransform) (*Future[CommandCompletion], error)
- func (receiver *RuntimeHandle) SetMaximumAmbientCacheSize(size uint64) (*Future[struct{}], error)
- func (receiver *RuntimeHandle) SetOfflineRegionDownloadState(regionID int64, state OfflineRegionDownloadState) (*Future[struct{}], error)
- func (receiver *RuntimeHandle) SetOfflineRegionObserved(regionID int64, events RuntimeEventFlag) (*Future[struct{}], error)
- func (receiver *RuntimeHandle) SetResourceProvider(provider ResourceProvider) (*Future[CommandCompletion], error)
- func (receiver *RuntimeHandle) SetResourceTransform(transform ResourceTransform) (*Future[CommandCompletion], error)
- func (handle *RuntimeHandle) String() string
- func (receiver *RuntimeHandle) UpdateOfflineRegionMetadata(regionID int64, metadata []byte) (*Future[OfflineRegionInfo], error)
-
type RuntimeHandleDiscarding
- func (view RuntimeHandleDiscarding) ClearEventHandler() error
- func (view RuntimeHandleDiscarding) ClearHTTPHeaderTransform() error
- func (view RuntimeHandleDiscarding) ClearResourceProvider() error
- func (view RuntimeHandleDiscarding) ClearResourceTransform() error
- func (view RuntimeHandleDiscarding) SetEventHandler(handler RuntimeEventHandler) error
- func (view RuntimeHandleDiscarding) SetHTTPHeaderTransform(transform HTTPHeaderTransform) error
- func (view RuntimeHandleDiscarding) SetResourceProvider(provider ResourceProvider) error
- func (view RuntimeHandleDiscarding) SetResourceTransform(transform ResourceTransform) error
- type RuntimeOptions
- type ScreenBox
- type ScreenLineString
- type ScreenPoint
- type SourceFeature
- type SourceFeatureQueryOptions
- type Status
-
type StyleExpressionHandle
- func NewStyleExpression(expression string, options *StyleExpressionOptions) (*StyleExpressionHandle, error)
- func (receiver *StyleExpressionHandle) Evaluate(inputs *StyleExpressionInputs) (string, error)
- func (handle *StyleExpressionHandle) ID() uint64
- func (receiver *StyleExpressionHandle) Info() (StyleExpressionInfo, error)
- func (handle *StyleExpressionHandle) IsClosed() bool
- func (receiver *StyleExpressionHandle) Release() error
- func (handle *StyleExpressionHandle) String() string
- type StyleExpressionInfo
- type StyleExpressionInputs
- type StyleExpressionOptions
- type StyleExpressionType
- type StyleExpressionTypeKind
- type StyleImageInfo
- type StyleImageOptions
- type StyleImageTextFit
- type StyleLayerInfo
- type StyleLayerVisibility
- type StyleRasterDemEncoding
- type StyleSourceInfo
- type StyleSourceTileInfo
- type StyleSourceType
- type StyleTileScheme
- type StyleTransitionOptions
- type StyleVectorTileEncoding
- type TextureImageInfo
- type TextureReadbackResult
- type TileID
- type TileLodMode
- type TileOperation
- type URLMatchFlag
- type URLQueryParameter
- type UnitBezier
- type UnknownVariant
- type Vec3
- type ViewportMode
- type VulkanBorrowedTexture
- type VulkanBorrowedTextureDescriptor
- type VulkanBorrowedTextureReplacement
- type VulkanContextDescriptor
- type VulkanDeviceContextResult
-
type VulkanDeviceHandle
- func NewVulkanDevice(options *VulkanDeviceOptions) (*VulkanDeviceHandle, error)
- func (receiver *VulkanDeviceHandle) Context() (VulkanDeviceContextResult, error)
- func (handle *VulkanDeviceHandle) ID() uint64
- func (handle *VulkanDeviceHandle) IsClosed() bool
- func (receiver *VulkanDeviceHandle) Release() error
- func (handle *VulkanDeviceHandle) String() string
- type VulkanDeviceOptions
- type VulkanImageOwner
- type VulkanSurfaceDescriptor
- type VulkanSurfaceReplacement
- type VulkanTextureFrame
-
type VulkanTextureFrameView
- func (view VulkanTextureFrameView) Format() uint32
- func (view VulkanTextureFrameView) Height() uint32
- func (view VulkanTextureFrameView) Image() (uint64, error)
- func (view VulkanTextureFrameView) ImageView() (uint64, error)
- func (view VulkanTextureFrameView) Layout() uint32
- func (view VulkanTextureFrameView) ScaleFactor() float64
- func (view VulkanTextureFrameView) Slot() uint32
- func (view VulkanTextureFrameView) UnsafeDevice() (uintptr, error)
- func (view VulkanTextureFrameView) Width() uint32
- type WGLContextDescriptor
- type Wake
- type WaylandSurfaceDescriptor
- type WaylandSurfaceReplacement
- type WebGLContextDescriptor
- type WebGLContextKind
- type Win32WindowDescriptor
- type Win32WindowReplacement
Constants
const ( // DiagnosticMessageCapacity corresponds to MLN_DIAGNOSTIC_MESSAGE_CAPACITY. The // size of a diagnostic message in bytes, with its terminator. // // See MLN_DIAGNOSTIC_MESSAGE_CAPACITY in the C API reference: // https://maplibre.org/maplibre-native-ffi/reference/c/base_8h.html DiagnosticMessageCapacity uint32 = 4096 // FrameDemandTokenStillImage corresponds to MLN_FRAME_DEMAND_TOKEN_STILL_IMAGE. // The token of the frame results that a session adds when it renders an image // for MapHandle.RequestStillImage(). Your own demands can't use it. // // See MLN_FRAME_DEMAND_TOKEN_STILL_IMAGE in the C API reference: // https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html FrameDemandTokenStillImage uint64 = 18446744073709551615 // TextureRingMaxDepth corresponds to MLN_TEXTURE_RING_MAX_DEPTH. The most // textures that a render session's texture ring can have. // // See MLN_TEXTURE_RING_MAX_DEPTH in the C API reference: // https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html TextureRingMaxDepth uint32 = 8 // VulkanNonDispatchableHandleNull corresponds to // MLN_VULKAN_NON_DISPATCHABLE_HANDLE_NULL. The null Vulkan non-dispatchable // handle. // // See MLN_VULKAN_NON_DISPATCHABLE_HANDLE_NULL in the C API reference: // https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html VulkanNonDispatchableHandleNull uint64 = 0 )
Functions
func CVersion
func CVersion() uint32
CVersion returns the API epoch of the library.
Headers and a library with different epochs aren't compatible.
See mln_c_version in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/base_8h.html
func ClearLogCallback
func ClearLogCallback() error
ClearLogCallback sends log messages to the platform's log again, instead of a callback.
See mln_log_clear_callback in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/logging_8h.html
func GetPluginRegisterFunctionV1
func GetPluginRegisterFunctionV1() uintptr
GetPluginRegisterFunctionV1 returns the function that registers a plugin's style layer types.
Pass the function to the plugin's registration entry point before loading a style that uses the plugin's layer types. Plugin callbacks run on library threads and can keep running while the process exits, so they must not use state that the process destroys at exit.
See mln_plugin_get_register_function_v1 in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/plugin_8h.html
func LogicalExtentPhysicalSize
func LogicalExtentPhysicalSize(extent LogicalExtent) (width uint32, height uint32, err error)
LogicalExtentPhysicalSize computes the size in pixels of a target with a logical size and scale factor.
See mln_logical_extent_physical_size in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html
func SetLogAsyncSeverityMask
func SetLogAsyncSeverityMask(mask LogSeverityFlag) error
SetLogAsyncSeverityMask selects the severities that the library logs on a background thread.
The library logs other severities on the thread that logged them. mask applies to every runtime in the process.
See mln_log_set_async_severity_mask in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/logging_8h.html
func SetLogCallback
func SetLogCallback(handler LogHandler) error
SetLogCallback sends the log messages of every runtime in the process to a callback.
The callback replaces the one set before.
Runs on the thread that logged the message, or on a background thread for the severities that SetLogAsyncSeverityMask() selects. The callback can't call the library.
See mln_log_set_callback in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/logging_8h.html
func SetNetworkStatus
func SetNetworkStatus(status NetworkStatus) error
SetNetworkStatus tells the library whether it may use the network.
While the status is NetworkStatusOffline, the library starts no network requests. The requests that wait start when the status returns to NetworkStatusOnline. The status starts as online and applies to every runtime in the process.
See mln_network_set_status in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
Types
type AbiVersionMismatchError
type AbiVersionMismatchError struct { Expected uint32 Actual uint32 }
AbiVersionMismatchError identifies the incompatible native and binding versions.
func (*AbiVersionMismatchError) Error
func (e *AbiVersionMismatchError) Error() string
func (*AbiVersionMismatchError) Unwrap
func (e *AbiVersionMismatchError) Unwrap() error
type AcquiredFrameHandle
type AcquiredFrameHandle struct { // contains filtered or unexported fields }
AcquiredFrameHandle corresponds to mln_acquired_frame. A rendered frame that the caller holds to read or show.
See mln_acquired_frame in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/base_8h.html
func (*AcquiredFrameHandle) Discard
func (receiver *AcquiredFrameHandle) Discard() error
Discard gives up an acquired frame without saying when your GPU stops reading it.
Because your GPU may still read the frame's texture, the session never renders into that texture again.
See mln_acquired_frame_discard in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html
func (*AcquiredFrameHandle) ID
func (handle *AcquiredFrameHandle) ID() uint64
ID returns the native handle value. It stays readable after the handle is released.
func (*AcquiredFrameHandle) IsClosed
func (handle *AcquiredFrameHandle) IsClosed() bool
IsClosed reports whether the binding has accepted a release, dispose, or discard of the handle. A nil handle is closed.
func (*AcquiredFrameHandle) Release
func (receiver *AcquiredFrameHandle) Release(consumerCompletion GPUSync) error
Release gives an acquired frame back to the session once you're done reading it.
consumerCompletion says when your GPU work that reads the texture finishes. Pass GPUSyncKindCPUComplete when that work has already finished. The session waits for that point before it renders into the texture again. If that wait fails, such as for an OpenGL fence outside the session's share group, the session fails.
See mln_acquired_frame_release in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html
Errors:
- StatusUnsupported when RenderSessionCapabilities.ConsumerSyncKinds lacks the kind of consumerCompletion.
func (*AcquiredFrameHandle) Result
func (receiver *AcquiredFrameHandle) Result() (RenderFrameResult, error)
Result reads the frame result of an acquired frame.
It succeeds until you release or discard the frame, whatever the session's state.
See mln_acquired_frame_get_result in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html
func (*AcquiredFrameHandle) String
func (handle *AcquiredFrameHandle) String() string
String formats the handle as AcquiredFrameHandle(id=0x<hex>, closed=<true|false>).
func (*AcquiredFrameHandle) WithDmaBuf
func (receiver *AcquiredFrameHandle) WithDmaBuf(callback func(DmaBufFrameView) error) error
WithDmaBuf gets the dmabuf of an acquired frame.
Wait for AcquiredFrameHandle.WithProducerSync() before you read the buffer. Once you release or discard the frame, the session may render into the buffer again. You can map a buffer with DRM_FORMAT_MOD_LINEAR, which has one plane, with mmap, and bracket your reads with DMA_BUF_IOCTL_SYNC.
The session owns the planes' file descriptors, so don't close them. To keep the buffer after you release the frame, duplicate each file descriptor with dup. A duplicate keeps the buffer's memory, but not its contents.
See mln_acquired_frame_get_dma_buf in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/linux_8h.html
Errors:
- StatusTargetLost when the session failed, or you detached, abandoned, or disposed it.
func (*AcquiredFrameHandle) WithOpenGLTexture
func (receiver *AcquiredFrameHandle) WithOpenGLTexture(callback func(OpenGLTextureFrameView) error) error
WithOpenGLTexture gets the OpenGL texture of an acquired frame.
See mln_acquired_frame_get_open_gl_texture in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html
Errors:
- StatusTargetLost when the session failed, or you detached, abandoned, or disposed it.
func (*AcquiredFrameHandle) WithProducerSync
func (receiver *AcquiredFrameHandle) WithProducerSync(callback func(GPUSyncView) error) error
WithProducerSync reads what to wait for before you read an acquired frame's texture.
See mln_acquired_frame_get_producer_sync in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html
Errors:
- StatusTargetLost when the session failed, or you detached, abandoned, or disposed it.
func (*AcquiredFrameHandle) WithVulkanTexture
func (receiver *AcquiredFrameHandle) WithVulkanTexture(callback func(VulkanTextureFrameView) error) error
WithVulkanTexture gets the Vulkan image of an acquired frame.
See mln_acquired_frame_get_vulkan_texture in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html
Errors:
- StatusTargetLost when the session failed, or you detached, abandoned, or disposed it.
type AnchoredMomentum
type AnchoredMomentum struct { // How fast the value changed at release: zoom levels per second for zoom, and // degrees per second for bearing and pitch. The part moves only when this is // set. Velocity *float64 // The screen point that the change keeps in place. Without one, the change // keeps the center of the view in place. Anchor *ScreenPoint Decay MomentumDecay // Where the part settles. Without this, it stays where the gesture and its // glide leave it. Snap *MomentumSnap }
AnchoredMomentum corresponds to mln_anchored_momentum. How a gesture's zoom, bearing, or pitch keeps changing after release.
See mln_anchored_momentum in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type AndroidHardwareBufferFrame
type AndroidHardwareBufferFrame struct { Width uint32 Height uint32 ScaleFactor float64 // The buffer's index in the ring. Slot uint32 // The AHardwareBuffer*. Buffer uintptr }
AndroidHardwareBufferFrame corresponds to mln_android_hardware_buffer_frame. The Android hardware buffer of an acquired frame.
See mln_android_hardware_buffer_frame in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/android_8h.html
type AndroidHardwareBufferFrameView
type AndroidHardwareBufferFrameView struct { // contains filtered or unexported fields }
func (AndroidHardwareBufferFrameView) Height
func (view AndroidHardwareBufferFrameView) Height() uint32
func (AndroidHardwareBufferFrameView) ScaleFactor
func (view AndroidHardwareBufferFrameView) ScaleFactor() float64
func (AndroidHardwareBufferFrameView) Slot
func (view AndroidHardwareBufferFrameView) Slot() uint32
func (AndroidHardwareBufferFrameView) UnsafeBuffer
func (view AndroidHardwareBufferFrameView) UnsafeBuffer() (uintptr, error)
func (AndroidHardwareBufferFrameView) Width
func (view AndroidHardwareBufferFrameView) Width() uint32
type AndroidHardwareBufferRingDescriptor
type AndroidHardwareBufferRingDescriptor struct { LogicalSize LogicalSize // How many buffers the ring has, from 1 to 8. BufferCount uint32 // More AHARDWAREBUFFER_USAGE_* bits that your reads need, such as // AHARDWAREBUFFER_USAGE_CPU_READ_OFTEN, or zero. Usage uint64 }
AndroidHardwareBufferRingDescriptor corresponds to mln_android_hardware_buffer_ring_descriptor. A ring of Android hardware buffers that the library allocates, for MapHandle.AttachAndroidHardwareBufferRing().
Each buffer has the map's size in pixels, logical_size times the map's scale factor, and the format AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM. Its usage is AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT, AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE, and the bits of usage.
See mln_android_hardware_buffer_ring_descriptor in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/android_8h.html
type AndroidSurfaceDescriptor
type AndroidSurfaceDescriptor struct { LogicalSize LogicalSize // Your ANativeWindow*, or null to name the window by surface. Window uintptr // The calling thread's JNIEnv*, with surface. JniEnv uintptr // An android.view.Surface, with jni_env. Surface uintptr }
AndroidSurfaceDescriptor corresponds to mln_android_surface_descriptor. An Android window to present to, for MapHandle.AttachAndroidSurface().
Name the window by window, or by jni_env and surface. The session takes its own reference to the window, so you can release yours once the call returns.
See mln_android_surface_descriptor in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/android_8h.html
type AndroidSurfaceReplacement
type AndroidSurfaceReplacement struct { LogicalSize LogicalSize // Your ANativeWindow*, or null to name the window by surface. Window uintptr // The calling thread's JNIEnv*, with surface. JniEnv uintptr // An android.view.Surface, with jni_env. Surface uintptr }
AndroidSurfaceReplacement corresponds to mln_android_surface_replacement. A new Android window for RenderSessionHandle.SetAndroidSurfaceTarget().
Name the window by window, or by jni_env and surface. The session takes its own reference to the window, so you can release yours once the call returns.
See mln_android_surface_replacement in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/android_8h.html
type AnimationOptions
type AnimationOptions struct { DurationMs *float64 // The average speed of a fly animation, in screens per second. duration_ms // overrides it. Velocity *float64 // The zoom level at the peak of a fly animation. MinZoom *float64 Easing *UnitBezier // An ID that MapHandle.CancelCameraTransitionsWithID() cancels the change by. // Several changes can share one. TransitionID *uint64 EndHandler CameraTransitionHandler }
AnimationOptions corresponds to mln_animation_options. How a camera change animates.
See mln_animation_options in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type BoundOptions
type BoundOptions struct { // The area that the camera's center stays within. Bounds *LatLngBounds MinZoom *float64 MaxZoom *float64 // The lowest pitch, in degrees. MinPitch *float64 // The highest pitch, in degrees. MaxPitch *float64 // Removes the area that limits the camera's center. Unbounded bool }
BoundOptions corresponds to mln_bound_options. Limits on the camera, for MapHandle.SetBounds().
See mln_bound_options in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type CacheDatabaseOperation
type CacheDatabaseOperation uint32
CacheDatabaseOperation corresponds to mln_cache_database_operation. A maintenance action on a runtime's cache database.
The cache database is the file that RuntimeOptions.CachePath names. It holds the ambient cache, meaning the resources that maps loaded, and the offline regions.
See mln_cache_database_operation in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
const ( // Deletes the ambient cache's resources and frees the space they used. Offline // regions keep their resources. CacheDatabaseOperationClear CacheDatabaseOperation = CacheDatabaseOperation(C.MLN_CACHE_DATABASE_OPERATION_CLEAR) // Keeps the ambient cache's resources, but makes maps check each one with the // server before they use it again. Offline regions keep their resources as they // are. CacheDatabaseOperationInvalidate CacheDatabaseOperation = CacheDatabaseOperation(C.MLN_CACHE_DATABASE_OPERATION_INVALIDATE) // Compacts the whole database file to free the disk space that it no longer // uses. CacheDatabaseOperationPack CacheDatabaseOperation = CacheDatabaseOperation(C.MLN_CACHE_DATABASE_OPERATION_PACK) // Deletes the whole database, offline regions included, and starts an empty // one. CacheDatabaseOperationReset CacheDatabaseOperation = CacheDatabaseOperation(C.MLN_CACHE_DATABASE_OPERATION_RESET) )
func (CacheDatabaseOperation) String
func (value CacheDatabaseOperation) String() string
type Camera
type Camera struct { Center LatLng // The altitude of the center, in meters above sea level. CenterAltitude float64 // Insets from the map's edges. The camera centers within the rest. Padding EdgeInsets Zoom float64 // The rotation from north, in degrees. Bearing float64 // The tilt toward the horizon, in degrees. 0 looks straight down. Pitch float64 // The roll, in degrees. Roll float64 // The vertical field of view, in degrees. FieldOfView float64 }
Camera corresponds to mln_camera. A map's whole camera.
See mln_camera in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
func (Camera) ToOptions
func (value Camera) ToOptions() CameraOptions
ToOptions converts this Camera to CameraOptions that set each of its members.
type CameraBounds
type CameraBounds struct { // The area that the camera's center stays within. When unbounded is true, it // covers the whole world. Bounds LatLngBounds // Whether no area limits the camera's center. Unbounded bool MinZoom float64 MaxZoom float64 // The lowest pitch, in degrees. MinPitch float64 // The highest pitch, in degrees. MaxPitch float64 }
CameraBounds corresponds to mln_camera_bounds. All the limits on a map's camera.
Its members mean the same as those of BoundOptions.
See mln_camera_bounds in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type CameraChangeMode
type CameraChangeMode uint32
CameraChangeMode corresponds to mln_camera_change_mode. Whether a camera change jumps or animates.
See mln_camera_change_mode in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
const ( CameraChangeModeImmediate CameraChangeMode = CameraChangeMode(C.MLN_CAMERA_CHANGE_MODE_IMMEDIATE) CameraChangeModeAnimated CameraChangeMode = CameraChangeMode(C.MLN_CAMERA_CHANGE_MODE_ANIMATED) )
func (CameraChangeMode) String
func (value CameraChangeMode) String() string
type CameraChangeSource
type CameraChangeSource uint32
CameraChangeSource corresponds to mln_camera_change_source. What moved the camera.
See mln_camera_change_source in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
const ( // A camera command outside a gesture, or the map itself, as when a resize keeps // the camera within its bounds. CameraChangeSourceCommand CameraChangeSource = CameraChangeSource(C.MLN_CAMERA_CHANGE_SOURCE_COMMAND) // A camera command with a gesture phase. CameraChangeSourceGesture CameraChangeSource = CameraChangeSource(C.MLN_CAMERA_CHANGE_SOURCE_GESTURE) // The momentum and bearing snap that a gesture's end started. CameraChangeSourceMomentum CameraChangeSource = CameraChangeSource(C.MLN_CAMERA_CHANGE_SOURCE_MOMENTUM) )
func (CameraChangeSource) String
func (value CameraChangeSource) String() string
type CameraDelta
type CameraDelta struct { // Moves the map's content this far on the screen, as a drag does. Offset *ScreenPoint // Multiplies the map's scale. 2 zooms in by one level. Scale *float64 // Degrees to add to the bearing. Bearing *float64 // Degrees to add to the pitch. Pitch *float64 // The screen point that scale, bearing, and pitch keep in place. It needs one // of them, and it combines with offset only in a delta without a duration. Anchor *ScreenPoint // How the gesture keeps moving after this delta. Only a delta in the // GesturePhaseEnd phase carries it. Momentum *GestureMomentum Animation AnimationOptions GesturePhase GesturePhase }
CameraDelta corresponds to mln_camera_delta. A change to the camera from where it is now, for gestures.
See mln_camera_delta in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type CameraFitOptions
type CameraFitOptions struct { // Space to leave between the area and each edge of the map. The left and right // insets must add up to less than the map's width, and the top and bottom to // less than its height. Padding *EdgeInsets // The rotation from north, in degrees. Bearing *float64 // The tilt toward the horizon, in degrees. Pitch *float64 }
CameraFitOptions corresponds to mln_camera_fit_options. Options for finding the camera that fits an area.
See mln_camera_fit_options in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type CameraFitUpdate
type CameraFitUpdate struct { Mode CameraUpdateMode Fit CameraFitOptions Animation AnimationOptions }
CameraFitUpdate corresponds to mln_camera_fit_update. A camera change that fits an area, for MapHandle.FitCameraToLatLngBounds() and the other fit commands.
A jump uses only the end handler of animation, as in CameraUpdate.
See mln_camera_fit_update in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type CameraOptions
type CameraOptions struct { Center *LatLng // The altitude of the center, in meters above sea level. CenterAltitude *float64 // Insets from the map's edges. The camera centers within the rest. Padding *EdgeInsets // The screen point that a change to the zoom, bearing, or pitch keeps in place. // A center overrides it. Anchor *ScreenPoint Zoom *float64 // The rotation from north, in degrees. Bearing *float64 // The tilt toward the horizon, in degrees. 0 looks straight down. Pitch *float64 // The roll, in degrees. Roll *float64 // The vertical field of view, in degrees. FieldOfView *float64 }
CameraOptions corresponds to mln_camera_options. A camera, with only the members that fields selects.
See mln_camera_options in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
func CameraForTile
func CameraForTile(tile CanonicalTileID, logicalSize LogicalSize) (CameraOptions, error)
CameraForTile computes the camera that shows exactly one tile on a square map.
Jump a map in MapModeTile to the camera to render tile, where logicalSize is the map's size. The camera centers the tile, zooms until the tile fills the map, and looks straight down with north up and no padding. The map keeps its camera within its zoom limits, so for a deep tile, raise the maximum zoom past the camera's with MapHandle.SetBounds().
See mln_camera_for_tile in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html
Errors:
- StatusInvalidArgument when logicalSize isn't square, or is wider than 512 pixels. For denser tiles, raise the map's scale factor instead.
- StatusInvalidArgument when tile.x or tile.y isn't less than 2 to the power tile.z, or when the tile can't fill the map at a zoom from 0 to 25.5, as for tile 0/0/0 on a 256-pixel map.
type CameraQueryResult
type CameraQueryResult struct { Generation uint64 Camera Camera }
CameraQueryResult corresponds to mln_camera_query_result. A map's camera, with the snapshot generation that it matches.
See mln_camera_query_result in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type CameraTransitionEnd
type CameraTransitionEnd struct { Outcome CameraTransitionOutcome // The generation of the first map snapshot that shows where the change left the // camera, or 0 when the map closed first. Generation uint64 // How fast a gesture's momentum still moved when it was cancelled, which the // next gesture can add to its own release velocities. Zero for every other end. Velocity CameraVelocity }
CameraTransitionEnd corresponds to mln_camera_transition_end. The end of a camera change.
See mln_camera_transition_end in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type CameraTransitionHandler
type CameraTransitionHandler struct{ Callback func(end CameraTransitionEnd) }
CameraTransitionHandler corresponds to mln_camera_transition_handler. A callback for the end of a camera change, for AnimationOptions.
The callback runs once for each camera command, after every part of the change that the command started has ended.
See mln_camera_transition_handler in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type CameraTransitionOutcome
type CameraTransitionOutcome uint32
CameraTransitionOutcome corresponds to mln_camera_transition_outcome. How a camera change ended.
A change that ends in more than one way reports CameraTransitionOutcomeCancelled if any of it was cancelled, and otherwise CameraTransitionOutcomeReplaced if any of it was replaced.
See mln_camera_transition_outcome in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
const ( // The camera finished the change. CameraTransitionOutcomeCompleted CameraTransitionOutcome = CameraTransitionOutcome(C.MLN_CAMERA_TRANSITION_OUTCOME_COMPLETED) // MapHandle.CancelCameraTransitions(), // MapHandle.CancelCameraTransitionsWithID(), a gesture's GesturePhaseBegin or // GesturePhaseCancel, MapHandle.SetFreeCameraOptions(), or a resize that moved // the camera back inside its bounds stopped the change. A command that fails // before it moves the camera also reports this. CameraTransitionOutcomeCancelled CameraTransitionOutcome = CameraTransitionOutcome(C.MLN_CAMERA_TRANSITION_OUTCOME_CANCELLED) // The map closed before the change ended. CameraTransitionOutcomeClosed CameraTransitionOutcome = CameraTransitionOutcome(C.MLN_CAMERA_TRANSITION_OUTCOME_CLOSED) // A later camera change set every field that a part of the change was still // animating, so that part stopped. Its other parts keep animating, and the // change reports this outcome when they end, unless one was cancelled. // // A later change that sets only some of those fields leaves the change // animating the rest. A fly's center and zoom count as one field, and so do an // anchored change's center and the fields that the anchor holds in place. CameraTransitionOutcomeReplaced CameraTransitionOutcome = CameraTransitionOutcome(C.MLN_CAMERA_TRANSITION_OUTCOME_REPLACED) )
func (CameraTransitionOutcome) String
func (value CameraTransitionOutcome) String() string
type CameraUpdate
type CameraUpdate struct { Mode CameraUpdateMode Camera CameraOptions Animation AnimationOptions GesturePhase GesturePhase }
CameraUpdate corresponds to mln_camera_update. A camera change for MapHandle.UpdateCamera().
A jump uses only the end handler of animation, and the handler runs as soon as the camera moves.
See mln_camera_update in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type CameraUpdateMode
type CameraUpdateMode uint32
CameraUpdateMode corresponds to mln_camera_update_mode. How a camera command moves the camera.
See mln_camera_update_mode in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
const ( // Moves the camera at once. CameraUpdateModeJump CameraUpdateMode = CameraUpdateMode(C.MLN_CAMERA_UPDATE_MODE_JUMP) // Animates the camera straight to the target. CameraUpdateModeEase CameraUpdateMode = CameraUpdateMode(C.MLN_CAMERA_UPDATE_MODE_EASE) // Zooms out, travels to the target, and zooms back in. CameraUpdateModeFly CameraUpdateMode = CameraUpdateMode(C.MLN_CAMERA_UPDATE_MODE_FLY) )
func (CameraUpdateMode) String
func (value CameraUpdateMode) String() string
type CameraVelocity
type CameraVelocity struct { // How fast the map's content moves on the screen, in logical pixels per second. Pan ScreenPoint // In zoom levels per second. Zoom float64 // In degrees per second. Bearing float64 // In degrees per second. Pitch float64 }
CameraVelocity corresponds to mln_camera_velocity. How fast each part of a camera change moves.
See mln_camera_velocity in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type CanonicalTileID
type CanonicalTileID struct { Z uint32 X uint32 Y uint32 }
CanonicalTileID corresponds to mln_canonical_tile_id. A tile's zoom level z, column x, and row y, with row 0 at the north.
See mln_canonical_tile_id in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
type CommandCompletion
type CommandCompletion struct { Generation uint64 // RenderUpdateGeneration is the first render update that includes the // command; compare it with RenderFrameResult.MapUpdateGeneration. RenderUpdateGeneration uint64 }
CommandCompletion holds the generations that a committed map command published. A command's Await returns an *Error instead when the command fails or is cancelled.
type ConstrainMode
type ConstrainMode uint32
ConstrainMode corresponds to mln_constrain_mode. How the map keeps the camera within the world or within its bounds.
See mln_constrain_mode in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
const ( ConstrainModeNone ConstrainMode = ConstrainMode(C.MLN_CONSTRAIN_MODE_NONE) // Keeps the world filling the view from top to bottom. ConstrainModeHeightOnly ConstrainMode = ConstrainMode(C.MLN_CONSTRAIN_MODE_HEIGHT_ONLY) // Keeps the world filling the view in both directions. ConstrainModeWidthAndHeight ConstrainMode = ConstrainMode(C.MLN_CONSTRAIN_MODE_WIDTH_AND_HEIGHT) // Keeps the whole view inside the bounds from MapHandle.SetBounds(). ConstrainModeScreen ConstrainMode = ConstrainMode(C.MLN_CONSTRAIN_MODE_SCREEN) )
func (ConstrainMode) String
func (value ConstrainMode) String() string
type CustomGeometrySourceOptions
type CustomGeometrySourceOptions struct { MinZoom *float64 MaxZoom *float64 // How far, in pixels, simplified geometry can stray from the original. Tolerance *float64 // The width of a tile in pixels, a power of two no larger than 8192. TileSize *uint32 // The width in pixels of the margin around a tile that holds geometry from // beyond its edges. buffer times 8192 / tile_size must be at most 65535. Buffer *uint32 // Whether to cut geometry at the outer edge of a tile's margin. Clip *bool // Whether to wrap geometry that crosses the antimeridian. Wrap *bool FetchTile func(map_ *MapHandle, sourceID string, tileID CanonicalTileID) CancelTile func(map_ *MapHandle, sourceID string, tileID CanonicalTileID) }
CustomGeometrySourceOptions corresponds to mln_custom_geometry_source_options. The callbacks and options of a custom geometry source.
Zoom levels are whole numbers from 0 to 32.
See mln_custom_geometry_source_options in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
type CustomVectorSourceOptions
type CustomVectorSourceOptions struct { MinZoom *float64 MaxZoom *float64 FetchTile func(map_ *MapHandle, sourceID string, tileID CanonicalTileID) CancelTile func(map_ *MapHandle, sourceID string, tileID CanonicalTileID) }
CustomVectorSourceOptions corresponds to mln_custom_vector_source_options. The callbacks and options of a custom vector source.
Zoom levels are whole numbers from 0 to 32.
See mln_custom_vector_source_options in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
type DmaBufFormat
type DmaBufFormat struct { // A DRM fourcc code, such as DRM_FORMAT_ABGR8888. Fourcc uint32 // A DRM format modifier, such as DRM_FORMAT_MOD_LINEAR. Modifier uint64 }
DmaBufFormat corresponds to mln_dma_buf_format. A DRM format and modifier that you can import.
See mln_dma_buf_format in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/linux_8h.html
type DmaBufFrame
type DmaBufFrame struct { Width uint32 Height uint32 ScaleFactor float64 // The buffer's index in the ring. Slot uint32 Fourcc uint32 Modifier uint64 // The buffer's planes, in the order that its fourcc and modifier define. Import // all of them, as EGL_EXT_image_dma_buf_import_modifiers planes 0 and up, or // with one zwp_linux_buffer_params_v1.add call each. Planes []DmaBufPlane }
DmaBufFrame corresponds to mln_dma_buf_frame. The dmabuf of an acquired frame.
See mln_dma_buf_frame in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/linux_8h.html
type DmaBufFrameView
type DmaBufFrameView struct { // contains filtered or unexported fields }
func (DmaBufFrameView) Fourcc
func (view DmaBufFrameView) Fourcc() uint32
func (DmaBufFrameView) Height
func (view DmaBufFrameView) Height() uint32
func (DmaBufFrameView) Modifier
func (view DmaBufFrameView) Modifier() uint64
func (DmaBufFrameView) Planes
func (view DmaBufFrameView) Planes() ([]DmaBufPlane, error)
func (DmaBufFrameView) ScaleFactor
func (view DmaBufFrameView) ScaleFactor() float64
func (DmaBufFrameView) Slot
func (view DmaBufFrameView) Slot() uint32
func (DmaBufFrameView) Width
func (view DmaBufFrameView) Width() uint32
type DmaBufPlane
type DmaBufPlane struct { // The file descriptor of the dmabuf that holds the plane. The planes of a // buffer often share one. Fd int32 // The bytes from the start of the dmabuf to the plane's first byte. Offset uint32 // The bytes from the start of one row to the start of the next. Stride uint32 }
DmaBufPlane corresponds to mln_dma_buf_plane. Where one plane of a dmabuf keeps its data.
See mln_dma_buf_plane in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/linux_8h.html
type DmaBufRingDescriptor
type DmaBufRingDescriptor struct { LogicalSize LogicalSize // How many buffers the ring has, from 1 to 8. BufferCount uint32 // The formats and modifiers that your reader imports, most preferred first, // such as those that eglQueryDmaBufModifiersEXT() reports. Formats []DmaBufFormat }
DmaBufRingDescriptor corresponds to mln_dma_buf_ring_descriptor. A ring of dmabufs that the library allocates, for MapHandle.AttachDmaBufRing().
Each buffer has the map's size in pixels and a format and modifier from formats. The library renders only DRM_FORMAT_ABGR8888 and DRM_FORMAT_ARGB8888. A modifier can give a buffer more planes than its format has, such as a plane of compression metadata, and the library takes any such modifier that its GPU can render into and share.
See mln_dma_buf_ring_descriptor in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/linux_8h.html
type DxgiSharedTextureFrame
type DxgiSharedTextureFrame struct { uint32 uint32 float64 // The texture's index in the ring. uint32 // The texture's DXGI_FORMAT. uint32 // The texture's shared NT HANDLE. uintptr }
DxgiSharedTextureFrame corresponds to mln_dxgi_shared_texture_frame. The DXGI shared texture of an acquired frame.
See mln_dxgi_shared_texture_frame in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/win32_8h.html
type DxgiSharedTextureFrameView
type DxgiSharedTextureFrameView struct { // contains filtered or unexported fields }
func (DxgiSharedTextureFrameView) Format
func (view DxgiSharedTextureFrameView) Format() uint32
func (DxgiSharedTextureFrameView) Height
func (view DxgiSharedTextureFrameView) Height() uint32
func (DxgiSharedTextureFrameView) ScaleFactor
func (view DxgiSharedTextureFrameView) ScaleFactor() float64
func (DxgiSharedTextureFrameView) Slot
func (view DxgiSharedTextureFrameView) Slot() uint32
func (DxgiSharedTextureFrameView) UnsafeHandle
func (view DxgiSharedTextureFrameView) UnsafeHandle() (uintptr, error)
func (DxgiSharedTextureFrameView) Width
func (view DxgiSharedTextureFrameView) Width() uint32
type DxgiSharedTextureRingDescriptor
type DxgiSharedTextureRingDescriptor struct { LogicalSize // How many textures the ring has, from 1 to 8. uint32 }
DxgiSharedTextureRingDescriptor corresponds to mln_dxgi_shared_texture_ring_descriptor. A ring of DXGI shared textures that the library allocates, for MapHandle.AttachDxgiSharedTextureRing().
Each texture is a D3D11 2D texture with the map's size in pixels and the format DXGI_FORMAT_B8G8R8A8_UNORM. It binds as a shader resource and a render target, and is shared through an NT handle.
See mln_dxgi_shared_texture_ring_descriptor in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/win32_8h.html
type EGLContextDescriptor
type EGLContextDescriptor struct { // An EGLDisplay. Display uintptr // An EGLConfig. Config uintptr // Your EGLContext, for a shared context. uintptr // The API of a dedicated context. A shared context uses the API of yours. ClientAPI OpenGLClientAPI // Your eglGetProcAddress, or null to use the system's. GetProcAddress uintptr }
EGLContextDescriptor corresponds to mln_egl_context_descriptor. The EGL objects that a render session makes its OpenGL context from.
See mln_egl_context_descriptor in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html
type EdgeInsets
type EdgeInsets struct { Top float64 Left float64 Bottom float64 Right float64 }
EdgeInsets corresponds to mln_edge_insets. Distances in logical pixels from each edge of the map.
See mln_edge_insets in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type Error
type Error struct { Status Status Diagnostic string // Generation is the map snapshot generation that a failed map command // published, and zero for any other failure. Generation uint64 }
Error carries a native status and the diagnostic that native copied for it.
func (*Error) Error
func (e *Error) Error() string
func (*Error) Unwrap
func (e *Error) Unwrap() error
type FeatureID
type FeatureID interface { // contains filtered or unexported methods }
FeatureID corresponds to mln_feature_id. The ID of a feature in a source, as the source's data gives it.
The map compares feature IDs as text. A number names the same feature as the string of its shortest decimal form, so 7, 7.0, and "7" name one feature.
See mln_feature_id in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type FeatureIDDoubleValueVariant
type FeatureIDDoubleValueVariant struct{ Value float64 }
FeatureIDDoubleValueVariant corresponds to mln_feature_id_data.double_value. A finite number.
type FeatureIDIntValueVariant
type FeatureIDIntValueVariant struct{ Value int64 }
type FeatureIDStringValueVariant
type FeatureIDStringValueVariant struct{ Value string }
type FeatureIDUintValueVariant
type FeatureIDUintValueVariant struct{ Value uint64 }
type FeatureStateSelector
type FeatureStateSelector struct { SourceID string // The source layer, for a vector source. Empty for other sources. SourceLayerID string // The feature's ID. Setting or reading state needs it. Without it, // MapHandle.RemoveFeatureState() removes the state of every feature in the // source layer. FeatureID *FeatureID // The one key that MapHandle.RemoveFeatureState() removes. It needs feature_id. // Empty removes every key. StateKey string }
FeatureStateSelector corresponds to mln_feature_state_selector. The features whose state to set, read, or remove.
See mln_feature_state_selector in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type FrameDemand
type FrameDemand struct { Flags FrameDemandFlag // A value of your choice that the demand's frame result carries. Token uint64 }
FrameDemand corresponds to mln_frame_demand. A demand for one frame.
See mln_frame_demand in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html
type FrameDemandFlag
type FrameDemandFlag uint32
FrameDemandFlag corresponds to mln_frame_demand_flag. How a frame demand behaves.
Without flags, a demand draws a frame when the map changed since the last one, and otherwise finishes with RenderResultNoUpdate. A session with a surface target shows each frame that it draws.
See mln_frame_demand_flag in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html
const ( // Draws a frame even when nothing changed since the last one. It can't be // combined with FrameDemandFlagWaitForUpdate. FrameDemandFlagForce FrameDemandFlag = FrameDemandFlag(C.MLN_FRAME_DEMAND_FORCE) // When the map has nothing new to draw, waits for its next update instead of // finishing with RenderResultNoUpdate. FrameDemandFlagWaitForUpdate FrameDemandFlag = FrameDemandFlag(C.MLN_FRAME_DEMAND_WAIT_FOR_UPDATE) )
func (FrameDemandFlag) Has
func (value FrameDemandFlag) Has(flags FrameDemandFlag) bool
func (FrameDemandFlag) String
func (value FrameDemandFlag) String() string
type FramePacerHandle
type FramePacerHandle struct { // contains filtered or unexported fields }
FramePacerHandle corresponds to mln_frame_pacer. Demands render sessions' frames at a display's refreshes.
See mln_frame_pacer in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/base_8h.html
func OhosFramePacerCreate
func OhosFramePacerCreate(options *FramePacerOptions) (*FramePacerHandle, error)
OhosFramePacerCreate creates a frame pacer that follows the display through OpenHarmony's OH_NativeVSync.
You can call it on any thread. The pacer needs no event loop of yours.
See mln_ohos_frame_pacer_create in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/ohos_8h.html
Errors:
- StatusNativeError when the system can't report the display's refreshes to the process.
func (*FramePacerHandle) ID
func (handle *FramePacerHandle) ID() uint64
ID returns the native handle value. It stays readable after the handle is released.
func (*FramePacerHandle) IsClosed
func (handle *FramePacerHandle) IsClosed() bool
IsClosed reports whether the binding has accepted a release, dispose, or discard of the handle. A nil handle is closed.
func (*FramePacerHandle) Release
func (receiver *FramePacerHandle) Release() error
Release releases a frame pacer.
Render sessions that use the pacer stay paced until you release them or set another pacer.
See mln_frame_pacer_release in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html
func (*FramePacerHandle) String
func (handle *FramePacerHandle) String() string
String formats the handle as FramePacerHandle(id=0x<hex>, closed=<true|false>).
type FramePacerOptions
type FramePacerOptions struct { // The most frames per second that the pacer demands, greater than zero. The // pacer skips display refreshes to stay within it. By default, it can demand // frames at every refresh. MaximumFramesPerSecond *uint32 }
FramePacerOptions corresponds to mln_frame_pacer_options. Options for creating a frame pacer.
See mln_frame_pacer_options in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html
type FreeCamera
type FreeCamera struct { Position Vec3 Orientation Quaternion }
FreeCamera corresponds to mln_free_camera. A map camera's whole position and orientation in three dimensions.
Its members mean the same as those of FreeCameraOptions.
See mln_free_camera in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type FreeCameraOptions
type FreeCameraOptions struct { // The camera's position in Web Mercator units, where the world is 1 wide, (0, // 0) is its northwest corner, and (1, 1) is its southeast corner. z is the // altitude in the same units. Position *Vec3 // The camera's rotation from looking straight down with north at the top of the // screen. Orientation *Quaternion }
FreeCameraOptions corresponds to mln_free_camera_options. The camera's position and orientation in three dimensions.
See mln_free_camera_options in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type Future
type Future[T any] struct { // contains filtered or unexported fields }
Future is a one-shot native result. Await may be called from any goroutine.
func (*Future[T]) Await
func (future *Future[T]) Await(ctx context.Context) (T, error)
Await blocks until native completes the work or the context is cancelled. Work that fails, or a command that fails or is cancelled, returns an *Error with the native status and diagnostic. A cancelled context ends only this wait: native work continues, and a later Await still returns its result.
func (*Future[T]) Done
func (future *Future[T]) Done() <-chan struct{}
Done closes when native has delivered the terminal result.
type GPUSync
type GPUSync struct { Kind GPUSyncKind // The object to wait on, for the kinds that name one. Handle uint64 Value uint64 }
GPUSync corresponds to mln_gpu_sync. A point in GPU work that the other side waits for before using a texture.
See mln_gpu_sync in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html
type GPUSyncKind
type GPUSyncKind uint32
GPUSyncKind corresponds to mln_gpu_sync_kind. How one side waits for the other's GPU work on a shared texture.
A sync file descriptor or an OpenGL fence signals once, so when AcquiredFrameHandle.Release() succeeds, the session takes the one you pass. A Vulkan timeline semaphore, Metal shared event, or D3D12 fence counts up with each frame, so the one you pass stays yours. Keep it valid until a detach or release of the session completes.
See mln_gpu_sync_kind in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html
const ( // The work has already finished, so there is nothing to wait for. GPUSyncKindCPUComplete GPUSyncKind = GPUSyncKind(C.MLN_GPU_SYNC_CPU_COMPLETE) // handle is a GLsync in the session's share group. GPUSyncKindOpenGLFence GPUSyncKind = GPUSyncKind(C.MLN_GPU_SYNC_OPEN_GL_FENCE) // The work was submitted to the queue that both sides share, so work submitted // to that queue later runs after it. GPUSyncKindQueueOrder GPUSyncKind = GPUSyncKind(C.MLN_GPU_SYNC_QUEUE_ORDER) // handle is a VkSemaphore. Wait until it reaches value. GPUSyncKindVulkanTimelineSemaphore GPUSyncKind = GPUSyncKind(C.MLN_GPU_SYNC_VULKAN_TIMELINE_SEMAPHORE) // handle is a sync file descriptor. GPUSyncKindSyncFd GPUSyncKind = GPUSyncKind(C.MLN_GPU_SYNC_SYNC_FD) // handle is an MTLSharedEvent. Wait until it reaches value. GPUSyncKind = GPUSyncKind(C.MLN_GPU_SYNC_METAL_SHARED_EVENT) // handle is a shared Windows handle to an ID3D12Fence. Wait until it reaches // value. GPUSyncKindD3d12Fence GPUSyncKind = GPUSyncKind(C.MLN_GPU_SYNC_D3D12_FENCE) )
func (GPUSyncKind) String
func (value GPUSyncKind) String() string
type GPUSyncKindFlag
type GPUSyncKindFlag uint32
GPUSyncKindFlag corresponds to mln_gpu_sync_kind_flag. A GPU sync kind, as a bit in a set.
See mln_gpu_sync_kind_flag in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html
const ( GPUSyncKindFlagCPUComplete GPUSyncKindFlag = GPUSyncKindFlag(C.MLN_GPU_SYNC_KIND_FLAG_CPU_COMPLETE) GPUSyncKindFlagOpenGLFence GPUSyncKindFlag = GPUSyncKindFlag(C.MLN_GPU_SYNC_KIND_FLAG_OPEN_GL_FENCE) GPUSyncKindFlagQueueOrder GPUSyncKindFlag = GPUSyncKindFlag(C.MLN_GPU_SYNC_KIND_FLAG_QUEUE_ORDER) GPUSyncKindFlagVulkanTimelineSemaphore GPUSyncKindFlag = GPUSyncKindFlag(C.MLN_GPU_SYNC_KIND_FLAG_VULKAN_TIMELINE_SEMAPHORE) GPUSyncKindFlagSyncFd GPUSyncKindFlag = GPUSyncKindFlag(C.MLN_GPU_SYNC_KIND_FLAG_SYNC_FD) GPUSyncKindFlag = GPUSyncKindFlag(C.MLN_GPU_SYNC_KIND_FLAG_METAL_SHARED_EVENT) GPUSyncKindFlagD3d12Fence GPUSyncKindFlag = GPUSyncKindFlag(C.MLN_GPU_SYNC_KIND_FLAG_D3D12_FENCE) )
func (GPUSyncKindFlag) Has
func (value GPUSyncKindFlag) Has(flags GPUSyncKindFlag) bool
func (GPUSyncKindFlag) String
func (value GPUSyncKindFlag) String() string
type GPUSyncView
type GPUSyncView struct { // contains filtered or unexported fields }
func (GPUSyncView) Handle
func (view GPUSyncView) Handle() (uint64, error)
func (GPUSyncView) Kind
func (view GPUSyncView) Kind() GPUSyncKind
func (GPUSyncView) Value
func (view GPUSyncView) Value() uint64
type GeoJSONSourceOptions
type GeoJSONSourceOptions struct { MinZoom *float64 MaxZoom *float64 Tolerance *float64 // The last zoom level that has clusters, at most 30. ClusterMaxZoom *float64 // The clusterProperties object, or empty for none. ClusterProperties string Buffer *uint32 ClusterRadius *uint32 // At most 4294967295 on a 32-bit target. ClusterMinPoints *uint64 LineMetrics *bool Cluster *bool }
GeoJSONSourceOptions corresponds to mln_geo_json_source_options. Options for a GeoJSON [source](https://maplibre.org/maplibre-style-spec/sources/#geojson).
Zoom levels are whole numbers.
See mln_geo_json_source_options in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
type GestureMomentum
type GestureMomentum struct { Pan PanMomentum Zoom AnchoredMomentum Bearing AnchoredMomentum Pitch AnchoredMomentum }
GestureMomentum corresponds to mln_gesture_momentum. How a gesture keeps moving the camera after the user lets go.
A part moves only when its velocity is set, and each part slows on its own. Every part defaults to MomentumDecayModelFriction with a half-life of 140 ms, and these other defaults:
- Pan stops at 10 logical pixels per second, needs a release of at least 200, and counts a release faster than 10000 as 10000.
- Zoom stops at 0.01 levels per second and moves at most 2.5 levels. Its snap settles on the nearest whole level.
- Bearing stops at 1 degree per second and needs a release of at least 60. Its snap settles on north within 7 degrees.
- Pitch stops at 1 degree per second and needs a release of at least 5. Its snap settles flat within 7 degrees.
See mln_gesture_momentum in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type GesturePhase
type GesturePhase uint32
GesturePhase corresponds to mln_gesture_phase. Where a camera change falls in a gesture that the user makes.
GesturePhaseBegin and GesturePhaseUpdate mark a gesture in progress, and GesturePhaseEnd and GesturePhaseCancel end it.
See mln_gesture_phase in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
const ( // The change isn't part of a gesture. GesturePhaseNone GesturePhase = GesturePhase(C.MLN_GESTURE_PHASE_NONE) // The gesture starts. This cancels every running camera animation before the // change applies. GesturePhaseBegin GesturePhase = GesturePhase(C.MLN_GESTURE_PHASE_BEGIN) // The gesture continues. To start a gesture that keeps the running camera // animations, start it with this phase instead of GesturePhaseBegin. GesturePhaseUpdate GesturePhase = GesturePhase(C.MLN_GESTURE_PHASE_UPDATE) GesturePhaseEnd GesturePhase = GesturePhase(C.MLN_GESTURE_PHASE_END) // The platform cancelled the gesture. This also cancels every running camera // animation after the change applies. GesturePhaseCancel GesturePhase = GesturePhase(C.MLN_GESTURE_PHASE_CANCEL) )
func (GesturePhase) String
func (value GesturePhase) String() string
type HTTPHeader
type HTTPHeader struct { Name string Value string }
HTTPHeader corresponds to mln_http_header. An HTTP header.
name follows the rules of HTTPHeaderTransformResponseScope.SetHeader().
See mln_http_header in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
type HTTPHeaderRule
type HTTPHeaderRule struct { // The kinds of resource that the rule covers. Zero covers every kind. Kinds ResourceKindFlag Flags URLMatchFlag URL string Headers []HTTPHeader }
HTTPHeaderRule corresponds to mln_http_header_rule. Headers to add to the HTTP requests whose URL matches a pattern.
See mln_http_header_rule in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
type HTTPHeaderTransform
type HTTPHeaderTransform struct { // The first rule that matches a request adds its headers, and no other. Rules []HTTPHeaderRule // A failure Status or an *Error with one, or an error that wraps either, // answers native that status. Any other error, or a panic, is logged and // answers StatusNativeError. Callback func(kind ResourceKind, url string, outResponse *HTTPHeaderTransformResponseScope) error }
HTTPHeaderTransform corresponds to mln_http_header_transform. Headers to add to HTTP requests, for RuntimeHandle.SetHTTPHeaderTransform().
Set either callback or rules, not both.
Runs on a library thread.
See mln_http_header_transform in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
type HTTPHeaderTransformResponseScope
type HTTPHeaderTransformResponseScope struct { // contains filtered or unexported fields }
func (*HTTPHeaderTransformResponseScope) SetHeader
func (receiver *HTTPHeaderTransformResponseScope) SetHeader(name string, value string) error
SetHeader sets a header on the request that an HTTP header transform callback handles.
Header names ignore letter case, and setting a header again replaces its value. name can't be a header that the library or the platform manages: Accept-Encoding, Connection, Content-Length, Host, If-Modified-Since, If-None-Match, Keep-Alive, Proxy-Authorization, Proxy-Connection, Range, TE, Trailer, Transfer-Encoding, Upgrade, or User-Agent.
See mln_http_header_transform_response_set_header in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
type ImageContent
type ImageContent struct { Left float32 Top float32 Right float32 Bottom float32 }
ImageContent corresponds to mln_image_content. The area of an image, in image pixels, that text fits inside.
See mln_image_content in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
type ImageStretch
type ImageStretch struct { From float32 To float32 }
ImageStretch corresponds to mln_image_stretch. A range of image pixels, from from to to, that stretches to fit text.
See mln_image_stretch in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
type IoSurfaceFrame
type IoSurfaceFrame struct { Width uint32 Height uint32 ScaleFactor float64 // The surface's index in the ring. Slot uint32 // The IOSurfaceRef. Surface uintptr }
IoSurfaceFrame corresponds to mln_io_surface_frame. The IOSurface of an acquired frame.
See mln_io_surface_frame in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/apple_8h.html
type IoSurfaceFrameView
type IoSurfaceFrameView struct { // contains filtered or unexported fields }
func (IoSurfaceFrameView) Height
func (view IoSurfaceFrameView) Height() uint32
func (IoSurfaceFrameView) ScaleFactor
func (view IoSurfaceFrameView) ScaleFactor() float64
func (IoSurfaceFrameView) Slot
func (view IoSurfaceFrameView) Slot() uint32
func (IoSurfaceFrameView) UnsafeSurface
func (view IoSurfaceFrameView) UnsafeSurface() (uintptr, error)
func (IoSurfaceFrameView) Width
func (view IoSurfaceFrameView) Width() uint32
type IoSurfaceRingDescriptor
type IoSurfaceRingDescriptor struct { LogicalSize LogicalSize // How many surfaces the ring has, from 1 to 8. BufferCount uint32 // The MTLDevice to render with. A null device picks the system's default. Context MetalContextDescriptor }
IoSurfaceRingDescriptor corresponds to mln_io_surface_ring_descriptor. A ring of IOSurfaces that the library allocates, for MapHandle.AttachIoSurfaceRing().
Each surface has the map's size in pixels, logical_size times the map's scale factor, and the pixel format kCVPixelFormatType_32BGRA, which Metal names MTLPixelFormatBGRA8Unorm.
See mln_io_surface_ring_descriptor in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/apple_8h.html
type LatLng
type LatLng struct { Latitude float64 Longitude float64 }
LatLng corresponds to mln_lat_lng. A geographic coordinate, in degrees.
See mln_lat_lng in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
func LatLngForProjectedMeters
func LatLngForProjectedMeters(meters ProjectedMeters) (LatLng, error)
LatLngForProjectedMeters converts meters in the Web Mercator projection to a coordinate.
See mln_lat_lng_for_projected_meters in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/projection_8h.html
type LatLngBounds
type LatLngBounds struct { Southwest LatLng Northeast LatLng }
LatLngBounds corresponds to mln_lat_lng_bounds. A rectangle of coordinates, from its southwest to its northeast corner.
See mln_lat_lng_bounds in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type LogEvent
type LogEvent uint32
LogEvent corresponds to mln_log_event. The part of the library that logged a message.
See mln_log_event in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/logging_8h.html
const ( LogEventGeneral LogEvent = LogEvent(C.MLN_LOG_EVENT_GENERAL) LogEventSetup LogEvent = LogEvent(C.MLN_LOG_EVENT_SETUP) LogEventShader LogEvent = LogEvent(C.MLN_LOG_EVENT_SHADER) LogEventParseStyle LogEvent = LogEvent(C.MLN_LOG_EVENT_PARSE_STYLE) LogEventParseTile LogEvent = LogEvent(C.MLN_LOG_EVENT_PARSE_TILE) LogEventRender LogEvent = LogEvent(C.MLN_LOG_EVENT_RENDER) LogEventStyle LogEvent = LogEvent(C.MLN_LOG_EVENT_STYLE) LogEventDatabase LogEvent = LogEvent(C.MLN_LOG_EVENT_DATABASE) LogEventHTTPRequest LogEvent = LogEvent(C.MLN_LOG_EVENT_HTTP_REQUEST) LogEventSprite LogEvent = LogEvent(C.MLN_LOG_EVENT_SPRITE) LogEventImage LogEvent = LogEvent(C.MLN_LOG_EVENT_IMAGE) LogEventGraphicsBackend LogEvent = LogEvent(C.MLN_LOG_EVENT_GRAPHICS_BACKEND) LogEventJni LogEvent = LogEvent(C.MLN_LOG_EVENT_JNI) LogEventAndroid LogEvent = LogEvent(C.MLN_LOG_EVENT_ANDROID) LogEventCrash LogEvent = LogEvent(C.MLN_LOG_EVENT_CRASH) LogEventGlyph LogEvent = LogEvent(C.MLN_LOG_EVENT_GLYPH) LogEventTiming LogEvent = LogEvent(C.MLN_LOG_EVENT_TIMING) )
func (LogEvent) String
func (value LogEvent) String() string
type LogHandler
type LogHandler struct { // The severities that also go to the platform's log, as they do without a // callback. 0 sends none. A message of these severities goes to the platform's // log even when the handler's queue can't accept it. PlatformSeverities LogSeverityFlag Callback func(severity LogSeverity, event LogEvent, code int64, message string) }
LogHandler corresponds to mln_log_handler. A log callback, for SetLogCallback().
Runs on the thread that logged the message, or on a background thread for the severities that SetLogAsyncSeverityMask() selects. The callback can't call the library.
See mln_log_handler in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/logging_8h.html
type LogSeverity
type LogSeverity uint32
LogSeverity corresponds to mln_log_severity. The severity of a log message.
See mln_log_severity in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/logging_8h.html
const ( LogSeverityInfo LogSeverity = LogSeverity(C.MLN_LOG_SEVERITY_INFO) LogSeverityWarning LogSeverity = LogSeverity(C.MLN_LOG_SEVERITY_WARNING) LogSeverityError LogSeverity = LogSeverity(C.MLN_LOG_SEVERITY_ERROR) )
func (LogSeverity) String
func (value LogSeverity) String() string
type LogSeverityFlag
type LogSeverityFlag uint32
LogSeverityFlag corresponds to mln_log_severity_flag. A log severity, as a bit in a set.
See mln_log_severity_flag in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/logging_8h.html
const ( LogSeverityFlagInfo LogSeverityFlag = LogSeverityFlag(C.MLN_LOG_SEVERITY_FLAG_INFO) LogSeverityFlagWarning LogSeverityFlag = LogSeverityFlag(C.MLN_LOG_SEVERITY_FLAG_WARNING) LogSeverityFlagError LogSeverityFlag = LogSeverityFlag(C.MLN_LOG_SEVERITY_FLAG_ERROR) // The severities logged on a background thread until SetLogAsyncSeverityMask() // changes them. LogSeverityFlagDefault LogSeverityFlag = LogSeverityFlag(C.MLN_LOG_SEVERITY_FLAG_DEFAULT) LogSeverityFlagAll LogSeverityFlag = LogSeverityFlag(C.MLN_LOG_SEVERITY_FLAG_ALL) )
func (LogSeverityFlag) Has
func (value LogSeverityFlag) Has(flags LogSeverityFlag) bool
func (LogSeverityFlag) String
func (value LogSeverityFlag) String() string
type LogicalExtent
type LogicalExtent struct { Width uint32 Height uint32 ScaleFactor float64 }
LogicalExtent corresponds to mln_logical_extent. A size in logical pixels, and the physical pixels in each logical pixel.
See mln_logical_extent in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type LogicalSize
type LogicalSize struct { Width uint32 Height uint32 }
LogicalSize corresponds to mln_logical_size. A size in logical pixels, which the map's scale factor turns into pixels.
See mln_logical_size in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type MapDebugFlag
type MapDebugFlag uint32
MapDebugFlag corresponds to mln_map_debug_flag. A debug overlay that the map draws.
See mln_map_debug_flag in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
const ( MapDebugFlagTileBorders MapDebugFlag = MapDebugFlag(C.MLN_MAP_DEBUG_TILE_BORDERS) MapDebugFlagParseStatus MapDebugFlag = MapDebugFlag(C.MLN_MAP_DEBUG_PARSE_STATUS) MapDebugFlagTimestamps MapDebugFlag = MapDebugFlag(C.MLN_MAP_DEBUG_TIMESTAMPS) MapDebugFlagCollision MapDebugFlag = MapDebugFlag(C.MLN_MAP_DEBUG_COLLISION) MapDebugFlagOverdraw MapDebugFlag = MapDebugFlag(C.MLN_MAP_DEBUG_OVERDRAW) MapDebugFlagStencilClip MapDebugFlag = MapDebugFlag(C.MLN_MAP_DEBUG_STENCIL_CLIP) MapDebugFlagDepthBuffer MapDebugFlag = MapDebugFlag(C.MLN_MAP_DEBUG_DEPTH_BUFFER) )
func (MapDebugFlag) Has
func (value MapDebugFlag) Has(flags MapDebugFlag) bool
func (MapDebugFlag) String
func (value MapDebugFlag) String() string
type MapHandle
type MapHandle struct { // contains filtered or unexported fields }
MapHandle corresponds to mln_map. A map, with its style and camera.
See mln_map in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/base_8h.html
func (*MapHandle) AddCustomGeometrySource
func (receiver *MapHandle) AddCustomGeometrySource(sourceID string, options CustomGeometrySourceOptions) (*Future[CommandCompletion], error)
AddCustomGeometrySource adds a source whose GeoJSON tiles come from callbacks.
See mln_map_add_custom_geometry_source in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
Errors:
- StatusAlreadyExists when the style already has a source named sourceID.
- StatusInvalidState while the style isn't loaded, as MapHandle.SetStyleURL() describes.
func (*MapHandle) AddCustomVectorSource
func (receiver *MapHandle) AddCustomVectorSource(sourceID string, options CustomVectorSourceOptions) (*Future[CommandCompletion], error)
AddCustomVectorSource adds a source whose vector tiles come from callbacks.
See mln_map_add_custom_vector_source in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
Errors:
- StatusAlreadyExists when the style already has a source named sourceID.
- StatusInvalidState while the style isn't loaded, as MapHandle.SetStyleURL() describes.
func (*MapHandle) AddGeoJSONSource
func (receiver *MapHandle) AddGeoJSONSource(sourceID string, options *GeoJSONSourceOptions, attribution string) (*Future[CommandCompletion], error)
AddGeoJSONSource adds a GeoJSON source with no data.
Give it data with MapHandle.SetGeoJSONSourceData() or MapHandle.SetGeoJSONSourceURL(). Its options stay fixed for as long as the style holds it.
attribution is the source's [attribution](https://maplibre.org/maplibre-style-spec/sources/#attribution), or empty for none.
See mln_map_add_geo_json_source in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
Errors:
- StatusInvalidArgument when an option in options is out of range.
- StatusAlreadyExists when the style already has a source named sourceID.
- StatusInvalidState while the style isn't loaded, as MapHandle.SetStyleURL() describes.
func (*MapHandle) AddImageSourceImage
func (receiver *MapHandle) AddImageSourceImage(sourceID string, coordinates []LatLng, image PremultipliedRgba8Image) (*Future[CommandCompletion], error)
AddImageSourceImage adds an image source that shows image.
coordinates are the image's four corners, clockwise from the top left.
See mln_map_add_image_source_image in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
Errors:
- StatusAlreadyExists when the style already has a source named sourceID.
- StatusInvalidState while the style isn't loaded, as MapHandle.SetStyleURL() describes.
func (*MapHandle) AddStyleLayerJSON
func (receiver *MapHandle) AddStyleLayerJSON(layerJSON string, beforeLayerID string) (*Future[CommandCompletion], error)
AddStyleLayerJSON adds a layer to the map's style.
layerJSON is a [layer](https://maplibre.org/maplibre-style-spec/layers/) object. The layer goes below the layer named beforeLayerID, or above every layer when beforeLayerID is empty.
See mln_map_add_style_layer_json in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
Errors:
- StatusNotFound when the style has no layer named beforeLayerID, or no source with the ID that the layer uses.
- StatusAlreadyExists when the style already has a layer with the new layer's ID.
- StatusInvalidState while the style isn't loaded, as MapHandle.SetStyleURL() describes.
func (*MapHandle) AddStyleSourceJSON
func (receiver *MapHandle) AddStyleSourceJSON(sourceID string, sourceJSON string) (*Future[CommandCompletion], error)
AddStyleSourceJSON adds a source to the map's style.
sourceJSON is a [source](https://maplibre.org/maplibre-style-spec/sources/) object.
See mln_map_add_style_source_json in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
Errors:
- StatusAlreadyExists when the style already has a source named sourceID.
- StatusInvalidState while the style isn't loaded, as MapHandle.SetStyleURL() describes.
func (*MapHandle) ApplyCameraDelta
func (receiver *MapHandle) ApplyCameraDelta(delta CameraDelta) (*Future[CommandCompletion], error)
ApplyCameraDelta moves the camera relative to where it is, as a gesture does.
delta can pan the map's content by an offset on the screen, scale the zoom, and add to the bearing and pitch. An anchor keeps one screen point in place while the scale, bearing, or pitch changes. An anchor needs one of those changes, and combines with an offset only when the delta has no animation. The function finishes when the map applies the delta, before an animation ends.
A delta that replaces an animated one starts from where that animation left the camera, so the rest of the replaced change never happens. To reach an exact camera, use MapHandle.UpdateCamera().
A delta in the end phase can carry momentum, which keeps the camera moving from the gesture's release velocities and slows it on each rendered frame. The gesture lasts until the momentum ends: the snapshot keeps gesture_in_progress set, and camera events report CameraChangeSourceMomentum. With momentum, animation sets only transition_id and the end handler, which runs when the gesture ends.
A delta in the begin phase, MapHandle.CancelCameraTransitions(), or a cancellation by that ID stops the momentum. A later command that sets a field stops only the parts of the momentum that move that field. On a tilted map, the pan moves the map's content the same distance on the screen in every direction.
See mln_map_apply_camera_delta in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html
func (*MapHandle) AttachDmaBufRing
func (receiver *MapHandle) AttachDmaBufRing(descriptor DmaBufRingDescriptor, device *VulkanDeviceHandle, options RenderSessionAttachOptions) (session *RenderSessionHandle, ready *Future[struct{}], err error)
AttachDmaBufRing creates a session that renders the map into a ring of dmabufs that the library allocates.
Acquire each frame with RenderSessionHandle.AcquireFrame(), and get its buffer with AcquiredFrameHandle.WithDmaBuf(). RenderSessionHandle.Resize() gives the ring new buffers of the new size.
A Vulkan build renders with device, or, when device is null, with a device that the library creates. An OpenGL build uses an EGL context of its own, and device must be null. Attach with RenderDriverKindCoreWorker.
For a reader that waits on no sync file, such as a Wayland compositor without explicit synchronization, attach without GPUSyncKindFlagSyncFd in RenderSessionAttachOptions.ProducerSyncKinds, so that each frame finishes before you acquire it. Keep each frame acquired until its reader is done with the buffer. Give the ring 3 buffers, so the session can render while you hold two frames.
See mln_map_attach_dma_buf_ring in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/linux_8h.html
Errors:
- StatusUnsupported when the graphics context can't render into a dmabuf of any of formats.
- StatusNativeError when the library can't create its Vulkan device or initialize an EGL display.
func (*MapHandle) AttachOffscreen
func (receiver *MapHandle) AttachOffscreen(descriptor OffscreenDescriptor, options RenderSessionAttachOptions, device *OffscreenDeviceHandle) (session *RenderSessionHandle, ready *Future[struct{}], err error)
AttachOffscreen attaches a render session that renders the map offscreen.
Read each image's pixels with RenderSessionHandle.ReadTexture().
The session renders on device. When device is null, the session creates a device with the default options, and releases it when the session ends.
See mln_map_attach_offscreen in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/offscreen_8h.html
Errors:
- StatusInvalidState when the map already has a render session.
- StatusNativeError when device is null and the platform can't create a device.
func (*MapHandle) AttachOhosSurface
func (receiver *MapHandle) AttachOhosSurface(descriptor OhosSurfaceDescriptor, device *VulkanDeviceHandle, options RenderSessionAttachOptions) (session *RenderSessionHandle, ready *Future[struct{}], err error)
AttachOhosSurface creates a session that presents the map to an OpenHarmony window, with a graphics context that the library creates.
A Vulkan build presents with device, or, when device is null, with a device that the library creates. An OpenGL build uses an EGL context on the default display, and device must be null. Attach with RenderDriverKindCoreWorker.
When the platform destroys the window, such as in an XComponent's onSurfaceDestroyed callback, release the target with RenderSessionHandle.ReleaseTarget(), or give the session a new window with RenderSessionHandle.SetOhosSurfaceTarget(), without waiting for that to complete. The session keeps its own reference to the window and stays usable for the next window. A frame to the destroyed window finishes with RenderResultTargetNotReady, or with RenderResultRendered if the window went away while the frame was presenting.
See mln_map_attach_ohos_surface in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/ohos_8h.html
Errors:
- StatusInvalidArgument when no surface in this process has OhosSurfaceDescriptor.SurfaceID, such as after the platform destroyed it.
- StatusUnsupported when you created device without VulkanDeviceOptions.Presentation.
- StatusUnsupported when the GPU or the Vulkan loader can't present.
- StatusNativeError when the library can't create the graphics context or the window's surface.
func (*MapHandle) AttachOpenGLBorrowedTexture
func (receiver *MapHandle) AttachOpenGLBorrowedTexture(descriptor OpenGLBorrowedTextureDescriptor, options RenderSessionAttachOptions) (session *RenderSessionHandle, ready *Future[struct{}], err error)
AttachOpenGLBorrowedTexture creates a session that renders the map into a ring of your OpenGL textures.
See mln_map_attach_open_gl_borrowed_texture in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html
Errors:
- StatusUnsupported when OpenGLSupportedContextProviderMask() lacks the context's platform, or when the target supports none of the producer_sync_kinds in options.
func (*MapHandle) AttachOpenGLSurface
func (receiver *MapHandle) AttachOpenGLSurface(descriptor OpenGLSurfaceDescriptor, options RenderSessionAttachOptions) (session *RenderSessionHandle, ready *Future[struct{}], err error)
AttachOpenGLSurface creates a session that renders the map to an OpenGL surface.
See mln_map_attach_open_gl_surface in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/surface_8h.html
Errors:
- StatusUnsupported when OpenGLSupportedContextProviderMask() lacks the context's platform.
func (*MapHandle) AttachVulkanBorrowedTexture
func (receiver *MapHandle) AttachVulkanBorrowedTexture(descriptor VulkanBorrowedTextureDescriptor, options RenderSessionAttachOptions) (session *RenderSessionHandle, ready *Future[struct{}], err error)
AttachVulkanBorrowedTexture creates a session that renders the map into a ring of your Vulkan images.
See mln_map_attach_vulkan_borrowed_texture in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html
Errors:
- StatusUnsupported when SupportedRenderBackendMask() lacks RenderBackendFlagVulkan, or when the target supports none of the producer_sync_kinds in options.
func (*MapHandle) AttachVulkanSurface
func (receiver *MapHandle) AttachVulkanSurface(descriptor VulkanSurfaceDescriptor, options RenderSessionAttachOptions) (session *RenderSessionHandle, ready *Future[struct{}], err error)
AttachVulkanSurface creates a session that renders the map to a Vulkan surface.
See mln_map_attach_vulkan_surface in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/surface_8h.html
Errors:
- StatusUnsupported when SupportedRenderBackendMask() lacks RenderBackendFlagVulkan.
func (*MapHandle) AttachWaylandSurface
func (receiver *MapHandle) AttachWaylandSurface(descriptor WaylandSurfaceDescriptor, device *VulkanDeviceHandle, options RenderSessionAttachOptions) (session *RenderSessionHandle, ready *Future[struct{}], err error)
AttachWaylandSurface creates a session that presents the map to a Wayland surface, with a graphics context that the library creates.
A Vulkan build presents with device, or, when device is null, with a device that the library creates. An OpenGL build uses an EGL context on the display, and device must be null. Attach with RenderDriverKindCoreWorker.
The session presents without waiting for the compositor, so demand at most one frame per display refresh.
Keep the surface until a release or replacement of the target, or a detach of the session, completes. Keep the display connected until the session's detach completes. In an OpenGL build, if you also use EGL on the display, initialize it before you attach.
See mln_map_attach_wayland_surface in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/wayland_8h.html
Errors:
- StatusUnsupported when you created device without VulkanDeviceOptions.Presentation.
- StatusUnsupported when the GPU or the Vulkan loader can't present to Wayland.
- StatusNativeError when the library can't create the graphics context or present to the surface.
func (*MapHandle) BeginCommandGroup
func (receiver *MapHandle) BeginCommandGroup() (*Future[CommandCompletion], error)
BeginCommandGroup holds back the map's changes from rendering until MapHandle.EndCommandGroup(), so they show in the same frame.
Groups nest, and the changes render when the outermost group ends.
See mln_map_begin_command_group in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
func (*MapHandle) CameraForGeometry
func (receiver *MapHandle) CameraForGeometry(geometry string, fitOptions *CameraFitOptions) (*Future[CameraOptions], error)
CameraForGeometry computes a camera that fits a GeoJSON geometry in the map's view.
geometry is a GeoJSON geometry object with at least one coordinate, not a feature. The camera keeps the map's bearing and pitch unless fitOptions sets them, and its zoom stays within the map's zoom limits.
See mln_map_camera_for_geometry in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html
Errors:
- StatusInvalidArgument when the padding in fitOptions leaves no room for the area.
func (*MapHandle) CameraForLatLngBounds
func (receiver *MapHandle) CameraForLatLngBounds(bounds LatLngBounds, fitOptions *CameraFitOptions) (*Future[CameraOptions], error)
CameraForLatLngBounds computes a camera that fits bounds in the map's view.
The camera keeps the map's bearing and pitch unless fitOptions sets them, and its zoom stays within the map's zoom limits.
See mln_map_camera_for_lat_lng_bounds in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html
Errors:
- StatusInvalidArgument when the padding in fitOptions leaves no room for the area.
func (*MapHandle) CameraForLatLngs
func (receiver *MapHandle) CameraForLatLngs(coordinates []LatLng, fitOptions *CameraFitOptions) (*Future[CameraOptions], error)
CameraForLatLngs computes a camera that fits coordinates in the map's view.
coordinates must not be empty. The camera keeps the map's bearing and pitch unless fitOptions sets them, and its zoom stays within the map's zoom limits.
See mln_map_camera_for_lat_lngs in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html
Errors:
- StatusInvalidArgument when the padding in fitOptions leaves no room for the area.
func (*MapHandle) CancelCameraTransitions
func (receiver *MapHandle) CancelCameraTransitions() (*Future[CommandCompletion], error)
CancelCameraTransitions stops every running camera animation where it is.
The end handler of each stopped animation reports CameraTransitionOutcomeCancelled.
See mln_map_cancel_camera_transitions in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html
func (*MapHandle) CancelCameraTransitionsWithID
func (receiver *MapHandle) CancelCameraTransitionsWithID(transitionID uint64) (*Future[CommandCompletion], error)
CancelCameraTransitionsWithID stops the running camera animations whose animation options set transitionID.
Other animations keep running. The end handler of each stopped animation reports CameraTransitionOutcomeCancelled.
See mln_map_cancel_camera_transitions_with_id in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html
func (*MapHandle) Discarding
func (receiver *MapHandle) Discarding() MapHandleDiscarding
func (*MapHandle) Dispose
func (receiver *MapHandle) Dispose() error
Dispose releases the map in any state, and finishes in the background.
Use it from destructors and finalizers. Otherwise, use MapHandle.Release().
See mln_map_dispose in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
func (*MapHandle) DumpDebugLogs
func (receiver *MapHandle) DumpDebugLogs() (*Future[CommandCompletion], error)
DumpDebugLogs logs debugging information about the map's style and sources.
See mln_map_dump_debug_logs in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html
func (*MapHandle) EndCommandGroup
func (receiver *MapHandle) EndCommandGroup() (*Future[CommandCompletion], error)
EndCommandGroup ends the group that MapHandle.BeginCommandGroup() began.
See mln_map_end_command_group in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
func (*MapHandle) FitCameraToGeometry
func (receiver *MapHandle) FitCameraToGeometry(geometry string, update CameraFitUpdate) (*Future[CommandCompletion], error)
FitCameraToGeometry moves the camera to fit a GeoJSON geometry in the map's view, at once or with an animation.
geometry is a GeoJSON geometry object with at least one coordinate, not a feature. The camera is the one that MapHandle.CameraForGeometry() computes after the commands sent before this one apply. The function finishes when the map applies the change, before an animation ends.
See mln_map_fit_camera_to_geometry in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html
Errors:
- StatusInvalidArgument when the padding in update leaves no room for the area. The camera doesn't move.
func (*MapHandle) FitCameraToLatLngBounds
func (receiver *MapHandle) FitCameraToLatLngBounds(bounds LatLngBounds, update CameraFitUpdate) (*Future[CommandCompletion], error)
FitCameraToLatLngBounds moves the camera to fit bounds in the map's view, at once or with an animation.
The camera is the one that MapHandle.CameraForLatLngBounds() computes after the commands sent before this one apply. The function finishes when the map applies the change, before an animation ends.
See mln_map_fit_camera_to_lat_lng_bounds in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html
Errors:
- StatusInvalidArgument when the padding in update leaves no room for the area. The camera doesn't move.
func (*MapHandle) FitCameraToLatLngs
func (receiver *MapHandle) FitCameraToLatLngs(coordinates []LatLng, update CameraFitUpdate) (*Future[CommandCompletion], error)
FitCameraToLatLngs moves the camera to fit coordinates in the map's view, at once or with an animation.
coordinates must not be empty. The camera is the one that MapHandle.CameraForLatLngs() computes after the commands sent before this one apply. The function finishes when the map applies the change, before an animation ends.
See mln_map_fit_camera_to_lat_lngs in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html
Errors:
- StatusInvalidArgument when the padding in update leaves no room for the area. The camera doesn't move.
func (*MapHandle) GetCamera
func (receiver *MapHandle) GetCamera() (*Future[CameraQueryResult], error)
GetCamera reads the map's camera.
The query reads the camera after the map applies the commands sent before it.
See mln_map_get_camera in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html
func (*MapHandle) GetFeatureState
func (receiver *MapHandle) GetFeatureState(selector FeatureStateSelector) (*Future[string], error)
GetFeatureState reads the state of a feature, as a JSON object.
The object is empty when the feature has no state.
See mln_map_get_feature_state in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
func (*MapHandle) GetGlobalState
func (receiver *MapHandle) GetGlobalState() (*Future[string], error)
GetGlobalState reads the global state of the map's style as a JSON object.
See mln_map_get_global_state in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
func (*MapHandle) GetImageSourceCoordinates
func (receiver *MapHandle) GetImageSourceCoordinates(sourceID string) (*Future[[]LatLng], error)
GetImageSourceCoordinates reads the corners of an image source's image, clockwise from the top left.
See mln_map_get_image_source_coordinates in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
Errors:
- StatusNotFound when the style has no source named sourceID.
- StatusInvalidArgument when the source named sourceID isn't an image source.
func (*MapHandle) GetLoadedStyleJSON
func (receiver *MapHandle) GetLoadedStyleJSON() (*Future[string], error)
GetLoadedStyleJSON reads the JSON of the style that the map loaded.
The JSON doesn't include the changes made to the style since it loaded.
See mln_map_get_loaded_style_json in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
func (*MapHandle) GetStyleImage
func (receiver *MapHandle) GetStyleImage(imageID string) (*Future[*StyleImageInfo], error)
GetStyleImage reads an image of the map's style.
Completes with no value when the style has no image named imageID.
See mln_map_get_style_image in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
func (*MapHandle) GetStyleLayer
func (receiver *MapHandle) GetStyleLayer(layerID string) (*Future[*StyleLayerInfo], error)
GetStyleLayer reads a layer of the map's style.
Completes with no value when the style has no layer named layerID.
See mln_map_get_style_layer in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
func (*MapHandle) GetStyleLayerJSON
func (receiver *MapHandle) GetStyleLayerJSON(layerID string) (*Future[string], error)
GetStyleLayerJSON reads a layer of the map's style as a [layer](https://maplibre.org/maplibre-style-spec/layers/) object.
Completes with no value when the style has no layer named layerID.
See mln_map_get_style_layer_json in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
func (*MapHandle) GetStyleLayerProperty
func (receiver *MapHandle) GetStyleLayerProperty(layerID string, propertyName string) (*Future[string], error)
GetStyleLayerProperty reads a property of a layer in the map's style.
The value can differ in form from the value that was set: a color set as "#ff0000" reads back as ["rgba", 255, 0, 0, 1].
Completes with no value when the layer doesn't set the property.
See mln_map_get_style_layer_property in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
Errors:
- StatusNotFound when the style has no layer named layerID.
func (*MapHandle) GetStyleLightProperty
func (receiver *MapHandle) GetStyleLightProperty(propertyName string) (*Future[string], error)
GetStyleLightProperty reads a property of the light of the map's style.
The value can differ in form from the value that was set: a color set as "#ff0000" reads back as ["rgba", 255, 0, 0, 1].
Completes with no value when the light doesn't set the property.
See mln_map_get_style_light_property in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
func (*MapHandle) GetStyleSource
func (receiver *MapHandle) GetStyleSource(sourceID string) (*Future[*StyleSourceInfo], error)
GetStyleSource reads a source of the map's style.
A tile source with a url has an empty attribution until its TileJSON loads, which raises RuntimeEventTypeMapSourceChanged.
Completes with no value when the style has no source named sourceID.
See mln_map_get_style_source in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
func (*MapHandle) GetStyleTransitionOptions
func (receiver *MapHandle) GetStyleTransitionOptions() (*Future[StyleTransitionOptions], error)
GetStyleTransitionOptions reads the default transition of the map's style.
See mln_map_get_style_transition_options in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
func (*MapHandle) GetStyleURL
func (receiver *MapHandle) GetStyleURL() (*Future[string], error)
GetStyleURL reads the URL of the map's style.
The URL is empty when the style came from MapHandle.SetStyleJSON().
See mln_map_get_style_url in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
func (*MapHandle) ID
func (handle *MapHandle) ID() uint64
ID returns the native handle value, which runtime events report as their source. It stays readable after the handle is released, so events drained later still match this handle.
func (*MapHandle) InvalidateCustomGeometrySourceRegion
func (receiver *MapHandle) InvalidateCustomGeometrySourceRegion(sourceID string, bounds LatLngBounds) (*Future[CommandCompletion], error)
InvalidateCustomGeometrySourceRegion makes a custom geometry source ask again for the tiles in bounds that the map still needs.
See mln_map_invalidate_custom_geometry_source_region in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
Errors:
- StatusNotFound when the style has no source named sourceID.
- StatusInvalidArgument when the source named sourceID isn't a custom geometry source.
func (*MapHandle) InvalidateCustomGeometrySourceTile
func (receiver *MapHandle) InvalidateCustomGeometrySourceTile(sourceID string, tileID CanonicalTileID) (*Future[CommandCompletion], error)
InvalidateCustomGeometrySourceTile makes a custom geometry source ask for a tile again when the map needs it.
See mln_map_invalidate_custom_geometry_source_tile in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
Errors:
- StatusNotFound when the style has no source named sourceID.
- StatusInvalidArgument when the source named sourceID isn't a custom geometry source.
func (*MapHandle) InvalidateCustomVectorSourceRegion
func (receiver *MapHandle) InvalidateCustomVectorSourceRegion(sourceID string, bounds LatLngBounds) (*Future[CommandCompletion], error)
InvalidateCustomVectorSourceRegion makes a custom vector source ask again for the tiles in bounds that the map still needs.
See mln_map_invalidate_custom_vector_source_region in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
Errors:
- StatusNotFound when the style has no source named sourceID.
- StatusInvalidArgument when the source named sourceID isn't a custom vector source.
func (*MapHandle) InvalidateCustomVectorSourceTile
func (receiver *MapHandle) InvalidateCustomVectorSourceTile(sourceID string, tileID CanonicalTileID) (*Future[CommandCompletion], error)
InvalidateCustomVectorSourceTile makes a custom vector source ask for a tile again when the map needs it.
See mln_map_invalidate_custom_vector_source_tile in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
Errors:
- StatusNotFound when the style has no source named sourceID.
- StatusInvalidArgument when the source named sourceID isn't a custom vector source.
func (*MapHandle) IsClosed
func (handle *MapHandle) IsClosed() bool
IsClosed reports whether the binding has accepted a release, dispose, or discard of the handle. A nil handle is closed.
func (*MapHandle) LatLngBoundsForCamera
func (receiver *MapHandle) LatLngBoundsForCamera(camera CameraOptions) (*Future[LatLngBounds], error)
LatLngBoundsForCamera computes the area that the map would show with camera.
Camera fields that camera doesn't set come from the map's camera. The longitudes can fall outside -180 to 180, so a view across the antimeridian gives one continuous range.
See mln_map_lat_lng_bounds_for_camera in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html
func (*MapHandle) ListStyleLayers
func (receiver *MapHandle) ListStyleLayers() (*Future[[]StyleLayerInfo], error)
ListStyleLayers lists the layers of the map's style, from bottom to top.
See mln_map_list_style_layers in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
func (*MapHandle) ListStyleSources
func (receiver *MapHandle) ListStyleSources() (*Future[[]StyleSourceInfo], error)
ListStyleSources lists the sources of the map's style.
See mln_map_list_style_sources in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
func (*MapHandle) MoveStyleLayer
func (receiver *MapHandle) MoveStyleLayer(layerID string, beforeLayerID string) (*Future[CommandCompletion], error)
MoveStyleLayer moves a layer of the map's style below the layer named beforeLayerID, or above every layer when beforeLayerID is empty.
See mln_map_move_style_layer in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
Errors:
- StatusNotFound when the style has no layer named layerID or beforeLayerID.
- StatusInvalidState while the style isn't loaded, as MapHandle.SetStyleURL() describes.
func (*MapHandle) Release
func (receiver *MapHandle) Release() (*Future[struct{}], error)
Release releases the map.
Detach the map's render session first.
See mln_map_release in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
func (*MapHandle) RemoveFeatureState
func (receiver *MapHandle) RemoveFeatureState(selector FeatureStateSelector) (*Future[CommandCompletion], error)
RemoveFeatureState removes the feature state that selector selects.
See mln_map_remove_feature_state in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
func (*MapHandle) RemoveStyleImage
func (receiver *MapHandle) RemoveStyleImage(imageID string) (*Future[CommandCompletion], error)
RemoveStyleImage removes an image from the map's style.
See mln_map_remove_style_image in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
Errors:
- StatusNotFound when the style has no image named imageID.
- StatusInvalidState while the style isn't loaded, as MapHandle.SetStyleURL() describes.
func (*MapHandle) RemoveStyleLayer
func (receiver *MapHandle) RemoveStyleLayer(layerID string) (*Future[CommandCompletion], error)
RemoveStyleLayer removes a layer from the map's style.
See mln_map_remove_style_layer in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
Errors:
- StatusNotFound when the style has no layer named layerID.
- StatusInvalidState while the style isn't loaded, as MapHandle.SetStyleURL() describes.
func (*MapHandle) RemoveStyleSource
func (receiver *MapHandle) RemoveStyleSource(sourceID string) (*Future[CommandCompletion], error)
RemoveStyleSource removes a source from the map's style.
See mln_map_remove_style_source in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
Errors:
- StatusNotFound when the style has no source named sourceID.
- StatusInvalidState when a layer still uses the source, or while the style isn't loaded, as MapHandle.SetStyleURL() describes.
func (*MapHandle) RequestRepaint
func (receiver *MapHandle) RequestRepaint() (*Future[CommandCompletion], error)
RequestRepaint renders a new frame of a continuous map, even when nothing changed.
See mln_map_request_repaint in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
func (*MapHandle) RequestStillImage
func (receiver *MapHandle) RequestStillImage() (*Future[struct{}], error)
RequestStillImage renders a still image of a static or tile map.
The map's render session draws the image once every resource that the image needs has loaded.
See mln_map_request_still_image in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
Errors:
- StatusCancelled when the map is released before the image is done.
- StatusNativeError when the style or a resource that the image needs fails to load.
func (*MapHandle) Resize
func (receiver *MapHandle) Resize(logicalSize LogicalSize) (*Future[CommandCompletion], error)
Resize sets the map's size.
A map with a render session takes its size from the session, so resize the session with RenderSessionHandle.Resize() instead.
See mln_map_resize in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
Errors:
- StatusInvalidState when the map has a render session.
- StatusInvalidState when a render session attached to the map before the resize applied.
func (*MapHandle) SetBounds
func (receiver *MapHandle) SetBounds(options BoundOptions) (*Future[CommandCompletion], error)
SetBounds limits the camera's center to an area, and its zoom and pitch to ranges.
Limits that options doesn't set keep their current values. When the camera is outside the new limits, it moves inside them.
See mln_map_set_bounds in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html
func (*MapHandle) SetCustomGeometrySourceTileData
func (receiver *MapHandle) SetCustomGeometrySourceTileData(sourceID string, tileID CanonicalTileID, data string) (*Future[CommandCompletion], error)
SetCustomGeometrySourceTileData sets the data of a tile in a custom geometry source.
data is a GeoJSON feature collection, feature, or geometry. The source ignores data for a tile that it hasn't asked for, or has since cancelled.
See mln_map_set_custom_geometry_source_tile_data in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
Errors:
- StatusNotFound when the style has no source named sourceID.
- StatusInvalidArgument when the source named sourceID isn't a custom geometry source.
func (*MapHandle) SetCustomGeometrySourceTileError
func (receiver *MapHandle) SetCustomGeometrySourceTileError(sourceID string, tileID CanonicalTileID, message string) (*Future[CommandCompletion], error)
SetCustomGeometrySourceTileError reports that a tile of a custom geometry source failed to load.
See mln_map_set_custom_geometry_source_tile_error in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
Errors:
- StatusNotFound when the style has no source named sourceID.
- StatusInvalidArgument when the source named sourceID isn't a custom geometry source.
func (*MapHandle) SetCustomVectorSourceTileData
func (receiver *MapHandle) SetCustomVectorSourceTileData(sourceID string, tileID CanonicalTileID, encoding StyleVectorTileEncoding, data []byte) (*Future[CommandCompletion], error)
SetCustomVectorSourceTileData sets the data of a tile in a custom vector source.
data is the tile, encoded as encoding. The source ignores data for a tile that it hasn't asked for, or has since cancelled.
See mln_map_set_custom_vector_source_tile_data in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
Errors:
- StatusNotFound when the style has no source named sourceID.
- StatusInvalidArgument when the source named sourceID isn't a custom vector source.
func (*MapHandle) SetCustomVectorSourceTileError
func (receiver *MapHandle) SetCustomVectorSourceTileError(sourceID string, tileID CanonicalTileID, message string) (*Future[CommandCompletion], error)
SetCustomVectorSourceTileError reports that a tile of a custom vector source failed to load.
See mln_map_set_custom_vector_source_tile_error in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
Errors:
- StatusNotFound when the style has no source named sourceID.
- StatusInvalidArgument when the source named sourceID isn't a custom vector source.
func (*MapHandle) SetDebugFlags
func (receiver *MapHandle) SetDebugFlags(flags MapDebugFlag) (*Future[CommandCompletion], error)
SetDebugFlags draws debugging overlays, such as tile borders, on the map.
flags replaces the overlays set before.
See mln_map_set_debug_flags in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html
func (*MapHandle) SetEventMask
func (receiver *MapHandle) SetEventMask(mask RuntimeEventFlag) (*Future[CommandCompletion], error)
SetEventMask selects the events that the map reports.
See mln_map_set_event_mask in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
func (*MapHandle) SetFeatureState
func (receiver *MapHandle) SetFeatureState(selector FeatureStateSelector, state string) (*Future[CommandCompletion], error)
SetFeatureState merges state into the state of a feature.
state is a JSON object. Its keys replace the same keys in the feature's state, and the other keys stay.
See mln_map_set_feature_state in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
func (*MapHandle) SetFreeCameraOptions
func (receiver *MapHandle) SetFreeCameraOptions(options FreeCameraOptions) (*Future[CommandCompletion], error)
SetFreeCameraOptions places the camera at a position and orientation in space.
The map adjusts them to a camera that it can show. It stops running camera animations first, and their end handlers report CameraTransitionOutcomeCancelled.
See mln_map_set_free_camera_options in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html
func (*MapHandle) SetGeoJSONSourceData
func (receiver *MapHandle) SetGeoJSONSourceData(sourceID string, data string) (*Future[CommandCompletion], error)
SetGeoJSONSourceData replaces the data of a GeoJSON source.
data is a GeoJSON feature collection, feature, or geometry. The library prepares it for the source with the source's options, off the threads that the caller and the runtime use, and the command completes once the source holds it. Later commands don't wait for it. While the source is still preparing earlier data, only the newest data waits to follow it.
With synchronous tiling on, as MapHandle.SetGeoJSONSourceSynchronousTiling() describes, the command prepares data before later commands run, so the data shows in the next frame.
See mln_map_set_geo_json_source_data in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
Errors:
- StatusNotFound when the style has no source named sourceID.
- StatusInvalidArgument when the source named sourceID isn't a GeoJSON source, when data isn't valid GeoJSON, or when the source clusters and data isn't a feature collection of points. The source keeps its data.
- StatusCancelled when newer data for the source replaces data while it waits, or when the source's URL, its removal, a style load, or the map's release replaces the source's data before data is ready.
- StatusInvalidState while the style isn't loaded, as MapHandle.SetStyleURL() describes.
func (*MapHandle) SetGeoJSONSourceSynchronousTiling
func (receiver *MapHandle) SetGeoJSONSourceSynchronousTiling(sourceID string, enabled bool) (*Future[CommandCompletion], error)
SetGeoJSONSourceSynchronousTiling sets whether a GeoJSON source builds its tiles while the map renders.
Building tiles while the map renders, instead of in the background, makes new data show in the next frame. The setting replaces the synchronousUpdate member of the source's JSON, which defaults to false.
See mln_map_set_geo_json_source_synchronous_tiling in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
Errors:
- StatusNotFound when the style has no source named sourceID.
- StatusInvalidArgument when the source named sourceID isn't a GeoJSON source.
- StatusInvalidState while the style isn't loaded, as MapHandle.SetStyleURL() describes.
func (*MapHandle) SetGeoJSONSourceURL
func (receiver *MapHandle) SetGeoJSONSourceURL(sourceID string, url string) (*Future[CommandCompletion], error)
SetGeoJSONSourceURL makes a GeoJSON source load its data from url.
See mln_map_set_geo_json_source_url in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
Errors:
- StatusNotFound when the style has no source named sourceID.
- StatusInvalidArgument when the source named sourceID isn't a GeoJSON source.
- StatusInvalidState while the style isn't loaded, as MapHandle.SetStyleURL() describes.
func (*MapHandle) SetGlobalStateProperty
func (receiver *MapHandle) SetGlobalStateProperty(propertyName string, value string) (*Future[CommandCompletion], error)
SetGlobalStateProperty sets a value that the style's global-state [expressions](https://maplibre.org/maplibre-style-spec/expressions/) read.
See mln_map_set_global_state_property in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
Errors:
- StatusInvalidState while the style isn't loaded, as MapHandle.SetStyleURL() describes.
func (*MapHandle) SetImageSourceCoordinates
func (receiver *MapHandle) SetImageSourceCoordinates(sourceID string, coordinates []LatLng) (*Future[CommandCompletion], error)
SetImageSourceCoordinates moves the image of an image source.
coordinates are the image's four corners, clockwise from the top left.
See mln_map_set_image_source_coordinates in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
Errors:
- StatusNotFound when the style has no source named sourceID.
- StatusInvalidArgument when the source named sourceID isn't an image source.
- StatusInvalidState while the style isn't loaded, as MapHandle.SetStyleURL() describes.
func (*MapHandle) SetImageSourceImage
func (receiver *MapHandle) SetImageSourceImage(sourceID string, image PremultipliedRgba8Image) (*Future[CommandCompletion], error)
SetImageSourceImage replaces the image of an image source.
See mln_map_set_image_source_image in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
Errors:
- StatusNotFound when the style has no source named sourceID.
- StatusInvalidArgument when the source named sourceID isn't an image source.
- StatusInvalidState while the style isn't loaded, as MapHandle.SetStyleURL() describes.
func (*MapHandle) SetImageSourceURL
func (receiver *MapHandle) SetImageSourceURL(sourceID string, url string) (*Future[CommandCompletion], error)
SetImageSourceURL makes an image source load its image from url.
See mln_map_set_image_source_url in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
Errors:
- StatusNotFound when the style has no source named sourceID.
- StatusInvalidArgument when the source named sourceID isn't an image source.
- StatusInvalidState while the style isn't loaded, as MapHandle.SetStyleURL() describes.
func (*MapHandle) SetProjectionMode
func (receiver *MapHandle) SetProjectionMode(options ProjectionModeOptions) (*Future[CommandCompletion], error)
SetProjectionMode sets whether the map draws in perspective or axonometric projection, and how much it skews the view.
Settings that options doesn't set keep their current values.
See mln_map_set_projection_mode in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html
func (*MapHandle) SetRenderingStatsViewEnabled
func (receiver *MapHandle) SetRenderingStatsViewEnabled(enabled bool) (*Future[CommandCompletion], error)
SetRenderingStatsViewEnabled shows or hides an overlay of rendering statistics on the map.
See mln_map_set_rendering_stats_view_enabled in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html
func (*MapHandle) SetStyleImage
func (receiver *MapHandle) SetStyleImage(imageID string, image PremultipliedRgba8Image, options *StyleImageOptions) (*Future[CommandCompletion], error)
SetStyleImage adds an image to the map's style, or replaces the image named imageID.
See mln_map_set_style_image in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
Errors:
- StatusInvalidState while the style isn't loaded, as MapHandle.SetStyleURL() describes.
func (*MapHandle) SetStyleJSON
func (receiver *MapHandle) SetStyleJSON(json string) (*Future[CommandCompletion], error)
SetStyleJSON loads the map's style from json.
The command completes once the style has parsed, and the map's style is then loaded, as MapHandle.SetStyleURL() describes. The style's sources, sprites, and glyphs load in the background.
See mln_map_set_style_json in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
Errors:
- StatusNativeError when json isn't a valid style. The map keeps its current style.
func (*MapHandle) SetStyleLayerProperty
func (receiver *MapHandle) SetStyleLayerProperty(layerID string, propertyName string, value string) (*Future[CommandCompletion], error)
SetStyleLayerProperty sets a property of a layer in the map's style.
propertyName is one of the layer's layout or paint [properties](https://maplibre.org/maplibre-style-spec/layers/), or filter, minzoom, maxzoom, source, or source-layer. A null value resets any of these but source and source-layer to its default.
See mln_map_set_style_layer_property in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
Errors:
- StatusNotFound when the style has no layer named layerID.
- StatusInvalidState while the style isn't loaded, as MapHandle.SetStyleURL() describes.
func (*MapHandle) SetStyleLightJSON
func (receiver *MapHandle) SetStyleLightJSON(lightJSON string) (*Future[CommandCompletion], error)
SetStyleLightJSON replaces the [light](https://maplibre.org/maplibre-style-spec/light/) of the map's style.
See mln_map_set_style_light_json in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
Errors:
- StatusInvalidState while the style isn't loaded, as MapHandle.SetStyleURL() describes.
func (*MapHandle) SetStyleLightProperty
func (receiver *MapHandle) SetStyleLightProperty(propertyName string, value string) (*Future[CommandCompletion], error)
SetStyleLightProperty sets a property of the light of the map's style.
See mln_map_set_style_light_property in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
Errors:
- StatusInvalidState while the style isn't loaded, as MapHandle.SetStyleURL() describes.
func (*MapHandle) SetStyleSourceVolatile
func (receiver *MapHandle) SetStyleSourceVolatile(sourceID string, isVolatile bool) (*Future[CommandCompletion], error)
SetStyleSourceVolatile sets whether a source is volatile.
The map doesn't store the tiles of a volatile source in the persistent cache.
See mln_map_set_style_source_volatile in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
Errors:
- StatusNotFound when the style has no source named sourceID.
- StatusInvalidState while the style isn't loaded, as MapHandle.SetStyleURL() describes.
func (*MapHandle) SetStyleTransitionOptions
func (receiver *MapHandle) SetStyleTransitionOptions(options StyleTransitionOptions) (*Future[CommandCompletion], error)
SetStyleTransitionOptions sets the default transition of the map's style.
See mln_map_set_style_transition_options in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
Errors:
- StatusInvalidState while the style isn't loaded, as MapHandle.SetStyleURL() describes.
func (*MapHandle) SetStyleURL
func (receiver *MapHandle) SetStyleURL(url string) (*Future[CommandCompletion], error)
SetStyleURL loads the map's style from url.
The command completes once the style document has loaded and parsed. The style's sources, sprites, and glyphs then load in the background.
The map's style is loaded from the time a style document parses until the next call to this function. While the style isn't loaded, the commands that change it complete with StatusInvalidState. To change a new map's style without a style document, first load an empty style, such as {"version":8,"sources":{},"layers":[]}.
See mln_map_set_style_url in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
Errors:
- StatusNativeError when the style document fails to load or isn't a valid style.
- StatusCancelled when the map is released, or this function or MapHandle.SetStyleJSON() loads another style, before the style document parses.
func (*MapHandle) SetTileOptions
func (receiver *MapHandle) SetTileOptions(options MapTileOptions) (*Future[CommandCompletion], error)
SetTileOptions sets how the map chooses which tiles to load, and at what detail.
Settings that options doesn't set keep their current values.
See mln_map_set_tile_options in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html
func (*MapHandle) SetViewportOptions
func (receiver *MapHandle) SetViewportOptions(options MapViewportOptions) (*Future[CommandCompletion], error)
SetViewportOptions sets how the map orients and constrains its view.
Settings that options doesn't set keep their current values.
See mln_map_set_viewport_options in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html
func (*MapHandle) Snapshot
func (receiver *MapHandle) Snapshot() (MapSnapshot, error)
Snapshot copies the map's state.
The copy doesn't wait for pending commands. To read the camera after they apply, use MapHandle.GetCamera().
See mln_map_get_snapshot in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
Errors:
- StatusInvalidState until RuntimeHandle.CreateMap() completes with StatusOk.
func (*MapHandle) String
func (handle *MapHandle) String() string
String formats the handle as MapHandle(id=0x<hex>, closed=<true|false>).
func (*MapHandle) UpdateCamera
func (receiver *MapHandle) UpdateCamera(update CameraUpdate) (*Future[CommandCompletion], error)
UpdateCamera moves the camera, at once or with an animation.
Camera fields that update doesn't set keep their values, and the update stops any running animation of the fields it sets. The function finishes when the map applies the update, before an animation ends. To learn when an animation ends, set an CameraTransitionHandler in its animation options.
See mln_map_update_camera in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html
type MapHandleDiscarding
type MapHandleDiscarding struct { // contains filtered or unexported fields }
func (MapHandleDiscarding) AddCustomGeometrySource
func (view MapHandleDiscarding) AddCustomGeometrySource(sourceID string, options CustomGeometrySourceOptions) error
func (MapHandleDiscarding) AddCustomVectorSource
func (view MapHandleDiscarding) AddCustomVectorSource(sourceID string, options CustomVectorSourceOptions) error
func (MapHandleDiscarding) AddGeoJSONSource
func (view MapHandleDiscarding) AddGeoJSONSource(sourceID string, options *GeoJSONSourceOptions, attribution string) error
func (MapHandleDiscarding) AddImageSourceImage
func (view MapHandleDiscarding) AddImageSourceImage(sourceID string, coordinates []LatLng, image PremultipliedRgba8Image) error
func (MapHandleDiscarding) AddStyleLayerJSON
func (view MapHandleDiscarding) AddStyleLayerJSON(layerJSON string, beforeLayerID string) error
func (MapHandleDiscarding) AddStyleSourceJSON
func (view MapHandleDiscarding) AddStyleSourceJSON(sourceID string, sourceJSON string) error
func (MapHandleDiscarding) ApplyCameraDelta
func (view MapHandleDiscarding) ApplyCameraDelta(delta CameraDelta) error
func (MapHandleDiscarding) BeginCommandGroup
func (view MapHandleDiscarding) BeginCommandGroup() error
func (MapHandleDiscarding) CancelCameraTransitions
func (view MapHandleDiscarding) CancelCameraTransitions() error
func (MapHandleDiscarding) CancelCameraTransitionsWithID
func (view MapHandleDiscarding) CancelCameraTransitionsWithID(transitionID uint64) error
func (MapHandleDiscarding) DumpDebugLogs
func (view MapHandleDiscarding) DumpDebugLogs() error
func (MapHandleDiscarding) EndCommandGroup
func (view MapHandleDiscarding) EndCommandGroup() error
func (MapHandleDiscarding) FitCameraToGeometry
func (view MapHandleDiscarding) FitCameraToGeometry(geometry string, update CameraFitUpdate) error
func (MapHandleDiscarding) FitCameraToLatLngBounds
func (view MapHandleDiscarding) FitCameraToLatLngBounds(bounds LatLngBounds, update CameraFitUpdate) error
func (MapHandleDiscarding) FitCameraToLatLngs
func (view MapHandleDiscarding) FitCameraToLatLngs(coordinates []LatLng, update CameraFitUpdate) error
func (MapHandleDiscarding) InvalidateCustomGeometrySourceRegion
func (view MapHandleDiscarding) InvalidateCustomGeometrySourceRegion(sourceID string, bounds LatLngBounds) error
func (MapHandleDiscarding) InvalidateCustomGeometrySourceTile
func (view MapHandleDiscarding) InvalidateCustomGeometrySourceTile(sourceID string, tileID CanonicalTileID) error
func (MapHandleDiscarding) InvalidateCustomVectorSourceRegion
func (view MapHandleDiscarding) InvalidateCustomVectorSourceRegion(sourceID string, bounds LatLngBounds) error
func (MapHandleDiscarding) InvalidateCustomVectorSourceTile
func (view MapHandleDiscarding) InvalidateCustomVectorSourceTile(sourceID string, tileID CanonicalTileID) error
func (MapHandleDiscarding) MoveStyleLayer
func (view MapHandleDiscarding) MoveStyleLayer(layerID string, beforeLayerID string) error
func (MapHandleDiscarding) RemoveFeatureState
func (view MapHandleDiscarding) RemoveFeatureState(selector FeatureStateSelector) error
func (MapHandleDiscarding) RemoveStyleImage
func (view MapHandleDiscarding) RemoveStyleImage(imageID string) error
func (MapHandleDiscarding) RemoveStyleLayer
func (view MapHandleDiscarding) RemoveStyleLayer(layerID string) error
func (MapHandleDiscarding) RemoveStyleSource
func (view MapHandleDiscarding) RemoveStyleSource(sourceID string) error
func (MapHandleDiscarding) RequestRepaint
func (view MapHandleDiscarding) RequestRepaint() error
func (MapHandleDiscarding) Resize
func (view MapHandleDiscarding) Resize(logicalSize LogicalSize) error
func (MapHandleDiscarding) SetBounds
func (view MapHandleDiscarding) SetBounds(options BoundOptions) error
func (MapHandleDiscarding) SetCustomGeometrySourceTileData
func (view MapHandleDiscarding) SetCustomGeometrySourceTileData(sourceID string, tileID CanonicalTileID, data string) error
func (MapHandleDiscarding) SetCustomGeometrySourceTileError
func (view MapHandleDiscarding) SetCustomGeometrySourceTileError(sourceID string, tileID CanonicalTileID, message string) error
func (MapHandleDiscarding) SetCustomVectorSourceTileData
func (view MapHandleDiscarding) SetCustomVectorSourceTileData(sourceID string, tileID CanonicalTileID, encoding StyleVectorTileEncoding, data []byte) error
func (MapHandleDiscarding) SetCustomVectorSourceTileError
func (view MapHandleDiscarding) SetCustomVectorSourceTileError(sourceID string, tileID CanonicalTileID, message string) error
func (MapHandleDiscarding) SetDebugFlags
func (view MapHandleDiscarding) SetDebugFlags(flags MapDebugFlag) error
func (MapHandleDiscarding) SetEventMask
func (view MapHandleDiscarding) SetEventMask(mask RuntimeEventFlag) error
func (MapHandleDiscarding) SetFeatureState
func (view MapHandleDiscarding) SetFeatureState(selector FeatureStateSelector, state string) error
func (MapHandleDiscarding) SetFreeCameraOptions
func (view MapHandleDiscarding) SetFreeCameraOptions(options FreeCameraOptions) error
func (MapHandleDiscarding) SetGeoJSONSourceData
func (view MapHandleDiscarding) SetGeoJSONSourceData(sourceID string, data string) error
func (MapHandleDiscarding) SetGeoJSONSourceSynchronousTiling
func (view MapHandleDiscarding) SetGeoJSONSourceSynchronousTiling(sourceID string, enabled bool) error
func (MapHandleDiscarding) SetGeoJSONSourceURL
func (view MapHandleDiscarding) SetGeoJSONSourceURL(sourceID string, url string) error
func (MapHandleDiscarding) SetGlobalStateProperty
func (view MapHandleDiscarding) SetGlobalStateProperty(propertyName string, value string) error
func (MapHandleDiscarding) SetImageSourceCoordinates
func (view MapHandleDiscarding) SetImageSourceCoordinates(sourceID string, coordinates []LatLng) error
func (MapHandleDiscarding) SetImageSourceImage
func (view MapHandleDiscarding) SetImageSourceImage(sourceID string, image PremultipliedRgba8Image) error
func (MapHandleDiscarding) SetImageSourceURL
func (view MapHandleDiscarding) SetImageSourceURL(sourceID string, url string) error
func (MapHandleDiscarding) SetProjectionMode
func (view MapHandleDiscarding) SetProjectionMode(options ProjectionModeOptions) error
func (MapHandleDiscarding) SetRenderingStatsViewEnabled
func (view MapHandleDiscarding) SetRenderingStatsViewEnabled(enabled bool) error
func (MapHandleDiscarding) SetStyleImage
func (view MapHandleDiscarding) SetStyleImage(imageID string, image PremultipliedRgba8Image, options *StyleImageOptions) error
func (MapHandleDiscarding) SetStyleJSON
func (view MapHandleDiscarding) SetStyleJSON(json string) error
func (MapHandleDiscarding) SetStyleLayerProperty
func (view MapHandleDiscarding) SetStyleLayerProperty(layerID string, propertyName string, value string) error
func (MapHandleDiscarding) SetStyleLightJSON
func (view MapHandleDiscarding) SetStyleLightJSON(lightJSON string) error
func (MapHandleDiscarding) SetStyleLightProperty
func (view MapHandleDiscarding) SetStyleLightProperty(propertyName string, value string) error
func (MapHandleDiscarding) SetStyleSourceVolatile
func (view MapHandleDiscarding) SetStyleSourceVolatile(sourceID string, isVolatile bool) error
func (MapHandleDiscarding) SetStyleTransitionOptions
func (view MapHandleDiscarding) SetStyleTransitionOptions(options StyleTransitionOptions) error
func (MapHandleDiscarding) SetStyleURL
func (view MapHandleDiscarding) SetStyleURL(url string) error
func (MapHandleDiscarding) SetTileOptions
func (view MapHandleDiscarding) SetTileOptions(options MapTileOptions) error
func (MapHandleDiscarding) SetViewportOptions
func (view MapHandleDiscarding) SetViewportOptions(options MapViewportOptions) error
func (MapHandleDiscarding) UpdateCamera
func (view MapHandleDiscarding) UpdateCamera(update CameraUpdate) error
type MapLoadError
type MapLoadError uint32
MapLoadError corresponds to mln_map_load_error. Why a map failed to load a style.
See mln_map_load_error in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
const ( MapLoadErrorUnknown MapLoadError = MapLoadError(C.MLN_MAP_LOAD_ERROR_UNKNOWN) // The style document isn't a valid style. MapLoadErrorStyleParse MapLoadError = MapLoadError(C.MLN_MAP_LOAD_ERROR_STYLE_PARSE) // The style's request failed, such as with a 404 or a missing file. MapLoadErrorStyleLoad MapLoadError = MapLoadError(C.MLN_MAP_LOAD_ERROR_STYLE_LOAD) )
func (MapLoadError) String
func (value MapLoadError) String() string
type MapMode
type MapMode uint32
MapMode corresponds to mln_map_mode. When a map renders.
See mln_map_mode in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
const ( // Renders whenever the map changes. MapModeContinuous MapMode = MapMode(C.MLN_MAP_MODE_CONTINUOUS) // Renders only when MapHandle.RequestStillImage() asks for an image. MapModeStatic MapMode = MapMode(C.MLN_MAP_MODE_STATIC) // Renders still images of single tiles, as MapModeStatic does. MapModeTile MapMode = MapMode(C.MLN_MAP_MODE_TILE) )
func (MapMode) String
func (value MapMode) String() string
type MapOptions
type MapOptions struct { // The map's first size, and its scale factor. The scale factor stays fixed for // the map's life, and every render session of the map renders at it. InitialExtent LogicalExtent MapMode MapMode // Whether the map decodes MapLibre Tiles (MLT) that use FastPFOR integer // encoding. Without it, such tiles fail to load. FastPforEnabled bool // The events that the map reports. Without it, the map reports them all. EventMask *RuntimeEventFlag // Whether the map keeps tiles in memory after they leave the view, so they show // again without loading. Without it, the map keeps them. TileCacheEnabled *bool }
MapOptions corresponds to mln_map_options. Options for RuntimeHandle.CreateMap().
See mln_map_options in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type MapProjectionCameraResult
type MapProjectionCameraResult struct{ Camera Camera }
MapProjectionCameraResult corresponds to mln_map_projection_camera_result. A projection's camera, as MapProjectionHandle.Camera() reports it.
See mln_map_projection_camera_result in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/projection_8h.html
type MapProjectionHandle
type MapProjectionHandle struct { // contains filtered or unexported fields }
MapProjectionHandle corresponds to mln_map_projection. A camera view for converting between screen points and coordinates.
See mln_map_projection in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/base_8h.html
func NewMapProjection
func NewMapProjection(view MapView) (*MapProjectionHandle, error)
NewMapProjection creates a projection that converts coordinates for one view of a map.
Create it from the view of an MapSnapshot or an RenderFrameResult. The projection doesn't follow the map, so create a new one after the map's camera or size changes.
See mln_map_projection_create in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/projection_8h.html
func (*MapProjectionHandle) Camera
func (receiver *MapProjectionHandle) Camera() (MapProjectionCameraResult, error)
Camera reads the projection's camera.
See mln_map_projection_get_camera in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/projection_8h.html
func (*MapProjectionHandle) ID
func (handle *MapProjectionHandle) ID() uint64
ID returns the native handle value. It stays readable after the handle is released.
func (*MapProjectionHandle) IsClosed
func (handle *MapProjectionHandle) IsClosed() bool
IsClosed reports whether the binding has accepted a release, dispose, or discard of the handle. A nil handle is closed.
func (*MapProjectionHandle) LatLngForPixel
func (receiver *MapProjectionHandle) LatLngForPixel(point ScreenPoint) (LatLng, error)
LatLngForPixel finds the coordinate at a screen point.
The longitude stays between -180 and 180.
See mln_map_projection_lat_lng_for_pixel in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/projection_8h.html
func (*MapProjectionHandle) LatLngForPixelUnwrapped
func (receiver *MapProjectionHandle) LatLngForPixelUnwrapped(point ScreenPoint) (LatLng, error)
LatLngForPixelUnwrapped finds the coordinate at a screen point, without wrapping its longitude.
The longitude can fall outside -180 to 180, to show which copy of the world the point is in.
See mln_map_projection_lat_lng_for_pixel_unwrapped in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/projection_8h.html
func (*MapProjectionHandle) LatLngsForPixels
func (receiver *MapProjectionHandle) LatLngsForPixels(points []ScreenPoint) ([]LatLng, error)
LatLngsForPixels finds the coordinates at several screen points, as MapProjectionHandle.LatLngForPixel() does.
See mln_map_projection_lat_lngs_for_pixels in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/projection_8h.html
func (*MapProjectionHandle) LatLngsForPixelsUnwrapped
func (receiver *MapProjectionHandle) LatLngsForPixelsUnwrapped(points []ScreenPoint) ([]LatLng, error)
LatLngsForPixelsUnwrapped finds the coordinates at several screen points, as MapProjectionHandle.LatLngForPixelUnwrapped() does.
See mln_map_projection_lat_lngs_for_pixels_unwrapped in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/projection_8h.html
func (*MapProjectionHandle) MetersPerPixelAtLatitude
func (receiver *MapProjectionHandle) MetersPerPixelAtLatitude(latitude float64) (float64, error)
MetersPerPixelAtLatitude computes how many meters one screen pixel covers at latitude, at the projection's zoom.
The result ignores the camera's pitch.
See mln_map_projection_meters_per_pixel_at_latitude in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/projection_8h.html
func (*MapProjectionHandle) PixelForLatLng
func (receiver *MapProjectionHandle) PixelForLatLng(coordinate LatLng) (ScreenPoint, error)
PixelForLatLng finds the screen point of a coordinate.
The point is in the copy of the world nearest the camera's center.
See mln_map_projection_pixel_for_lat_lng in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/projection_8h.html
func (*MapProjectionHandle) PixelsForLatLngs
func (receiver *MapProjectionHandle) PixelsForLatLngs(coordinates []LatLng) ([]ScreenPoint, error)
PixelsForLatLngs finds the screen points of several coordinates, as MapProjectionHandle.PixelForLatLng() does.
See mln_map_projection_pixels_for_lat_lngs in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/projection_8h.html
func (*MapProjectionHandle) Release
func (receiver *MapProjectionHandle) Release() error
Release releases a projection.
See mln_map_projection_release in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/projection_8h.html
func (*MapProjectionHandle) SetCamera
func (receiver *MapProjectionHandle) SetCamera(camera CameraOptions) error
SetCamera moves the projection's camera, without changing the map.
Camera fields that camera doesn't set keep their values.
See mln_map_projection_set_camera in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/projection_8h.html
func (*MapProjectionHandle) String
func (handle *MapProjectionHandle) String() string
String formats the handle as MapProjectionHandle(id=0x<hex>, closed=<true|false>).
type MapSnapshot
type MapSnapshot struct { DebugFlags MapDebugFlag // Grows with each change to the map's state. Generation uint64 // Whether the style and every resource that the view needs have loaded. FullyLoaded bool RenderingStatsViewEnabled bool GestureInProgress bool TransitionInProgress bool EventMask RuntimeEventFlag // Counts the render updates that the map has made for its render session. LatestRenderUpdateGeneration uint64 Tile MapTileSettings Bounds CameraBounds FreeCamera FreeCamera View MapView }
MapSnapshot corresponds to mln_map_snapshot. A map's state, as MapHandle.Snapshot() reads it.
See mln_map_snapshot in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type MapTileOptions
type MapTileOptions struct { // How many zoom levels lower the map also loads tiles for, so it can show a // coarse map while the current tiles load. 0 loads only the current tiles. PrefetchZoomDelta *uint32 // The radius around the view point, in tiles, that keeps full detail. LodMinRadius *float64 // Scales the distance to the view point. Above 1 lowers the detail. LodScale *float64 // The pitch, in degrees, above which the map lowers the detail. LodPitchThreshold *float64 // Zoom levels to add for picking the detail. Below 0 loads fewer tiles. LodZoomShift *float64 // TileLodModeDistance ignores lod_min_radius. LodMode *TileLodMode }
MapTileOptions corresponds to mln_map_tile_options. How the map picks the tiles to load.
The lod_ members lower the level of detail away from the camera, so the map loads fewer tiles when the pitch is high.
See mln_map_tile_options in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type MapTileSettings
type MapTileSettings struct { PrefetchZoomDelta uint32 LodMinRadius float64 LodScale float64 // The pitch, in degrees, above which the map lowers the detail. LodPitchThreshold float64 LodZoomShift float64 LodMode TileLodMode }
MapTileSettings corresponds to mln_map_tile_settings. All the settings for how a map picks the tiles to load.
Its members mean the same as those of MapTileOptions.
See mln_map_tile_settings in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type MapView
type MapView struct { Camera Camera Extent LogicalExtent ProjectionMode ProjectionMode Viewport MapViewport }
MapView corresponds to mln_map_view. One view of a map: its camera, size, and projection.
See mln_map_view in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type MapViewport
type MapViewport struct { NorthOrientation NorthOrientation ConstrainMode ConstrainMode ViewportMode ViewportMode FrustumOffset EdgeInsets }
MapViewport corresponds to mln_map_viewport. A map's whole viewport.
Its members mean the same as those of MapViewportOptions.
See mln_map_viewport in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type MapViewportOptions
type MapViewportOptions struct { NorthOrientation *NorthOrientation ConstrainMode *ConstrainMode ViewportMode *ViewportMode FrustumOffset *EdgeInsets }
MapViewportOptions corresponds to mln_map_viewport_options. How the map orients and constrains its view.
See mln_map_viewport_options in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type MetalBorrowedTexture
type MetalBorrowedTexture struct { // Your MTLTexture. Texture uintptr }
MetalBorrowedTexture corresponds to mln_metal_borrowed_texture. A Metal texture of a borrowed ring.
See mln_metal_borrowed_texture in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html
type MetalBorrowedTextureDescriptor
type MetalBorrowedTextureDescriptor struct { LogicalSize LogicalSize PhysicalWidth uint32 PhysicalHeight uint32 Textures []MetalBorrowedTexture // Your MTLCommandQueue on the textures' device, or null for a queue of the // session's own. With your queue, frames can use GPUSyncKindQueueOrder. CommandQueue uintptr }
MetalBorrowedTextureDescriptor corresponds to mln_metal_borrowed_texture_descriptor. A ring of your Metal textures, for MapHandle.AttachMetalBorrowedTexture().
logical_size sets the map's size. physical_width and physical_height give the textures' size in pixels, which is usually logical_size times the map's scale factor. The textures must all have that size, one device, one pixel format, one sample, and MTLTextureUsageRenderTarget. The ring holds up to TextureRingMaxDepth distinct textures.
The session uses the textures until a replacement or release of the target completes, a detach or release of the session completes, or an abandon of it returns.
See mln_metal_borrowed_texture_descriptor in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html
type MetalBorrowedTextureReplacement
type MetalBorrowedTextureReplacement struct { LogicalSize LogicalSize PhysicalWidth uint32 PhysicalHeight uint32 Textures []MetalBorrowedTexture }
MetalBorrowedTextureReplacement corresponds to mln_metal_borrowed_texture_replacement. New Metal textures for a borrowed ring, for RenderSessionHandle.SetMetalBorrowedTextureTarget().
The members and the textures follow the rules of MetalBorrowedTextureDescriptor. The ring keeps its depth, device, and command queue, so give it as many textures as it attached with, on the same device.
See mln_metal_borrowed_texture_replacement in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html
type MetalContextDescriptor
type MetalContextDescriptor struct { // An MTLDevice. Device uintptr }
MetalContextDescriptor corresponds to mln_metal_context_descriptor. The Metal device that a render session uses.
See mln_metal_context_descriptor in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html
type MetalSurfaceDescriptor
type MetalSurfaceDescriptor struct { LogicalSize LogicalSize // The MTLDevice to render with. A null device picks the system's default. Context MetalContextDescriptor // Your CAMetalLayer. Layer uintptr }
MetalSurfaceDescriptor corresponds to mln_metal_surface_descriptor. A Metal layer to render to, for MapHandle.AttachMetalSurface().
The session sets the layer's device, pixel format, and drawable size. It uses the layer until a replacement or release of the target completes, a detach or release of the session completes, or an abandon of it returns.
See mln_metal_surface_descriptor in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/surface_8h.html
type MetalSurfaceReplacement
type MetalSurfaceReplacement struct { LogicalSize LogicalSize // Your CAMetalLayer. Layer uintptr }
MetalSurfaceReplacement corresponds to mln_metal_surface_replacement. A new Metal layer for RenderSessionHandle.SetMetalSurfaceTarget().
The session renders to it with the device that it attached with. It uses the layer until a replacement or release of the target completes, a detach or release of the session completes, or an abandon of it returns.
See mln_metal_surface_replacement in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/surface_8h.html
type MetalTextureFrame
type MetalTextureFrame struct { Width uint32 Height uint32 ScaleFactor float64 // The texture's index in the descriptor's textures. Slot uint32 // The MTLTexture. Texture uintptr // The texture's MTLDevice. Device uintptr // The texture's MTLPixelFormat. PixelFormat uint64 }
MetalTextureFrame corresponds to mln_metal_texture_frame. The Metal texture of an acquired frame.
See mln_metal_texture_frame in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html
type MetalTextureFrameView
type MetalTextureFrameView struct { // contains filtered or unexported fields }
func (MetalTextureFrameView) Height
func (view MetalTextureFrameView) Height() uint32
func (MetalTextureFrameView) PixelFormat
func (view MetalTextureFrameView) PixelFormat() uint64
func (MetalTextureFrameView) ScaleFactor
func (view MetalTextureFrameView) ScaleFactor() float64
func (MetalTextureFrameView) Slot
func (view MetalTextureFrameView) Slot() uint32
func (MetalTextureFrameView) UnsafeDevice
func (view MetalTextureFrameView) UnsafeDevice() (uintptr, error)
func (MetalTextureFrameView) UnsafeTexture
func (view MetalTextureFrameView) UnsafeTexture() (uintptr, error)
func (MetalTextureFrameView) Width
func (view MetalTextureFrameView) Width() uint32
type MomentumDecay
type MomentumDecay struct { Model *MomentumDecayModel // For MomentumDecayModelFriction, how long the speed takes to halve. HalfLifeMs *float64 // For MomentumDecayModelFriction, the speed at which it ends. StopSpeed *float64 // Required for MomentumDecayModelEase. Distance *float64 // Required for MomentumDecayModelEase. DurationMs *float64 // For MomentumDecayModelEase, the share of distance covered over the share of // duration_ms. Its control points are between 0 and 1, so the glide never // passes its distance. Defaults to (0, 0, 0.25, 1), the curve that camera // animations ease along by default. Android's scroll fling follows (0.175, 0.5, // 0.35, 1). Easing *UnitBezier // A slower release starts no momentum. MinSpeed *float64 // For MomentumDecayModelFriction, a faster release counts as this. MaxSpeed *float64 // The farthest the part moves. A friction release that would move farther // starts slower, so it ends sooner, and a planned glide moves at most this far // over its duration. MaxDistance *float64 }
MomentumDecay corresponds to mln_momentum_decay. How one part of a gesture's momentum slows from its release speed.
Speeds and distances are in the part's unit: logical pixels for pan, zoom levels for zoom, and degrees for bearing and pitch. A setting whose bit isn't set takes the part's default, which GestureMomentum lists. min_speed is finite and not negative, and every other number is finite and positive. A friction decay can serve every release, as a preset that matches a platform's scrolling. An eased glide takes its direction from the part's velocity, and its distance and duration from the caller's plan.
See mln_momentum_decay in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type MomentumDecayModel
type MomentumDecayModel uint32
MomentumDecayModel corresponds to mln_momentum_decay_model. How a part of a gesture's momentum slows from its release speed.
See mln_momentum_decay_model in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
const ( // The speed halves every half_life_ms, until it drops to stop_speed. // UIScrollView's normal deceleration is a half-life of 346 ms, and its fast // deceleration 69 ms. MomentumDecayModelFriction MomentumDecayModel = MomentumDecayModel(C.MLN_MOMENTUM_DECAY_MODEL_FRICTION) // The part eases distance over duration_ms, along easing, as a camera animation // does. The caller plans the glide, for example from the platform's own fling // physics, such as Android's OverScroller. MomentumDecayModelEase MomentumDecayModel = MomentumDecayModel(C.MLN_MOMENTUM_DECAY_MODEL_EASE) )
func (MomentumDecayModel) String
func (value MomentumDecayModel) String() string
type MomentumSnap
type MomentumSnap struct { // Positive. Spacing *float64 // Defaults to 0. Offset *float64 // Not negative. Tolerance *float64 // Zero settles without easing. Defaults to 300. DurationMs *float64 }
MomentumSnap corresponds to mln_momentum_snap. Where a part settles after a gesture that changed it.
The targets are every spacing from offset, in the part's unit. Bearing targets wrap around the circle. Once the part's glide ends, or right away when it doesn't move, the part eases to the nearest target if it is within tolerance of it, and otherwise stays where it is. A setting whose bit isn't set takes the part's default, which GestureMomentum lists.
See mln_momentum_snap in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type NetworkStatus
type NetworkStatus uint32
NetworkStatus corresponds to mln_network_status. Whether the library may use the network.
See mln_network_status in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
const ( NetworkStatusOnline NetworkStatus = NetworkStatus(C.MLN_NETWORK_STATUS_ONLINE) NetworkStatusOffline NetworkStatus = NetworkStatus(C.MLN_NETWORK_STATUS_OFFLINE) )
func GetNetworkStatus
func GetNetworkStatus() (NetworkStatus, error)
GetNetworkStatus reads whether the library may use the network.
See mln_network_get_status in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
func (NetworkStatus) String
func (value NetworkStatus) String() string
type NorthOrientation
type NorthOrientation uint32
NorthOrientation corresponds to mln_north_orientation. The screen direction that north points to when the bearing is 0.
See mln_north_orientation in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
const ( NorthOrientationUp NorthOrientation = NorthOrientation(C.MLN_NORTH_ORIENTATION_UP) NorthOrientationRight NorthOrientation = NorthOrientation(C.MLN_NORTH_ORIENTATION_RIGHT) NorthOrientationDown NorthOrientation = NorthOrientation(C.MLN_NORTH_ORIENTATION_DOWN) NorthOrientationLeft NorthOrientation = NorthOrientation(C.MLN_NORTH_ORIENTATION_LEFT) )
func (NorthOrientation) String
func (value NorthOrientation) String() string
type OfflineGeometryRegionDefinition
type OfflineGeometryRegionDefinition struct { StyleURL string Geometry string MinZoom float64 MaxZoom float64 PixelRatio float32 IncludeIdeographs bool }
OfflineGeometryRegionDefinition corresponds to mln_offline_geometry_region_definition. An offline region that covers a GeoJSON geometry.
The members other than geometry mean the same as those of OfflineTilePyramidRegionDefinition.
See mln_offline_geometry_region_definition in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type OfflineRegionDefinition
type OfflineRegionDefinition interface { // contains filtered or unexported methods }
OfflineRegionDefinition corresponds to mln_offline_region_definition. The area, zoom range, and style that an offline region covers.
See mln_offline_region_definition in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type OfflineRegionDefinitionGeometryVariant
type OfflineRegionDefinitionGeometryVariant struct { Value OfflineGeometryRegionDefinition }
type OfflineRegionDefinitionTilePyramidVariant
type OfflineRegionDefinitionTilePyramidVariant struct { Value OfflineTilePyramidRegionDefinition }
type OfflineRegionDownloadState
type OfflineRegionDownloadState uint32
OfflineRegionDownloadState corresponds to mln_offline_region_download_state. Whether an offline region is downloading.
See mln_offline_region_download_state in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
const ( OfflineRegionDownloadStateInactive OfflineRegionDownloadState = OfflineRegionDownloadState(C.MLN_OFFLINE_REGION_DOWNLOAD_INACTIVE) OfflineRegionDownloadStateActive OfflineRegionDownloadState = OfflineRegionDownloadState(C.MLN_OFFLINE_REGION_DOWNLOAD_ACTIVE) )
func (OfflineRegionDownloadState) String
func (value OfflineRegionDownloadState) String() string
type OfflineRegionInfo
type OfflineRegionInfo struct { ID int64 Definition OfflineRegionDefinition Metadata []byte }
OfflineRegionInfo corresponds to mln_offline_region_info. An offline region in the runtime's cache file.
See mln_offline_region_info in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type OfflineRegionStatus
type OfflineRegionStatus struct { DownloadState OfflineRegionDownloadState // The resources downloaded so far, tiles included. CompletedResourceCount uint64 // The size of the downloaded resources in bytes, tiles included. CompletedResourceSize uint64 CompletedTileCount uint64 RequiredTileCount uint64 // The size of the downloaded tiles in bytes. CompletedTileSize uint64 // The resources that the region needs, tiles included. Until // required_resource_count_is_precise is true, this is only a lower bound. RequiredResourceCount uint64 RequiredResourceCountIsPrecise bool // Whether the region has downloaded every resource it needs. Complete bool }
OfflineRegionStatus corresponds to mln_offline_region_status. The download progress of an offline region.
See mln_offline_region_status in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
type OfflineTilePyramidRegionDefinition
type OfflineTilePyramidRegionDefinition struct { // The style whose resources the region holds. Maps use the region when they // load the same style URL. StyleURL string Bounds LatLngBounds MinZoom float64 // INFINITY covers every zoom level that the style's sources have. MaxZoom float64 // The pixel ratio of the images to download, such as 2 for dense screens. PixelRatio float32 // Whether the region holds the glyphs of CJK ideographs. IncludeIdeographs bool }
OfflineTilePyramidRegionDefinition corresponds to mln_offline_tile_pyramid_region_definition. An offline region that covers a rectangle of the map.
See mln_offline_tile_pyramid_region_definition in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type OffscreenDescriptor
type OffscreenDescriptor struct{ LogicalSize LogicalSize }
OffscreenDescriptor corresponds to mln_offscreen_descriptor. The image that MapHandle.AttachOffscreen() renders. The session renders it at the map's scale factor.
See mln_offscreen_descriptor in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/offscreen_8h.html
type OffscreenDeviceHandle
type OffscreenDeviceHandle struct { // contains filtered or unexported fields }
OffscreenDeviceHandle corresponds to mln_offscreen_device. A GPU device that the library creates to render maps offscreen.
See mln_offscreen_device in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/base_8h.html
func NewOffscreenDevice
func NewOffscreenDevice(options *OffscreenDeviceOptions) (*OffscreenDeviceHandle, error)
NewOffscreenDevice creates a GPU device for rendering maps offscreen.
MapHandle.AttachOffscreen() creates a device of its own when it gets none. Create one to share it among the sessions on many maps, or to pick a GPU.
In a browser WebGPU build, attach without a device instead.
See mln_offscreen_device_create in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/offscreen_8h.html
Errors:
- StatusUnsupported in a browser WebGPU build, or when the device can't render with client_api.
- StatusNativeError when adapter_index names no GPU, or the platform can't create the device.
func (*OffscreenDeviceHandle) ID
func (handle *OffscreenDeviceHandle) ID() uint64
ID returns the native handle value. It stays readable after the handle is released.
func (*OffscreenDeviceHandle) IsClosed
func (handle *OffscreenDeviceHandle) IsClosed() bool
IsClosed reports whether the binding has accepted a release, dispose, or discard of the handle. A nil handle is closed.
func (*OffscreenDeviceHandle) Release
func (receiver *OffscreenDeviceHandle) Release() error
Release releases an offscreen device.
Render sessions on the device keep working until they detach.
See mln_offscreen_device_release in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/offscreen_8h.html
func (*OffscreenDeviceHandle) String
func (handle *OffscreenDeviceHandle) String() string
String formats the handle as OffscreenDeviceHandle(id=0x<hex>, closed=<true|false>).
type OffscreenDeviceOptions
type OffscreenDeviceOptions struct { // The GPU to use, as an index into the platform's list of GPUs. AdapterIndex *uint32 // Whether the device's sessions take turns in one OpenGL context instead of // having one each. Only an EGL device reads it. SingleContext *bool // The OpenGL API that the device's sessions render with. An EGL device defaults // to OpenGLClientAPIGLES, and takes OpenGLClientAPIGL too on Linux and FreeBSD. // A WGL device takes only OpenGLClientAPIGL, its default, and a WebGL device // only OpenGLClientAPIGLES, its default. Other devices take neither. ClientAPI *OpenGLClientAPI }
OffscreenDeviceOptions corresponds to mln_offscreen_device_options. Options for NewOffscreenDevice().
See mln_offscreen_device_options in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/offscreen_8h.html
type OhosSurfaceDescriptor
type OhosSurfaceDescriptor struct { LogicalSize LogicalSize // Your OHNativeWindow*, or null to name the window by surface_id. Window uintptr // The surface ID of a surface in this process, such as the one that // XComponentController.getXComponentSurfaceId() reports, or 0 to name the // window by window. SurfaceID uint64 }
OhosSurfaceDescriptor corresponds to mln_ohos_surface_descriptor. An OpenHarmony window to present to, for MapHandle.AttachOhosSurface().
Name the window by window or by surface_id. The session takes its own reference to the window, so you can release yours once the call returns.
See mln_ohos_surface_descriptor in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/ohos_8h.html
type OhosSurfaceReplacement
type OhosSurfaceReplacement struct { LogicalSize LogicalSize // Your OHNativeWindow*, or null to name the window by surface_id. Window uintptr // The surface ID of a surface in this process, such as the one that // XComponentController.getXComponentSurfaceId() reports, or 0 to name the // window by window. SurfaceID uint64 }
OhosSurfaceReplacement corresponds to mln_ohos_surface_replacement. A new OpenHarmony window for RenderSessionHandle.SetOhosSurfaceTarget().
Name the window by window or by surface_id. The session takes its own reference to the window, so you can release yours once the call returns.
See mln_ohos_surface_replacement in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/ohos_8h.html
type OpenGLBorrowedTexture
type OpenGLBorrowedTexture struct { // Your texture name. Texture uint32 }
OpenGLBorrowedTexture corresponds to mln_open_gl_borrowed_texture. An OpenGL texture of a borrowed ring.
See mln_open_gl_borrowed_texture in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html
type OpenGLBorrowedTextureDescriptor
type OpenGLBorrowedTextureDescriptor struct { LogicalSize LogicalSize PhysicalWidth uint32 PhysicalHeight uint32 Context OpenGLContextDescriptor Textures []OpenGLBorrowedTexture // The textures' target. It must be GL_TEXTURE_2D. Target uint32 }
OpenGLBorrowedTextureDescriptor corresponds to mln_open_gl_borrowed_texture_descriptor. A ring of your OpenGL textures, for MapHandle.AttachOpenGLBorrowedTexture().
logical_size sets the map's size. physical_width and physical_height give the textures' size in pixels, which is usually logical_size times the map's scale factor. The context must use OpenGLContextOwnershipShared. Each texture must be in your context's share group, with storage of that size. The ring holds up to TextureRingMaxDepth distinct textures.
The session uses the textures until a replacement or release of the target completes, a detach or release of the session completes, or an abandon of it returns.
See mln_open_gl_borrowed_texture_descriptor in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html
type OpenGLBorrowedTextureReplacement
type OpenGLBorrowedTextureReplacement struct { LogicalSize LogicalSize PhysicalWidth uint32 PhysicalHeight uint32 Textures []OpenGLBorrowedTexture }
OpenGLBorrowedTextureReplacement corresponds to mln_open_gl_borrowed_texture_replacement. New OpenGL textures for a borrowed ring, for RenderSessionHandle.SetOpenGLBorrowedTextureTarget().
The members and the textures follow the rules of OpenGLBorrowedTextureDescriptor. The ring keeps its depth, context, and texture target, so give it as many textures as it attached with, in the same share group.
See mln_open_gl_borrowed_texture_replacement in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html
type OpenGLClientAPI
type OpenGLClientAPI uint32
OpenGLClientAPI corresponds to mln_open_gl_client_api. The OpenGL API that a context renders with.
See mln_open_gl_client_api in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html
const ( OpenGLClientAPIUnspecified OpenGLClientAPI = OpenGLClientAPI(C.MLN_OPEN_GL_CLIENT_API_UNSPECIFIED) OpenGLClientAPIGL OpenGLClientAPI = OpenGLClientAPI(C.MLN_OPEN_GL_CLIENT_API_GL) OpenGLClientAPIGLES OpenGLClientAPI = OpenGLClientAPI(C.MLN_OPEN_GL_CLIENT_API_GLES) )
func (OpenGLClientAPI) String
func (value OpenGLClientAPI) String() string
type OpenGLContextDescriptor
type OpenGLContextDescriptor struct { Ownership OpenGLContextOwnership Data OpenGLContextDescriptorData }
OpenGLContextDescriptor corresponds to mln_open_gl_context_descriptor. How a render session gets the OpenGL context that it renders with.
Keep the objects that it names alive until a detach or release of the session completes, or an abandon of it returns.
See mln_open_gl_context_descriptor in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html
type OpenGLContextDescriptorData
type OpenGLContextDescriptorData interface { // contains filtered or unexported methods }
OpenGLContextDescriptorData corresponds to mln_open_gl_context_descriptor_data. The WGL, EGL, or WebGL part of an OpenGL context descriptor.
See mln_open_gl_context_descriptor_data in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html
type OpenGLContextDescriptorDataEGLVariant
type OpenGLContextDescriptorDataEGLVariant struct{ Value EGLContextDescriptor }
type OpenGLContextDescriptorDataWGLVariant
type OpenGLContextDescriptorDataWGLVariant struct{ Value WGLContextDescriptor }
type OpenGLContextDescriptorDataWebGLVariant
type OpenGLContextDescriptorDataWebGLVariant struct{ Value WebGLContextDescriptor }
type OpenGLContextOwnership
type OpenGLContextOwnership uint32
OpenGLContextOwnership corresponds to mln_open_gl_context_ownership. Whether a render session's OpenGL context shares objects with yours.
See mln_open_gl_context_ownership in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html
const ( // The session's context shares objects with your share_context. OpenGLContextOwnership = OpenGLContextOwnership(C.MLN_OPEN_GL_CONTEXT_OWNERSHIP_SHARED) // The session's context shares objects with no other context. OpenGLContextOwnershipDedicated OpenGLContextOwnership = OpenGLContextOwnership(C.MLN_OPEN_GL_CONTEXT_OWNERSHIP_DEDICATED) )
func (OpenGLContextOwnership) String
func (value OpenGLContextOwnership) String() string
type OpenGLContextProviderFlag
type OpenGLContextProviderFlag uint32
OpenGLContextProviderFlag corresponds to mln_open_gl_context_provider_flag. An OpenGL context platform, as a bit in a set.
See mln_open_gl_context_provider_flag in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html
const ( OpenGLContextProviderFlagWGL OpenGLContextProviderFlag = OpenGLContextProviderFlag(C.MLN_OPEN_GL_CONTEXT_PROVIDER_FLAG_WGL) OpenGLContextProviderFlagEGL OpenGLContextProviderFlag = OpenGLContextProviderFlag(C.MLN_OPEN_GL_CONTEXT_PROVIDER_FLAG_EGL) OpenGLContextProviderFlagWebGL OpenGLContextProviderFlag = OpenGLContextProviderFlag(C.MLN_OPEN_GL_CONTEXT_PROVIDER_FLAG_WEB_GL) )
func OpenGLSupportedContextProviderMask
func OpenGLSupportedContextProviderMask() OpenGLContextProviderFlag
OpenGLSupportedContextProviderMask reports the OpenGL context platforms that this build of the library has.
See mln_open_gl_supported_context_provider_mask in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html
func (OpenGLContextProviderFlag) Has
func (value OpenGLContextProviderFlag) Has(flags OpenGLContextProviderFlag) bool
func (OpenGLContextProviderFlag) String
func (value OpenGLContextProviderFlag) String() string
type OpenGLSurfaceDescriptor
type OpenGLSurfaceDescriptor struct { LogicalSize LogicalSize Context OpenGLContextDescriptor // Your EGLSurface with EGL, or your HDC with WGL. WebGL doesn't use it. Surface uintptr }
OpenGLSurfaceDescriptor corresponds to mln_open_gl_surface_descriptor. An OpenGL surface to present to, for MapHandle.AttachOpenGLSurface().
The session uses the surface until a replacement or release of the target completes, a detach or release of the session completes, or an abandon of it returns.
See mln_open_gl_surface_descriptor in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/surface_8h.html
type OpenGLSurfaceReplacement
type OpenGLSurfaceReplacement struct { LogicalSize LogicalSize // Your EGLSurface with EGL, or your HDC with WGL. WebGL doesn't use it, so // leave it null. Surface uintptr }
OpenGLSurfaceReplacement corresponds to mln_open_gl_surface_replacement. A new OpenGL surface for RenderSessionHandle.SetOpenGLSurfaceTarget().
The session presents to it with the context that it attached with. It uses the surface until a replacement or release of the target completes, a detach or release of the session completes, or an abandon of it returns.
See mln_open_gl_surface_replacement in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/surface_8h.html
type OpenGLTextureFrame
type OpenGLTextureFrame struct { Width uint32 Height uint32 ScaleFactor float64 // The texture's index in the descriptor's textures. Slot uint32 Texture uint32 Target uint32 }
OpenGLTextureFrame corresponds to mln_open_gl_texture_frame. The OpenGL texture of an acquired frame.
See mln_open_gl_texture_frame in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html
type OpenGLTextureFrameView
type OpenGLTextureFrameView struct { // contains filtered or unexported fields }
func (OpenGLTextureFrameView) Height
func (view OpenGLTextureFrameView) Height() uint32
func (OpenGLTextureFrameView) ScaleFactor
func (view OpenGLTextureFrameView) ScaleFactor() float64
func (OpenGLTextureFrameView) Slot
func (view OpenGLTextureFrameView) Slot() uint32
func (OpenGLTextureFrameView) Target
func (view OpenGLTextureFrameView) Target() uint32
func (OpenGLTextureFrameView) Texture
func (view OpenGLTextureFrameView) Texture() (uint32, error)
func (OpenGLTextureFrameView) Width
func (view OpenGLTextureFrameView) Width() uint32
type PanMomentum
type PanMomentum struct { // How fast the map's content moved on the screen at release, in logical pixels // per second. The pan moves only when this is set. Velocity *ScreenPoint Decay MomentumDecay }
PanMomentum corresponds to mln_pan_momentum. How a gesture's pan keeps moving the map's content after release.
See mln_pan_momentum in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type PremultipliedRgba8Image
type PremultipliedRgba8Image struct { Width uint32 Height uint32 // The number of bytes from the start of one row to the start of the next, at // least width * 4. Stride uint32 // The rows of pixels, stride bytes apart, from the top row down. Pixels []byte }
PremultipliedRgba8Image corresponds to mln_premultiplied_rgba8_image. An image of 8-bit RGBA pixels whose colors are multiplied by their alpha.
See mln_premultiplied_rgba8_image in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
type ProjectedMeters
type ProjectedMeters struct { Northing float64 Easting float64 }
ProjectedMeters corresponds to mln_projected_meters. A point in the Web Mercator projection, in meters.
See mln_projected_meters in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
func ProjectedMetersForLatLng
func ProjectedMetersForLatLng(coordinate LatLng) (ProjectedMeters, error)
ProjectedMetersForLatLng converts a coordinate to meters in the Web Mercator projection.
See mln_projected_meters_for_lat_lng in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/projection_8h.html
type ProjectionMode
type ProjectionMode struct { Axonometric bool XSkew float64 YSkew float64 }
ProjectionMode corresponds to mln_projection_mode. A map's whole projection mode.
Its members mean the same as those of ProjectionModeOptions.
See mln_projection_mode in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type ProjectionModeOptions
type ProjectionModeOptions struct { // Whether the map draws without perspective. Axonometric *bool XSkew *float64 YSkew *float64 }
ProjectionModeOptions corresponds to mln_projection_mode_options. Settings that skew the map or draw it without perspective.
See mln_projection_mode_options in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type Quaternion
type Quaternion struct { X float64 Y float64 Z float64 W float64 }
Quaternion corresponds to mln_quaternion. A rotation, as a quaternion.
See mln_quaternion in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type QueueLock
type QueueLock struct { Lock func() Unlock func() // contains filtered or unexported fields }
QueueLock corresponds to mln_queue_lock. Your lock on a Vulkan queue that you and a render session both submit to.
The session holds the lock only while it submits or presents to the queue. Set both lock and unlock, or neither when you don't submit to the queue yourself.
It can run on a library thread, and it can't call the library.
See mln_queue_lock in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html
func NewNativeQueueLock
func NewNativeQueueLock(lock, unlock, userData, releaseUserData uintptr) QueueLock
NewNativeQueueLock returns a QueueLock from C values that native code in the host supplies: lock, unlock, userData, and releaseUserData are the members of the C struct that QueueLock presents, which the binding copies unchanged. The first call that carries the QueueLock consumes it. Native code releases userData if it accepts the call, and otherwise the binding calls releaseUserData. A later call returns StatusInvalidState.
type RenderAbandonDisposition
type RenderAbandonDisposition uint32
RenderAbandonDisposition corresponds to mln_render_abandon_disposition. What RenderSessionHandle.Abandon() did with a session's graphics objects.
See mln_render_abandon_disposition in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html
const ( RenderAbandonDispositionClean RenderAbandonDisposition = RenderAbandonDisposition(C.MLN_RENDER_ABANDON_DISPOSITION_CLEAN) // It kept some objects that it couldn't destroy safely. They stay allocated // until the process exits. RenderAbandonDispositionQuarantined RenderAbandonDisposition = RenderAbandonDisposition(C.MLN_RENDER_ABANDON_DISPOSITION_QUARANTINED) )
func (RenderAbandonDisposition) String
func (value RenderAbandonDisposition) String() string
type RenderAbandonResult
type RenderAbandonResult struct { Disposition RenderAbandonDisposition QuarantinedResourceCount uint32 }
RenderAbandonResult corresponds to mln_render_abandon_result. The outcome of RenderSessionHandle.Abandon().
See mln_render_abandon_result in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html
type RenderBackendFlag
type RenderBackendFlag uint32
RenderBackendFlag corresponds to mln_render_backend_flag. A render backend, as a bit in a set.
See mln_render_backend_flag in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/base_8h.html
const ( RenderBackendFlagMetal RenderBackendFlag = RenderBackendFlag(C.MLN_RENDER_BACKEND_FLAG_METAL) RenderBackendFlagVulkan RenderBackendFlag = RenderBackendFlag(C.MLN_RENDER_BACKEND_FLAG_VULKAN) RenderBackendFlagOpenGL RenderBackendFlag = RenderBackendFlag(C.MLN_RENDER_BACKEND_FLAG_OPEN_GL) RenderBackendFlagWebGPU RenderBackendFlag = RenderBackendFlag(C.MLN_RENDER_BACKEND_FLAG_WEB_GPU) )
func SupportedRenderBackendMask
func SupportedRenderBackendMask() RenderBackendFlag
SupportedRenderBackendMask returns the render backends that this build of the library draws with.
See mln_supported_render_backend_mask in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/base_8h.html
func (RenderBackendFlag) Has
func (value RenderBackendFlag) Has(flags RenderBackendFlag) bool
func (RenderBackendFlag) String
func (value RenderBackendFlag) String() string
type RenderDriverKind
type RenderDriverKind uint32
RenderDriverKind corresponds to mln_render_driver_kind. The thread that runs a render session's graphics work.
See mln_render_driver_kind in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html
const ( // A library thread. RenderDriverKindCoreWorker RenderDriverKind = RenderDriverKind(C.MLN_RENDER_DRIVER_CORE_WORKER) // Your thread, when it calls RenderSessionHandle.ServiceDriverWork(). RenderDriverKindCallerGraphicsThread RenderDriverKind = RenderDriverKind(C.MLN_RENDER_DRIVER_CALLER_GRAPHICS_THREAD) )
func (RenderDriverKind) String
func (value RenderDriverKind) String() string
type RenderFrameResult
type RenderFrameResult struct { Disposition RenderResult Token uint64 // The map update that a rendered frame shows. The frame includes a command's // change when this is at least the command's // CommandCompletion.RenderUpdateGeneration. MapUpdateGeneration uint64 Generation uint64 FrameGeneration uint64 NeedsRepaint bool // The camera and extent that a rendered frame shows. View MapView Mode RenderMode }
RenderFrameResult corresponds to mln_render_frame_result. How one frame demand finished.
See mln_render_frame_result in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html
type RenderMode
type RenderMode uint32
RenderMode corresponds to mln_render_mode. Whether a frame drew the map complete, or lacked resources that are still loading.
See mln_render_mode in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
const ( RenderModePartial RenderMode = RenderMode(C.MLN_RENDER_MODE_PARTIAL) RenderModeFull RenderMode = RenderMode(C.MLN_RENDER_MODE_FULL) )
func (RenderMode) String
func (value RenderMode) String() string
type RenderResult
type RenderResult uint32
RenderResult corresponds to mln_render_result. How a frame demand finished.
See mln_render_result in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html
const ( RenderResultRendered RenderResult = RenderResult(C.MLN_RENDER_RESULT_RENDERED) // The map had nothing new to draw. RenderResultNoUpdate RenderResult = RenderResult(C.MLN_RENDER_RESULT_NO_UPDATE) // The target couldn't take a frame, such as while a window is hidden or // destroyed, or after RenderSessionHandle.ReleaseTarget(). Demand a frame again // later. RenderResultTargetNotReady RenderResult = RenderResult(C.MLN_RENDER_RESULT_TARGET_NOT_READY) // A later demand with the same flags replaced this one. RenderResultSuperseded RenderResult = RenderResult(C.MLN_RENDER_RESULT_SUPERSEDED) // The session failed, and RenderSessionHandle.GetFailure() reports why. Once // RenderSessionHandle.Release() completes, you can attach a new session. RenderResultFailed RenderResult = RenderResult(C.MLN_RENDER_RESULT_FAILED) )
func (RenderResult) String
func (value RenderResult) String() string
type RenderSessionAttachOptions
type RenderSessionAttachOptions struct { // The thread that runs the session's graphics work, which depends on the // target: // // - RenderDriverKindCallerGraphicsThread for a shared or dedicated EGL or WGL // context, an existing WebGL context, or a browser's WebGPU device. // - RenderDriverKindCoreWorker for a transferred WebGL canvas, an Android, // OpenHarmony, or Win32 window, a Wayland surface, a ring of Android // hardware buffers, dmabufs, DXGI shared textures, or IOSurfaces, or an // offscreen session. // - Either one for another Metal or Vulkan target. // // An attach with another driver fails with StatusUnsupported. Driver RenderDriverKind // The kinds of GPUSync that you can wait on before you read an acquired frame. // The session uses one of them that its target supports. Zero lets the session // pick a kind that names no object to wait on. ProducerSyncKinds GPUSyncKindFlag // Called when frame results are waiting for // RenderSessionHandle.DrainFrameResults(). It isn't called again until a drain // takes them. FrameWake Wake // Called when the session has something new to draw. Demand a frame at your // next display refresh. It isn't called again until you demand a frame, or // while the session has no target. RedrawWake Wake // Called when a session driven by RenderDriverKindCallerGraphicsThread has work // for RenderSessionHandle.ServiceDriverWork(). It isn't called again until a // service runs. DriverWorkWake Wake // Your lock on the Vulkan queue, when you submit to it yourself. QueueLock QueueLock }
RenderSessionAttachOptions corresponds to mln_render_session_attach_options. Options for attaching a render session to a map.
See mln_render_session_attach_options in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html
type RenderSessionCapabilities
type RenderSessionCapabilities struct { Driver RenderDriverKind // How many textures the session's texture ring has. TextureRingDepth uint32 Flags RenderSessionCapabilityFlag // The kind of GPUSync that AcquiredFrameHandle.WithProducerSync() reports. ProducerSyncKind GPUSyncKind // The kinds of GPUSync that AcquiredFrameHandle.Release() accepts. They depend // on the target and on what the device supports. ConsumerSyncKinds GPUSyncKindFlag }
RenderSessionCapabilities corresponds to mln_render_session_capabilities. What an attached render session supports.
See mln_render_session_capabilities in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html
type RenderSessionCapabilityFlag
type RenderSessionCapabilityFlag uint32
RenderSessionCapabilityFlag corresponds to mln_render_session_capability_flag. Something that a render session can do.
See mln_render_session_capability_flag in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html
const ( // RenderSessionHandle.AcquireFrame() can take the frames it renders. RenderSessionCapabilityFlagFrameAcquisition RenderSessionCapabilityFlag = RenderSessionCapabilityFlag(C.MLN_RENDER_SESSION_CAPABILITY_FRAME_ACQUISITION) // RenderSessionHandle.ReadTexture() can copy its texture to memory. RenderSessionCapabilityFlagReadback RenderSessionCapabilityFlag = RenderSessionCapabilityFlag(C.MLN_RENDER_SESSION_CAPABILITY_READBACK) // It shows frames on a surface. RenderSessionCapabilityFlagPresentation RenderSessionCapabilityFlag = RenderSessionCapabilityFlag(C.MLN_RENDER_SESSION_CAPABILITY_PRESENTATION) )
func (RenderSessionCapabilityFlag) Has
func (value RenderSessionCapabilityFlag) Has(flags RenderSessionCapabilityFlag) bool
func (RenderSessionCapabilityFlag) String
func (value RenderSessionCapabilityFlag) String() string
type RenderSessionHandle
type RenderSessionHandle struct { // contains filtered or unexported fields }
RenderSessionHandle corresponds to mln_render_session. A render session draws a map into a surface or a texture.
See mln_render_session in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/base_8h.html
func (*RenderSessionHandle) Abandon
func (receiver *RenderSessionHandle) Abandon() (RenderAbandonResult, error)
Abandon stops the session right away, without running its pending graphics work.
Use it when the target's graphics objects are going away and a detach can't finish first. Pending work completes with StatusTargetLost, and pending frame demands finish with RenderResultTargetNotReady. Once the call returns, the library no longer uses your graphics objects, and you can attach another session to the map. Release the session afterward.
Abandon keeps the session's OpenGL and WebGPU objects until the process exits, and reports how many it kept. Detach the session instead to free them.
See mln_render_session_abandon in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html
func (*RenderSessionHandle) AcquireFrame
func (receiver *RenderSessionHandle) AcquireFrame() (*AcquiredFrameHandle, error)
AcquireFrame takes the newest rendered frame from the session's texture ring, if one is ready.
Older frames that you haven't acquired are dropped, and the session can render over a frame before you acquire it. While you hold a frame in every texture of the ring, new frames wait until you release one. When no frame is ready, it succeeds and writes the null handle.
See mln_render_session_acquire_frame in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html
Errors:
- StatusUnsupported when the session lacks RenderSessionCapabilityFlagFrameAcquisition.
- StatusTargetLost or StatusNativeError, as RenderSessionSnapshot.FailureStatus reports, when the session has failed.
- StatusInvalidState when you detached, abandoned, released, or disposed the session.
func (*RenderSessionHandle) Barrier
func (receiver *RenderSessionHandle) Barrier() (*Future[struct{}], error)
Barrier ends the session's pending frame demands and waits for its earlier work.
Frame demands that haven't started, including those that wait for a map update, finish with RenderResultNoUpdate.
See mln_render_session_barrier in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html
Errors:
- StatusTargetLost when the session loses its target before the barrier runs.
func (*RenderSessionHandle) Capabilities
func (receiver *RenderSessionHandle) Capabilities() (RenderSessionCapabilities, error)
Capabilities reads what the session supports.
See mln_render_session_get_capabilities in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html
func (*RenderSessionHandle) ClearData
func (receiver *RenderSessionHandle) ClearData() (*Future[struct{}], error)
ClearData clears the data that the session's renderer holds, such as loaded tiles, and draws the map again.
See mln_render_session_clear_data in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html
Errors:
- StatusTargetLost when the session loses its target before the work runs.
func (*RenderSessionHandle) DemandFrame
func (receiver *RenderSessionHandle) DemandFrame(demand FrameDemand) error
DemandFrame asks the session to render a frame.
The frame shows the map commands that you sent before the call, except the changes that an open command group holds back.
You can call it once the attach call returns. While the attach runs, the demand waits for it to complete. Every demand finishes with one frame result that carries its token, and RenderSessionHandle.DrainFrameResults() takes it. A demand without FrameDemandFlagForce replaces each pending demand with the same flags.
See mln_render_session_demand_frame in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html
Errors:
- StatusTargetLost or StatusNativeError, as RenderSessionSnapshot.FailureStatus reports, when the session has failed.
- StatusInvalidState when you detached, abandoned, released, or disposed the session, or discarded a frame from every texture of its ring.
func (*RenderSessionHandle) Detach
func (receiver *RenderSessionHandle) Detach() (*Future[struct{}], error)
Detach detaches the session from its map and frees its graphics objects.
Release every acquired frame first. Pending frame demands finish with RenderResultTargetNotReady. Once the detach completes, the library no longer uses your graphics objects, and you can attach another session to the map. Release the session afterward.
See mln_render_session_detach in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html
Errors:
- StatusTargetLost when the session loses its target before the detach runs.
func (*RenderSessionHandle) Discarding
func (receiver *RenderSessionHandle) Discarding() RenderSessionHandleDiscarding
func (*RenderSessionHandle) Dispose
func (receiver *RenderSessionHandle) Dispose() error
Dispose releases the session in any state, and finishes in the background.
Use it from destructors and finalizers, and RenderSessionHandle.Release() elsewhere. It ends the session as a release does, except that it abandons a session whose frames you hold, which ends those frames. Keep servicing a session driven by RenderDriverKindCallerGraphicsThread until RenderSessionHandle.ServiceDriverWork() no longer accepts it.
See mln_render_session_dispose in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html
func (*RenderSessionHandle) DrainFrameResults
func (receiver *RenderSessionHandle) DrainFrameResults() ([]RenderFrameResult, error)
DrainFrameResults takes the frame results that the session has queued.
When no result is queued, it succeeds and writes the null handle and an empty view.
See mln_render_session_drain_frame_results in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html
func (*RenderSessionHandle) DumpDebugLogs
func (receiver *RenderSessionHandle) DumpDebugLogs() (*Future[struct{}], error)
DumpDebugLogs logs debugging information about the session's renderer.
See mln_render_session_dump_debug_logs in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html
Errors:
- StatusTargetLost when the session loses its target before the work runs.
func (*RenderSessionHandle) GetClusterChildren
func (receiver *RenderSessionHandle) GetClusterChildren(sourceID string, clusterID uint32) (*Future[string], error)
GetClusterChildren reads the children of a cluster in a clustered GeoJSON source.
clusterID is the "cluster_id" property of a cluster feature. The result is a GeoJSON feature collection of the clusters and points that the cluster splits into at the next zoom level.
The query reads the source's data from the session's most recent render attempt, so a change to the data shows once the session tries to render again.
A cluster ID belongs to one version of the source's data. After the data changes, feature queries can return IDs from the earlier version until the source's tiles reload, and such an ID completes with StatusNotFound or names a different cluster. Query the features again for current IDs.
See mln_render_session_get_cluster_children in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/query_8h.html
Errors:
- StatusNotFound when the session's most recent render attempt had no source named sourceID, or the source has no cluster clusterID.
- StatusInvalidArgument when the source isn't a GeoJSON source with clustering turned on.
func (*RenderSessionHandle) GetClusterExpansionZoom
func (receiver *RenderSessionHandle) GetClusterExpansionZoom(sourceID string, clusterID uint32) (*Future[uint32], error)
GetClusterExpansionZoom reads the zoom level at which a cluster of a clustered GeoJSON source splits.
clusterID is the "cluster_id" property of a cluster feature. At the result's zoom level, the cluster splits into two or more clusters or points.
A cluster ID can go out of date as RenderSessionHandle.GetClusterChildren() describes.
See mln_render_session_get_cluster_expansion_zoom in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/query_8h.html
Errors:
- StatusNotFound when the session's most recent render attempt had no source named sourceID, or the source has no cluster clusterID.
- StatusInvalidArgument when the source isn't a GeoJSON source with clustering turned on.
func (*RenderSessionHandle) GetClusterLeaves
func (receiver *RenderSessionHandle) GetClusterLeaves(sourceID string, clusterID uint32, limit uint32, offset uint32) (*Future[string], error)
GetClusterLeaves reads the points in a cluster of a clustered GeoJSON source.
clusterID is the "cluster_id" property of a cluster feature. The result is a GeoJSON feature collection of the original point features. It skips the first offset points and then holds up to limit of them, so a limit of 0 gives an empty collection.
A cluster ID can go out of date as RenderSessionHandle.GetClusterChildren() describes.
See mln_render_session_get_cluster_leaves in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/query_8h.html
Errors:
- StatusNotFound when the session's most recent render attempt had no source named sourceID, or the source has no cluster clusterID.
- StatusInvalidArgument when the source isn't a GeoJSON source with clustering turned on.
func (*RenderSessionHandle) GetFailure
func (receiver *RenderSessionHandle) GetFailure() (string, error)
GetFailure reads the message of the error that made the session fail.
RenderSessionSnapshot.FailureStatus reports the error's status. The message is empty while the session hasn't failed, and doesn't change once it fails.
See mln_render_session_get_failure in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html
func (*RenderSessionHandle) ID
func (handle *RenderSessionHandle) ID() uint64
ID returns the native handle value. It stays readable after the handle is released.
func (*RenderSessionHandle) IsClosed
func (handle *RenderSessionHandle) IsClosed() bool
IsClosed reports whether the binding has accepted a release, dispose, or discard of the handle. A nil handle is closed.
func (*RenderSessionHandle) QueryRenderedFeatures
func (receiver *RenderSessionHandle) QueryRenderedFeatures(geometry RenderedQueryGeometry, options *RenderedFeatureQueryOptions) (*Future[[]RenderedFeature], error)
QueryRenderedFeatures finds the features that the session drew in an area of the screen.
The query reads the last frame that the session rendered. A feature that several layers draw appears once for each layer.
See mln_render_session_query_rendered_features in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/query_8h.html
func (*RenderSessionHandle) QuerySourceFeatures
func (receiver *RenderSessionHandle) QuerySourceFeatures(sourceID string, options *SourceFeatureQueryOptions) (*Future[[]SourceFeature], error)
QuerySourceFeatures finds the features of the source named sourceID.
The query covers only the tiles that the source has loaded for the current view. A source loads tiles only while a visible layer uses it.
See mln_render_session_query_source_features in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/query_8h.html
func (*RenderSessionHandle) ReadTexture
func (receiver *RenderSessionHandle) ReadTexture() (*Future[TextureReadbackResult], error)
ReadTexture reads the pixels of the last frame that the session rendered.
See mln_render_session_read_texture in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html
Errors:
- StatusUnsupported when the session's capabilities lack RenderSessionCapabilityFlagReadback.
- StatusInvalidState when the session hasn't rendered a frame since it attached, resized, or changed its target.
func (*RenderSessionHandle) ReduceMemoryUse
func (receiver *RenderSessionHandle) ReduceMemoryUse() (*Future[struct{}], error)
ReduceMemoryUse frees memory that the session's renderer can rebuild, such as caches.
See mln_render_session_reduce_memory_use in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html
Errors:
- StatusTargetLost when the session loses its target before the work runs.
func (*RenderSessionHandle) Release
func (receiver *RenderSessionHandle) Release() (*Future[struct{}], error)
Release releases the session, detaching it first when it is attached.
Pending frame demands finish with RenderResultTargetNotReady. Once the release completes, the library no longer uses your graphics objects, and you can attach another session to the map.
A session driven by RenderDriverKindCallerGraphicsThread detaches at your next RenderSessionHandle.ServiceDriverWork(), so keep servicing it until the release completes. When the session isn't attached, such as while it attaches or after it fails, or when you release or dispose its map before that service, the release abandons it as RenderSessionHandle.Abandon() does.
See mln_render_session_release in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html
Errors:
- StatusInvalidState while you hold one of the session's acquired frames. Release or discard them first.
func (*RenderSessionHandle) ReleaseTarget
func (receiver *RenderSessionHandle) ReleaseTarget() (*Future[struct{}], error)
ReleaseTarget lets go of the session's surface or textures, and keeps the rest of the session.
Use it when the platform takes a surface away, such as when your app goes to the background. Release every acquired frame first. Frame demands that are still pending, and later ones until you give the session a new target, finish with RenderResultTargetNotReady. Once the release completes, you can destroy the old target. An Android or OpenHarmony window can go away sooner, as MapHandle.AttachAndroidSurface() and MapHandle.AttachOhosSurface() say.
See mln_render_session_release_target in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html
Errors:
- StatusUnsupported when the session renders offscreen or into Android hardware buffers, dmabufs, DXGI shared textures, or IOSurfaces that it allocates.
- StatusUnsupported when the target is a WebGL canvas.
- StatusTargetLost when the session loses its target before the release runs.
func (*RenderSessionHandle) Resize
func (receiver *RenderSessionHandle) Resize(logicalSize LogicalSize) (*Future[CommandCompletion], error)
Resize resizes the session's target and its map.
The session renders at the map's scale factor. Release every acquired frame first.
See mln_render_session_resize in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html
Errors:
- StatusUnsupported when the session renders into a borrowed ring. Give it new textures of the new size instead.
- StatusTargetLost when the session loses its target before the resize applies.
func (*RenderSessionHandle) ServiceDriverWork
func (receiver *RenderSessionHandle) ServiceDriverWork() error
ServiceDriverWork runs the session's ready graphics work on your graphics thread.
Use it with RenderDriverKindCallerGraphicsThread, and call it from the same thread every time. Call it each time RenderSessionAttachOptions.DriverWorkWake is called, even while you demand no frames, until a detach, release, or disposal of the session finishes. It returns once no work is ready.
It accepts a released or disposed session until that release or disposal finishes.
See mln_render_session_service_driver_work in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html
func (*RenderSessionHandle) SetFramePacer
func (receiver *RenderSessionHandle) SetFramePacer(pacer *FramePacerHandle) error
SetFramePacer sets the frame pacer that demands the session's frames.
At the first display refresh after the session has something new to draw, pacer demands a frame without flags and with token 0. One pacer can serve many sessions. A null pacer stops pacing the session. You can call it once the attach call returns.
See mln_render_session_set_frame_pacer in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html
Errors:
- StatusTargetLost or StatusNativeError, as RenderSessionSnapshot.FailureStatus reports, when the session has failed.
- StatusInvalidState when you attached the session with a redraw wake, or detached, abandoned, released, or disposed it.
func (*RenderSessionHandle) SetOhosSurfaceTarget
func (receiver *RenderSessionHandle) SetOhosSurfaceTarget(replacement OhosSurfaceReplacement) (*Future[struct{}], error)
SetOhosSurfaceTarget replaces the OpenHarmony window that the session presents to.
Use it to give the session a window again after RenderSessionHandle.ReleaseTarget(), to move it to another window, or to resize it. Once the replacement completes, the session no longer uses the old window.
See mln_render_session_set_ohos_surface_target in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/ohos_8h.html
Errors:
- StatusInvalidArgument when no surface in this process has OhosSurfaceReplacement.SurfaceID, such as after the platform destroyed it.
- StatusUnsupported when, in a Vulkan build, the new window needs a different color format or pre-rotation support than the old one. Attach a new session instead.
- StatusNativeError when the library can't create the window's surface.
func (*RenderSessionHandle) SetOpenGLBorrowedTextureTarget
func (receiver *RenderSessionHandle) SetOpenGLBorrowedTextureTarget(replacement OpenGLBorrowedTextureReplacement) (*Future[struct{}], error)
SetOpenGLBorrowedTextureTarget replaces the OpenGL textures that a borrowed ring renders into.
Use it to resize the ring, or to give the session textures again after RenderSessionHandle.ReleaseTarget(). Release every acquired frame first. Once the replacement completes, the session no longer uses the old textures.
See mln_render_session_set_open_gl_borrowed_texture_target in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html
func (*RenderSessionHandle) SetOpenGLSurfaceTarget
func (receiver *RenderSessionHandle) SetOpenGLSurfaceTarget(replacement OpenGLSurfaceReplacement) (*Future[struct{}], error)
SetOpenGLSurfaceTarget replaces the OpenGL surface that the session presents to.
Use it to give the session a surface again after RenderSessionHandle.ReleaseTarget(), to move it to another surface, or to resize it. Once the replacement completes, the session no longer uses the old surface.
See mln_render_session_set_open_gl_surface_target in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/surface_8h.html
func (*RenderSessionHandle) SetVulkanBorrowedTextureTarget
func (receiver *RenderSessionHandle) SetVulkanBorrowedTextureTarget(replacement VulkanBorrowedTextureReplacement) (*Future[struct{}], error)
SetVulkanBorrowedTextureTarget replaces the Vulkan images that a borrowed ring renders into.
Use it to resize the ring, or to give the session images again after RenderSessionHandle.ReleaseTarget(). Release every acquired frame first. Once the replacement completes, the session no longer uses the old images.
See mln_render_session_set_vulkan_borrowed_texture_target in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html
func (*RenderSessionHandle) SetVulkanSurfaceTarget
func (receiver *RenderSessionHandle) SetVulkanSurfaceTarget(replacement VulkanSurfaceReplacement) (*Future[struct{}], error)
SetVulkanSurfaceTarget replaces the Vulkan surface that the session presents to.
Use it to give the session a surface again after RenderSessionHandle.ReleaseTarget(), to move it to another surface, or to resize it. Once the replacement completes, the session no longer uses the old surface.
See mln_render_session_set_vulkan_surface_target in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/surface_8h.html
Errors:
- StatusUnsupported when the new surface needs a different color format or pre-rotation support than the old one. Attach a new session instead.
func (*RenderSessionHandle) SetWaylandSurfaceTarget
func (receiver *RenderSessionHandle) SetWaylandSurfaceTarget(replacement WaylandSurfaceReplacement) (*Future[struct{}], error)
SetWaylandSurfaceTarget replaces the Wayland surface that the session presents to.
Use it to give the session a surface again after RenderSessionHandle.ReleaseTarget(), to move it to another surface, or to resize it. Once the replacement completes, the session no longer uses the old surface.
See mln_render_session_set_wayland_surface_target in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/wayland_8h.html
Errors:
- StatusUnsupported when, in a Vulkan build, the new surface needs a different color format than the old one. Attach a new session instead.
- StatusNativeError when the library can't present to the new surface.
func (*RenderSessionHandle) Snapshot
func (receiver *RenderSessionHandle) Snapshot() (RenderSessionSnapshot, error)
Snapshot reads the session's current state.
See mln_render_session_get_snapshot in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html
func (*RenderSessionHandle) String
func (handle *RenderSessionHandle) String() string
String formats the handle as RenderSessionHandle(id=0x<hex>, closed=<true|false>).
type RenderSessionHandleDiscarding
type RenderSessionHandleDiscarding struct { // contains filtered or unexported fields }
func (RenderSessionHandleDiscarding) Resize
func (view RenderSessionHandleDiscarding) Resize(logicalSize LogicalSize) error
type RenderSessionSnapshot
type RenderSessionSnapshot struct { State RenderSessionState // The target's logical size, and the map's scale factor. Extent LogicalExtent Generation uint64 FrameGeneration uint64 AcquiredFrameCount uint32 // StatusOk until the session fails. Then StatusTargetLost when it failed // because it lost its target, or StatusNativeError when it failed for another // reason. FailureStatus Status // Whether the session is attached and has a target to render to. It's false // from when RenderSessionHandle.ReleaseTarget() completes until you give the // session a new target. HasTarget bool }
RenderSessionSnapshot corresponds to mln_render_session_snapshot. The state of a render session at one moment.
See mln_render_session_snapshot in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html
type RenderSessionState
type RenderSessionState uint32
RenderSessionState corresponds to mln_render_session_state. Where a render session is in its life.
See mln_render_session_state in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html
const ( RenderSessionStateAttaching RenderSessionState = RenderSessionState(C.MLN_RENDER_SESSION_STATE_ATTACHING) RenderSessionStateAttached RenderSessionState = RenderSessionState(C.MLN_RENDER_SESSION_STATE_ATTACHED) RenderSessionStateDetaching RenderSessionState = RenderSessionState(C.MLN_RENDER_SESSION_STATE_DETACHING) RenderSessionStateDetached RenderSessionState = RenderSessionState(C.MLN_RENDER_SESSION_STATE_DETACHED) RenderSessionStateFailed RenderSessionState = RenderSessionState(C.MLN_RENDER_SESSION_STATE_FAILED) RenderSessionStateAbandoned RenderSessionState = RenderSessionState(C.MLN_RENDER_SESSION_STATE_ABANDONED) )
func (RenderSessionState) String
func (value RenderSessionState) String() string
type RenderedFeature
type RenderedFeature struct { // The feature, as a GeoJSON feature. Feature string // The layer that drew the feature. LayerID string SourceID string // The feature's source layer, or empty when its source has none. SourceLayerID string // The feature's state, as a JSON object. State string }
RenderedFeature corresponds to mln_rendered_feature. A feature that a rendered feature query found.
See mln_rendered_feature in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/query_8h.html
type RenderedFeatureQueryOptions
type RenderedFeatureQueryOptions struct { // The layers to query. Without them, the query covers every layer. LayerIDs []string // A [filter](https://maplibre.org/maplibre-style-spec/expressions/) that each // feature must match. Empty matches every feature. Filter string }
RenderedFeatureQueryOptions corresponds to mln_rendered_feature_query_options. Options for a rendered feature query.
See mln_rendered_feature_query_options in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/query_8h.html
type RenderedQueryGeometry
type RenderedQueryGeometry interface { // contains filtered or unexported methods }
RenderedQueryGeometry corresponds to mln_rendered_query_geometry. The screen area that a rendered feature query covers.
See mln_rendered_query_geometry in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/query_8h.html
type RenderedQueryGeometryBoxVariant
type RenderedQueryGeometryBoxVariant struct{ Value ScreenBox }
type RenderedQueryGeometryLineStringVariant
type RenderedQueryGeometryLineStringVariant struct{ Value ScreenLineString }
type RenderedQueryGeometryPointVariant
type RenderedQueryGeometryPointVariant struct{ Value ScreenPoint }
type RenderingStats
type RenderingStats struct { // The time that the frame took to encode, in milliseconds. EncodingTimeMs float64 // The time that the frame took to render, in milliseconds. RenderingTimeMs float64 // The frames rendered so far. FrameCount int64 // The draw calls in the frame. DrawCallCount int64 // The draw calls in every frame so far. TotalDrawCallCount int64 }
RenderingStats corresponds to mln_rendering_stats. Statistics about the frames that a map renders.
See mln_rendering_stats in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
type ResourceErrorReason
type ResourceErrorReason uint32
ResourceErrorReason corresponds to mln_resource_error_reason. Why a resource request failed.
See mln_resource_error_reason in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
const ( // A reason that no other value names. ResourceErrorReasonOther ResourceErrorReason = ResourceErrorReason(C.MLN_RESOURCE_ERROR_REASON_OTHER) ResourceErrorReasonNotFound ResourceErrorReason = ResourceErrorReason(C.MLN_RESOURCE_ERROR_REASON_NOT_FOUND) // The server reported an error. ResourceErrorReasonServer ResourceErrorReason = ResourceErrorReason(C.MLN_RESOURCE_ERROR_REASON_SERVER) // The server couldn't be reached. ResourceErrorReasonConnection ResourceErrorReason = ResourceErrorReason(C.MLN_RESOURCE_ERROR_REASON_CONNECTION) ResourceErrorReasonRateLimit ResourceErrorReason = ResourceErrorReason(C.MLN_RESOURCE_ERROR_REASON_RATE_LIMIT) )
func (ResourceErrorReason) String
func (value ResourceErrorReason) String() string
type ResourceKind
type ResourceKind uint32
ResourceKind corresponds to mln_resource_kind. The kind of a resource that the library loads.
See mln_resource_kind in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
const ( ResourceKindUnknown ResourceKind = ResourceKind(C.MLN_RESOURCE_KIND_UNKNOWN) ResourceKindStyle ResourceKind = ResourceKind(C.MLN_RESOURCE_KIND_STYLE) ResourceKindSource ResourceKind = ResourceKind(C.MLN_RESOURCE_KIND_SOURCE) ResourceKindTile ResourceKind = ResourceKind(C.MLN_RESOURCE_KIND_TILE) ResourceKindGlyphs ResourceKind = ResourceKind(C.MLN_RESOURCE_KIND_GLYPHS) ResourceKindSpriteImage ResourceKind = ResourceKind(C.MLN_RESOURCE_KIND_SPRITE_IMAGE) ResourceKindSpriteJSON ResourceKind = ResourceKind(C.MLN_RESOURCE_KIND_SPRITE_JSON) ResourceKindImage ResourceKind = ResourceKind(C.MLN_RESOURCE_KIND_IMAGE) )
func (ResourceKind) String
func (value ResourceKind) String() string
type ResourceKindFlag
type ResourceKindFlag uint32
ResourceKindFlag corresponds to mln_resource_kind_flag. A resource kind, as a bit in a set.
See mln_resource_kind_flag in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
const ( ResourceKindFlagUnknown ResourceKindFlag = ResourceKindFlag(C.MLN_RESOURCE_KIND_FLAG_UNKNOWN) ResourceKindFlagStyle ResourceKindFlag = ResourceKindFlag(C.MLN_RESOURCE_KIND_FLAG_STYLE) ResourceKindFlagSource ResourceKindFlag = ResourceKindFlag(C.MLN_RESOURCE_KIND_FLAG_SOURCE) ResourceKindFlagTile ResourceKindFlag = ResourceKindFlag(C.MLN_RESOURCE_KIND_FLAG_TILE) ResourceKindFlagGlyphs ResourceKindFlag = ResourceKindFlag(C.MLN_RESOURCE_KIND_FLAG_GLYPHS) ResourceKindFlagSpriteImage ResourceKindFlag = ResourceKindFlag(C.MLN_RESOURCE_KIND_FLAG_SPRITE_IMAGE) ResourceKindFlagSpriteJSON ResourceKindFlag = ResourceKindFlag(C.MLN_RESOURCE_KIND_FLAG_SPRITE_JSON) ResourceKindFlagImage ResourceKindFlag = ResourceKindFlag(C.MLN_RESOURCE_KIND_FLAG_IMAGE) ResourceKindFlagAll ResourceKindFlag = ResourceKindFlag(C.MLN_RESOURCE_KIND_FLAG_ALL) )
func (ResourceKindFlag) Has
func (value ResourceKindFlag) Has(flags ResourceKindFlag) bool
func (ResourceKindFlag) String
func (value ResourceKindFlag) String() string
type ResourceLoadingMethod
type ResourceLoadingMethod uint32
ResourceLoadingMethod corresponds to mln_resource_loading_method. Where a request may load its resource from.
See mln_resource_loading_method in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
const ( // The cache or the network. ResourceLoadingMethodAll ResourceLoadingMethod = ResourceLoadingMethod(C.MLN_RESOURCE_LOADING_METHOD_ALL) ResourceLoadingMethodCacheOnly ResourceLoadingMethod = ResourceLoadingMethod(C.MLN_RESOURCE_LOADING_METHOD_CACHE_ONLY) ResourceLoadingMethodNetworkOnly ResourceLoadingMethod = ResourceLoadingMethod(C.MLN_RESOURCE_LOADING_METHOD_NETWORK_ONLY) )
func (ResourceLoadingMethod) String
func (value ResourceLoadingMethod) String() string
type ResourcePriority
type ResourcePriority uint32
ResourcePriority corresponds to mln_resource_priority. The priority of a resource request.
See mln_resource_priority in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
const ( ResourcePriorityRegular ResourcePriority = ResourcePriority(C.MLN_RESOURCE_PRIORITY_REGULAR) ResourcePriorityLow ResourcePriority = ResourcePriority(C.MLN_RESOURCE_PRIORITY_LOW) )
func (ResourcePriority) String
func (value ResourcePriority) String() string
type ResourceProvider
type ResourceProvider struct { // The requests that the provider serves. Without routes, it serves every // network request. Routes []ResourceRoute Callback func(request ResourceRequestInfo, handle *ResourceRequestHandle) }
ResourceProvider corresponds to mln_resource_provider. A resource provider, for RuntimeHandle.SetResourceProvider().
See mln_resource_provider in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
type ResourceRange
type ResourceRange struct { Start uint64 End uint64 }
ResourceRange corresponds to mln_resource_range. The bytes from start to end of a resource, both included.
See mln_resource_range in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
type ResourceRequestCancelHandler
type ResourceRequestCancelHandler struct{ Callback func() }
ResourceRequestCancelHandler corresponds to mln_resource_request_cancel_handler. A cancel callback, for ResourceRequestHandle.SetCancelCallback().
See mln_resource_request_cancel_handler in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
type ResourceRequestHandle
type ResourceRequestHandle struct { // contains filtered or unexported fields }
ResourceRequestHandle corresponds to mln_resource_request. A resource load that a resource provider answers.
See mln_resource_request in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/base_8h.html
func (*ResourceRequestHandle) Complete
func (receiver *ResourceRequestHandle) Complete(response ResourceResponse) error
Complete answers a resource request.
A failed answer fails the request with ResourceErrorReasonOther, as ResourceRequestHandle.Release() does.
See mln_resource_request_complete in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
Errors:
- StatusInvalidState when the library cancelled the request.
func (*ResourceRequestHandle) ID
func (handle *ResourceRequestHandle) ID() uint64
ID returns the native handle value. It stays readable after the handle is released.
func (*ResourceRequestHandle) IsCancelled
func (receiver *ResourceRequestHandle) IsCancelled() (bool, error)
IsCancelled reads whether the library cancelled a resource request.
See mln_resource_request_is_cancelled in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
func (*ResourceRequestHandle) IsClosed
func (handle *ResourceRequestHandle) IsClosed() bool
IsClosed reports whether the binding has accepted a release, dispose, or discard of the handle. A nil handle is closed.
func (*ResourceRequestHandle) PassThrough
func (receiver *ResourceRequestHandle) PassThrough() error
PassThrough hands a resource request back to the library to load as usual.
A failed call fails the request with ResourceErrorReasonOther, as ResourceRequestHandle.Release() does.
See mln_resource_request_pass_through in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
Errors:
- StatusInvalidState when the library cancelled the request.
func (*ResourceRequestHandle) Release
func (receiver *ResourceRequestHandle) Release() error
Release releases a resource request.
Releasing a request without an answer fails it with ResourceErrorReasonOther.
See mln_resource_request_release in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
func (*ResourceRequestHandle) SetCancelCallback
func (receiver *ResourceRequestHandle) SetCancelCallback(handler ResourceRequestCancelHandler) (bool, error)
SetCancelCallback calls a callback when the library cancels a resource request.
The callback never runs after the request is answered. A request takes one cancel callback. When the library has already cancelled the request, the call reports that instead and the callback never runs.
See mln_resource_request_set_cancel_callback in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
func (*ResourceRequestHandle) String
func (handle *ResourceRequestHandle) String() string
String formats the handle as ResourceRequestHandle(id=0x<hex>, closed=<true|false>).
type ResourceRequestInfo
type ResourceRequestInfo struct { // The URL as the style names it. RequestedURL string // The URL to load, after the library expands any shorthand in requested_url and // before any resource transform. Routes match this URL. ResolvedURL string Kind ResourceKind LoadingMethod ResourceLoadingMethod Priority ResourcePriority Usage ResourceUsage StoragePolicy ResourceStoragePolicy // The only bytes of the resource that the request wants. Range *ResourceRange PriorModifiedUnixMs *int64 PriorExpiresUnixMs *int64 // Empty when the earlier copy has no ETag. PriorEtag string PriorData []byte }
ResourceRequestInfo corresponds to mln_resource_request_info. A request that a resource provider serves.
When the cache holds an earlier copy of the resource, the prior_ fields describe it.
See mln_resource_request_info in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
type ResourceResponse
type ResourceResponse struct { Status ResourceResponseStatus // Why the request failed, for ResourceResponseStatusError. ErrorReason ResourceErrorReason // The resource, for ResourceResponseStatusOk. Bytes []byte // A description of the error, for ResourceResponseStatusError. ErrorMessage string // Whether the library must request the resource again before it reuses this // copy. MustRevalidate bool ModifiedUnixMs *int64 ExpiresUnixMs *int64 // Empty when the resource has no ETag. Etag string // When to retry, for ResourceResponseStatusError. RetryAfterUnixMs *int64 }
ResourceResponse corresponds to mln_resource_response. The answer to a resource request.
See mln_resource_response in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
type ResourceResponseStatus
type ResourceResponseStatus uint32
ResourceResponseStatus corresponds to mln_resource_response_status. The outcome of a resource request.
See mln_resource_response_status in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
const ( ResourceResponseStatusOk ResourceResponseStatus = ResourceResponseStatus(C.MLN_RESOURCE_RESPONSE_STATUS_OK) ResourceResponseStatusError ResourceResponseStatus = ResourceResponseStatus(C.MLN_RESOURCE_RESPONSE_STATUS_ERROR) // The resource exists and is empty. ResourceResponseStatusNoContent ResourceResponseStatus = ResourceResponseStatus(C.MLN_RESOURCE_RESPONSE_STATUS_NO_CONTENT) // The earlier copy that the request's prior_ fields describe is current. ResourceResponseStatusNotModified ResourceResponseStatus = ResourceResponseStatus(C.MLN_RESOURCE_RESPONSE_STATUS_NOT_MODIFIED) )
func (ResourceResponseStatus) String
func (value ResourceResponseStatus) String() string
type ResourceRoute
type ResourceRoute struct { // The kinds of resource that the route covers. Zero covers every kind. Kinds ResourceKindFlag Flags URLMatchFlag URL string }
ResourceRoute corresponds to mln_resource_route. The requests that a resource provider serves.
See mln_resource_route in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
type ResourceStoragePolicy
type ResourceStoragePolicy uint32
ResourceStoragePolicy corresponds to mln_resource_storage_policy. Whether the library keeps a loaded resource in its cache.
See mln_resource_storage_policy in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
const ( ResourceStoragePolicyPermanent ResourceStoragePolicy = ResourceStoragePolicy(C.MLN_RESOURCE_STORAGE_POLICY_PERMANENT) ResourceStoragePolicyVolatile ResourceStoragePolicy = ResourceStoragePolicy(C.MLN_RESOURCE_STORAGE_POLICY_VOLATILE) )
func (ResourceStoragePolicy) String
func (value ResourceStoragePolicy) String() string
type ResourceTransform
type ResourceTransform struct { // The first rule that matches a request adds its parameters, and no other. A // request that no rule matches keeps its URL. Rules []ResourceTransformRule Callback func(kind ResourceKind, url string, request *ResourceTransformRequestHandle) }
ResourceTransform corresponds to mln_resource_transform. How to rewrite request URLs, for RuntimeHandle.SetResourceTransform().
Set either callback or rules, not both.
See mln_resource_transform in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
type ResourceTransformError
type ResourceTransformError struct { Reason ResourceErrorReason Message string // When to retry, for ResourceErrorReasonRateLimit. RetryAfterUnixMs *int64 }
ResourceTransformError corresponds to mln_resource_transform_error. Why a resource transform fails a request.
See mln_resource_transform_error in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
type ResourceTransformRequestHandle
type ResourceTransformRequestHandle struct { // contains filtered or unexported fields }
ResourceTransformRequestHandle corresponds to mln_resource_transform_request. A URL rewrite that a resource transform answers with the URL to load.
See mln_resource_transform_request in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/base_8h.html
func (*ResourceTransformRequestHandle) Complete
func (receiver *ResourceTransformRequestHandle) Complete(url string) error
Complete answers a resource transform request with the URL to load instead.
url must not be empty. A failed answer fails the request with ResourceErrorReasonOther, as ResourceTransformRequestHandle.Release() does.
See mln_resource_transform_request_complete in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
func (*ResourceTransformRequestHandle) Fail
func (receiver *ResourceTransformRequestHandle) Fail(error ResourceTransformError) error
Fail fails a resource transform request without sending it.
The library retries a request that failed for a reason it retries, such as ResourceErrorReasonConnection, and the retry calls the transform again. When this call fails, the request fails with ResourceErrorReasonOther, as ResourceTransformRequestHandle.Release() does.
See mln_resource_transform_request_fail in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
func (*ResourceTransformRequestHandle) ID
func (handle *ResourceTransformRequestHandle) ID() uint64
ID returns the native handle value. It stays readable after the handle is released.
func (*ResourceTransformRequestHandle) IsClosed
func (handle *ResourceTransformRequestHandle) IsClosed() bool
IsClosed reports whether the binding has accepted a release, dispose, or discard of the handle. A nil handle is closed.
func (*ResourceTransformRequestHandle) Release
func (receiver *ResourceTransformRequestHandle) Release() error
Release releases a resource transform request.
Releasing a request without an answer fails it with ResourceErrorReasonOther.
See mln_resource_transform_request_release in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
func (*ResourceTransformRequestHandle) String
func (handle *ResourceTransformRequestHandle) String() string
String formats the handle as ResourceTransformRequestHandle(id=0x<hex>, closed=<true|false>).
type ResourceTransformRule
type ResourceTransformRule struct { // The kinds of resource that the rule covers. Zero covers every kind. Kinds ResourceKindFlag Flags URLMatchFlag URL string Parameters []URLQueryParameter }
ResourceTransformRule corresponds to mln_resource_transform_rule. Query parameters to add to the URLs of requests that match a pattern.
The library adds the parameters, in order, at the end of the URL's query and before any fragment. It keeps the parameters that the URL already has, even one with the same name.
See mln_resource_transform_rule in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
type ResourceUsage
type ResourceUsage uint32
ResourceUsage corresponds to mln_resource_usage. Whether a request loads a resource for a map or an offline region.
See mln_resource_usage in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
const ( ResourceUsageOnline ResourceUsage = ResourceUsage(C.MLN_RESOURCE_USAGE_ONLINE) ResourceUsageOffline ResourceUsage = ResourceUsage(C.MLN_RESOURCE_USAGE_OFFLINE) )
func (ResourceUsage) String
func (value ResourceUsage) String() string
type RuntimeEvent
type RuntimeEvent struct { Type RuntimeEventType SourceType RuntimeEventSourceType // The runtime or map that raised the event, as source_type says. Source uint64 // For a map event, a map snapshot with this generation or a later one includes // what the event reports. Zero for a runtime event. Generation uint64 // The error's text for an event that reports a failure, or empty. Message string Payload RuntimeEventPayload }
RuntimeEvent corresponds to mln_runtime_event. An event that a runtime or one of its maps raised.
See mln_runtime_event in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
type RuntimeEventCameraChange
type RuntimeEventCameraChange struct { Mode CameraChangeMode Source CameraChangeSource }
RuntimeEventCameraChange corresponds to mln_runtime_event_camera_change. The details of RuntimeEventTypeMapCameraWillChange and RuntimeEventTypeMapCameraDidChange.
See mln_runtime_event_camera_change in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
type RuntimeEventFlag
type RuntimeEventFlag uint64
RuntimeEventFlag corresponds to mln_runtime_event_flag. An event type, as a bit in a set.
See mln_runtime_event_flag in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
const ( RuntimeEventFlagNone RuntimeEventFlag = RuntimeEventFlag(C.MLN_RUNTIME_EVENT_FLAG_NONE) RuntimeEventFlagMapCameraWillChange RuntimeEventFlag = RuntimeEventFlag(C.MLN_RUNTIME_EVENT_FLAG_MAP_CAMERA_WILL_CHANGE) RuntimeEventFlagMapCameraIsChanging RuntimeEventFlag = RuntimeEventFlag(C.MLN_RUNTIME_EVENT_FLAG_MAP_CAMERA_IS_CHANGING) RuntimeEventFlagMapCameraDidChange RuntimeEventFlag = RuntimeEventFlag(C.MLN_RUNTIME_EVENT_FLAG_MAP_CAMERA_DID_CHANGE) RuntimeEventFlagMapStyleLoaded RuntimeEventFlag = RuntimeEventFlag(C.MLN_RUNTIME_EVENT_FLAG_MAP_STYLE_LOADED) RuntimeEventFlagMapLoadingStarted RuntimeEventFlag = RuntimeEventFlag(C.MLN_RUNTIME_EVENT_FLAG_MAP_LOADING_STARTED) RuntimeEventFlagMapLoadingFinished RuntimeEventFlag = RuntimeEventFlag(C.MLN_RUNTIME_EVENT_FLAG_MAP_LOADING_FINISHED) RuntimeEventFlagMapLoadingFailed RuntimeEventFlag = RuntimeEventFlag(C.MLN_RUNTIME_EVENT_FLAG_MAP_LOADING_FAILED) RuntimeEventFlagMapIdle RuntimeEventFlag = RuntimeEventFlag(C.MLN_RUNTIME_EVENT_FLAG_MAP_IDLE) RuntimeEventFlagMapRenderError RuntimeEventFlag = RuntimeEventFlag(C.MLN_RUNTIME_EVENT_FLAG_MAP_RENDER_ERROR) RuntimeEventFlagMapRenderFrameStarted RuntimeEventFlag = RuntimeEventFlag(C.MLN_RUNTIME_EVENT_FLAG_MAP_RENDER_FRAME_STARTED) RuntimeEventFlagMapRenderFrameFinished RuntimeEventFlag = RuntimeEventFlag(C.MLN_RUNTIME_EVENT_FLAG_MAP_RENDER_FRAME_FINISHED) RuntimeEventFlagMapRenderMapStarted RuntimeEventFlag = RuntimeEventFlag(C.MLN_RUNTIME_EVENT_FLAG_MAP_RENDER_MAP_STARTED) RuntimeEventFlagMapRenderMapFinished RuntimeEventFlag = RuntimeEventFlag(C.MLN_RUNTIME_EVENT_FLAG_MAP_RENDER_MAP_FINISHED) RuntimeEventFlagMapStyleImageMissing RuntimeEventFlag = RuntimeEventFlag(C.MLN_RUNTIME_EVENT_FLAG_MAP_STYLE_IMAGE_MISSING) RuntimeEventFlagMapTileAction RuntimeEventFlag = RuntimeEventFlag(C.MLN_RUNTIME_EVENT_FLAG_MAP_TILE_ACTION) RuntimeEventFlagMapSourceChanged RuntimeEventFlag = RuntimeEventFlag(C.MLN_RUNTIME_EVENT_FLAG_MAP_SOURCE_CHANGED) RuntimeEventFlagOfflineRegionStatusChanged RuntimeEventFlag = RuntimeEventFlag(C.MLN_RUNTIME_EVENT_FLAG_OFFLINE_REGION_STATUS_CHANGED) RuntimeEventFlagOfflineRegionResponseError RuntimeEventFlag = RuntimeEventFlag(C.MLN_RUNTIME_EVENT_FLAG_OFFLINE_REGION_RESPONSE_ERROR) RuntimeEventFlagOfflineRegionTileCountLimitExceeded RuntimeEventFlag = RuntimeEventFlag(C.MLN_RUNTIME_EVENT_FLAG_OFFLINE_REGION_TILE_COUNT_LIMIT_EXCEEDED) RuntimeEventFlagMapGlyphsRequested RuntimeEventFlag = RuntimeEventFlag(C.MLN_RUNTIME_EVENT_FLAG_MAP_GLYPHS_REQUESTED) RuntimeEventFlagMapGlyphsLoaded RuntimeEventFlag = RuntimeEventFlag(C.MLN_RUNTIME_EVENT_FLAG_MAP_GLYPHS_LOADED) RuntimeEventFlagMapGlyphsError RuntimeEventFlag = RuntimeEventFlag(C.MLN_RUNTIME_EVENT_FLAG_MAP_GLYPHS_ERROR) RuntimeEventFlagMapSpriteRequested RuntimeEventFlag = RuntimeEventFlag(C.MLN_RUNTIME_EVENT_FLAG_MAP_SPRITE_REQUESTED) RuntimeEventFlagMapSpriteLoaded RuntimeEventFlag = RuntimeEventFlag(C.MLN_RUNTIME_EVENT_FLAG_MAP_SPRITE_LOADED) RuntimeEventFlagMapSpriteError RuntimeEventFlag = RuntimeEventFlag(C.MLN_RUNTIME_EVENT_FLAG_MAP_SPRITE_ERROR) RuntimeEventFlagAllMapEvents RuntimeEventFlag = RuntimeEventFlag(C.MLN_RUNTIME_EVENT_FLAG_ALL_MAP_EVENTS) RuntimeEventFlagAllRuntimeEvents RuntimeEventFlag = RuntimeEventFlag(C.MLN_RUNTIME_EVENT_FLAG_ALL_RUNTIME_EVENTS) RuntimeEventFlagAll RuntimeEventFlag = RuntimeEventFlag(C.MLN_RUNTIME_EVENT_FLAG_ALL) )
func (RuntimeEventFlag) Has
func (value RuntimeEventFlag) Has(flags RuntimeEventFlag) bool
func (RuntimeEventFlag) String
func (value RuntimeEventFlag) String() string
type RuntimeEventGlyphs
type RuntimeEventGlyphs struct { // The fonts that the glyphs come from, in order of preference. FontStack []string First uint32 Last uint32 FontFace bool }
RuntimeEventGlyphs corresponds to mln_runtime_event_glyphs. The details of a glyph event.
The event covers the glyphs from first to last, both included.
See mln_runtime_event_glyphs in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
type RuntimeEventHandler
type RuntimeEventHandler struct{ Callback func(events []RuntimeEvent) }
RuntimeEventHandler corresponds to mln_runtime_event_handler. An event callback, for RuntimeHandle.SetEventHandler().
See mln_runtime_event_handler in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
type RuntimeEventLoadingFailed
type RuntimeEventLoadingFailed struct{ Error MapLoadError }
RuntimeEventLoadingFailed corresponds to mln_runtime_event_loading_failed. The details of RuntimeEventTypeMapLoadingFailed.
See mln_runtime_event_loading_failed in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
type RuntimeEventOfflineRegionResponseError
type RuntimeEventOfflineRegionResponseError struct { RegionID int64 Reason ResourceErrorReason }
RuntimeEventOfflineRegionResponseError corresponds to mln_runtime_event_offline_region_response_error. The details of RuntimeEventTypeOfflineRegionResponseError.
See mln_runtime_event_offline_region_response_error in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
type RuntimeEventOfflineRegionStatus
type RuntimeEventOfflineRegionStatus struct { RegionID int64 Status OfflineRegionStatus }
RuntimeEventOfflineRegionStatus corresponds to mln_runtime_event_offline_region_status. The details of RuntimeEventTypeOfflineRegionStatusChanged.
See mln_runtime_event_offline_region_status in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
type RuntimeEventOfflineRegionTileCountLimit
type RuntimeEventOfflineRegionTileCountLimit struct { RegionID int64 // The number of demo server tiles that the cache file's offline regions may // hold together. Limit uint64 }
RuntimeEventOfflineRegionTileCountLimit corresponds to mln_runtime_event_offline_region_tile_count_limit. The details of RuntimeEventTypeOfflineRegionTileCountLimitExceeded.
See mln_runtime_event_offline_region_tile_count_limit in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
type RuntimeEventPayload
type RuntimeEventPayload interface { // contains filtered or unexported methods }
RuntimeEventPayload corresponds to mln_runtime_event_payload. The details of an event, in the member that its payload_type names.
See mln_runtime_event_payload in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
type RuntimeEventPayloadCameraChangeVariant
type RuntimeEventPayloadCameraChangeVariant struct{ Value RuntimeEventCameraChange }
type RuntimeEventPayloadGlyphsVariant
type RuntimeEventPayloadGlyphsVariant struct{ Value RuntimeEventGlyphs }
type RuntimeEventPayloadLoadingFailedVariant
type RuntimeEventPayloadLoadingFailedVariant struct{ Value RuntimeEventLoadingFailed }
type RuntimeEventPayloadOfflineRegionResponseErrorVariant
type RuntimeEventPayloadOfflineRegionResponseErrorVariant struct { Value RuntimeEventOfflineRegionResponseError }
type RuntimeEventPayloadOfflineRegionStatusVariant
type RuntimeEventPayloadOfflineRegionStatusVariant struct { Value RuntimeEventOfflineRegionStatus }
type RuntimeEventPayloadOfflineRegionTileCountLimitVariant
type RuntimeEventPayloadOfflineRegionTileCountLimitVariant struct { Value RuntimeEventOfflineRegionTileCountLimit }
type RuntimeEventPayloadRenderFrameVariant
type RuntimeEventPayloadRenderFrameVariant struct{ Value RuntimeEventRenderFrame }
type RuntimeEventPayloadSourceChangedVariant
type RuntimeEventPayloadSourceChangedVariant struct{ Value RuntimeEventSourceChanged }
type RuntimeEventPayloadSpriteVariant
type RuntimeEventPayloadSpriteVariant struct{ Value RuntimeEventSprite }
type RuntimeEventPayloadStyleImageVariant
type RuntimeEventPayloadStyleImageVariant struct{ Value RuntimeEventStyleImage }
type RuntimeEventPayloadTileActionVariant
type RuntimeEventPayloadTileActionVariant struct{ Value RuntimeEventTileAction }
type RuntimeEventRenderFrame
type RuntimeEventRenderFrame struct { Mode RenderMode NeedsRepaint bool PlacementChanged bool Stats RenderingStats }
RuntimeEventRenderFrame corresponds to mln_runtime_event_render_frame. The details of RuntimeEventTypeMapRenderFrameFinished.
See mln_runtime_event_render_frame in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
type RuntimeEventSourceChanged
type RuntimeEventSourceChanged struct{ SourceID string }
RuntimeEventSourceChanged corresponds to mln_runtime_event_source_changed. The details of RuntimeEventTypeMapSourceChanged.
See mln_runtime_event_source_changed in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
type RuntimeEventSourceType
type RuntimeEventSourceType uint32
RuntimeEventSourceType corresponds to mln_runtime_event_source_type. The kind of handle that raised an event.
See mln_runtime_event_source_type in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
const ( RuntimeEventSourceTypeRuntime RuntimeEventSourceType = RuntimeEventSourceType(C.MLN_RUNTIME_EVENT_SOURCE_RUNTIME) RuntimeEventSourceTypeMap RuntimeEventSourceType = RuntimeEventSourceType(C.MLN_RUNTIME_EVENT_SOURCE_MAP) )
func (RuntimeEventSourceType) String
func (value RuntimeEventSourceType) String() string
type RuntimeEventSprite
type RuntimeEventSprite struct { ID string URL string }
RuntimeEventSprite corresponds to mln_runtime_event_sprite. The details of a sprite event.
id and url are both empty when the style has no sprite.
See mln_runtime_event_sprite in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
type RuntimeEventStyleImage
type RuntimeEventStyleImage struct{ ImageID string }
RuntimeEventStyleImage corresponds to mln_runtime_event_style_image. The details of RuntimeEventTypeMapStyleImageMissing.
See mln_runtime_event_style_image in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
type RuntimeEventTileAction
type RuntimeEventTileAction struct { // The source that the tile belongs to. SourceID string Operation TileOperation TileID TileID }
RuntimeEventTileAction corresponds to mln_runtime_event_tile_action. The details of RuntimeEventTypeMapTileAction.
See mln_runtime_event_tile_action in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
type RuntimeEventType
type RuntimeEventType uint32
RuntimeEventType corresponds to mln_runtime_event_type. The kind of an event.
Only maps in MapModeContinuous raise RuntimeEventTypeMapLoadingFinished, RuntimeEventTypeMapIdle, and the render frame and render map events. Offline region events come only for the regions and types that RuntimeHandle.SetOfflineRegionObserved() selects.
See mln_runtime_event_type in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
const ( RuntimeEventTypeMapCameraWillChange RuntimeEventType = RuntimeEventType(C.MLN_RUNTIME_EVENT_MAP_CAMERA_WILL_CHANGE) RuntimeEventTypeMapCameraIsChanging RuntimeEventType = RuntimeEventType(C.MLN_RUNTIME_EVENT_MAP_CAMERA_IS_CHANGING) RuntimeEventTypeMapCameraDidChange RuntimeEventType = RuntimeEventType(C.MLN_RUNTIME_EVENT_MAP_CAMERA_DID_CHANGE) RuntimeEventTypeMapStyleLoaded RuntimeEventType = RuntimeEventType(C.MLN_RUNTIME_EVENT_MAP_STYLE_LOADED) // The map started to load a style. RuntimeEventTypeMapLoadingStarted RuntimeEventType = RuntimeEventType(C.MLN_RUNTIME_EVENT_MAP_LOADING_STARTED) // The map loaded its style and everything that the current view needs, and // rendered the result. RuntimeEventTypeMapLoadingFinished RuntimeEventType = RuntimeEventType(C.MLN_RUNTIME_EVENT_MAP_LOADING_FINISHED) // The map failed to load a style. RuntimeEventTypeMapLoadingFailed RuntimeEventType = RuntimeEventType(C.MLN_RUNTIME_EVENT_MAP_LOADING_FAILED) // The map rendered a complete frame and has nothing left to load, animate, or // redraw. RuntimeEventTypeMapIdle RuntimeEventType = RuntimeEventType(C.MLN_RUNTIME_EVENT_MAP_IDLE) RuntimeEventTypeMapRenderError RuntimeEventType = RuntimeEventType(C.MLN_RUNTIME_EVENT_MAP_RENDER_ERROR) RuntimeEventTypeMapRenderFrameStarted RuntimeEventType = RuntimeEventType(C.MLN_RUNTIME_EVENT_MAP_RENDER_FRAME_STARTED) RuntimeEventTypeMapRenderFrameFinished RuntimeEventType = RuntimeEventType(C.MLN_RUNTIME_EVENT_MAP_RENDER_FRAME_FINISHED) RuntimeEventTypeMapRenderMapStarted RuntimeEventType = RuntimeEventType(C.MLN_RUNTIME_EVENT_MAP_RENDER_MAP_STARTED) RuntimeEventTypeMapRenderMapFinished RuntimeEventType = RuntimeEventType(C.MLN_RUNTIME_EVENT_MAP_RENDER_MAP_FINISHED) // The style uses an image that it doesn't have. RuntimeEventTypeMapStyleImageMissing RuntimeEventType = RuntimeEventType(C.MLN_RUNTIME_EVENT_MAP_STYLE_IMAGE_MISSING) // A tile moved to another step of loading. RuntimeEventTypeMapTileAction RuntimeEventType = RuntimeEventType(C.MLN_RUNTIME_EVENT_MAP_TILE_ACTION) // A source in the style changed, such as when its TileJSON loads. RuntimeEventTypeMapSourceChanged RuntimeEventType = RuntimeEventType(C.MLN_RUNTIME_EVENT_MAP_SOURCE_CHANGED) RuntimeEventTypeOfflineRegionStatusChanged RuntimeEventType = RuntimeEventType(C.MLN_RUNTIME_EVENT_OFFLINE_REGION_STATUS_CHANGED) // A resource that the region needs failed to download. RuntimeEventTypeOfflineRegionResponseError RuntimeEventType = RuntimeEventType(C.MLN_RUNTIME_EVENT_OFFLINE_REGION_RESPONSE_ERROR) // The region's download became inactive because the cache file's offline // regions hold as many tiles from MapLibre's demo tile server as the limit // allows. Only tiles of sources with a maplibre:// URL count toward the limit. RuntimeEventTypeOfflineRegionTileCountLimitExceeded RuntimeEventType = RuntimeEventType(C.MLN_RUNTIME_EVENT_OFFLINE_REGION_TILE_COUNT_LIMIT_EXCEEDED) RuntimeEventTypeMapGlyphsRequested RuntimeEventType = RuntimeEventType(C.MLN_RUNTIME_EVENT_MAP_GLYPHS_REQUESTED) RuntimeEventTypeMapGlyphsLoaded RuntimeEventType = RuntimeEventType(C.MLN_RUNTIME_EVENT_MAP_GLYPHS_LOADED) RuntimeEventTypeMapGlyphsError RuntimeEventType = RuntimeEventType(C.MLN_RUNTIME_EVENT_MAP_GLYPHS_ERROR) RuntimeEventTypeMapSpriteRequested RuntimeEventType = RuntimeEventType(C.MLN_RUNTIME_EVENT_MAP_SPRITE_REQUESTED) RuntimeEventTypeMapSpriteLoaded RuntimeEventType = RuntimeEventType(C.MLN_RUNTIME_EVENT_MAP_SPRITE_LOADED) RuntimeEventTypeMapSpriteError RuntimeEventType = RuntimeEventType(C.MLN_RUNTIME_EVENT_MAP_SPRITE_ERROR) )
func (RuntimeEventType) String
func (value RuntimeEventType) String() string
type RuntimeHandle
type RuntimeHandle struct { // contains filtered or unexported fields }
RuntimeHandle corresponds to mln_runtime. A runtime owns maps and the network and cache settings that they share.
See mln_runtime in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/base_8h.html
func NewRuntime
func NewRuntime(options *RuntimeOptions) (*RuntimeHandle, error)
NewRuntime creates a runtime.
A runtime holds maps and the resource loading, cache, and offline regions that they share. In a browser, create runtimes on a Web Worker, not on the main thread.
See mln_runtime_create in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
Errors:
- StatusInvalidArgument when the cache database file that options names can't be opened or created.
func (*RuntimeHandle) ClearEventHandler
func (receiver *RuntimeHandle) ClearEventHandler() (*Future[CommandCompletion], error)
ClearEventHandler stops sending the events of the runtime and its maps to a callback.
See mln_runtime_clear_event_handler in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
func (*RuntimeHandle) ClearHTTPHeaderTransform
func (receiver *RuntimeHandle) ClearHTTPHeaderTransform() (*Future[CommandCompletion], error)
ClearHTTPHeaderTransform stops adding headers to the runtime's HTTP requests.
See mln_runtime_clear_http_header_transform in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
func (*RuntimeHandle) ClearResourceProvider
func (receiver *RuntimeHandle) ClearResourceProvider() (*Future[CommandCompletion], error)
ClearResourceProvider removes the runtime's resource provider, so the library loads every request itself.
See mln_runtime_clear_resource_provider in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
func (*RuntimeHandle) ClearResourceTransform
func (receiver *RuntimeHandle) ClearResourceTransform() (*Future[CommandCompletion], error)
ClearResourceTransform stops rewriting the URLs of the runtime's network requests.
See mln_runtime_clear_resource_transform in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
func (*RuntimeHandle) CreateMap
func (receiver *RuntimeHandle) CreateMap(options MapOptions) (mapHandle *MapHandle, ready *Future[struct{}], err error)
CreateMap creates a map on runtime.
Asynchronous calls on the map before the completion runs wait for it, and complete with StatusInvalidState when creation fails.
See mln_runtime_create_map in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
func (*RuntimeHandle) CreateOfflineRegion
func (receiver *RuntimeHandle) CreateOfflineRegion(definition OfflineRegionDefinition, metadata []byte) (*Future[OfflineRegionInfo], error)
CreateOfflineRegion creates an offline region in the runtime's cache file.
metadata holds any bytes to store with the region, such as its name. The region doesn't download until RuntimeHandle.SetOfflineRegionDownloadState() makes its download active.
See mln_runtime_create_offline_region in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
func (*RuntimeHandle) DeleteOfflineRegion
func (receiver *RuntimeHandle) DeleteOfflineRegion(regionID int64) (*Future[struct{}], error)
DeleteOfflineRegion deletes the offline region regionID from the runtime's cache file.
See mln_runtime_delete_offline_region in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
Errors:
- StatusNotFound when the cache file has no region regionID.
func (*RuntimeHandle) Discarding
func (receiver *RuntimeHandle) Discarding() RuntimeHandleDiscarding
func (*RuntimeHandle) Dispose
func (receiver *RuntimeHandle) Dispose() error
Dispose releases a runtime in any state, without waiting.
The runtime finishes its teardown after its maps are released.
See mln_runtime_dispose in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
func (*RuntimeHandle) GetOfflineRegion
func (receiver *RuntimeHandle) GetOfflineRegion(regionID int64) (*Future[*OfflineRegionInfo], error)
GetOfflineRegion reads the offline region regionID.
The result is null when the cache file has no region with that ID.
See mln_runtime_get_offline_region in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
func (*RuntimeHandle) GetOfflineRegionStatus
func (receiver *RuntimeHandle) GetOfflineRegionStatus(regionID int64) (*Future[OfflineRegionStatus], error)
GetOfflineRegionStatus reads the download progress of the offline region regionID.
While the download is active, the counts cover what it has visited. Once it's inactive, they cover every resource the region holds, including those that only earlier versions of its style listed, so the completed counts can exceed the required counts.
See mln_runtime_get_offline_region_status in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
Errors:
- StatusNotFound when the cache file has no region regionID.
func (*RuntimeHandle) ID
func (handle *RuntimeHandle) ID() uint64
ID returns the native handle value, which runtime events report as their source. It stays readable after the handle is released, so events drained later still match this handle.
func (*RuntimeHandle) InvalidateOfflineRegion
func (receiver *RuntimeHandle) InvalidateOfflineRegion(regionID int64) (*Future[struct{}], error)
InvalidateOfflineRegion makes maps check each resource of the offline region regionID with the server before they use it.
The region keeps its resources. Starting its download again fetches the invalidated resources for offline use. If the style or a TileJSON document is then missing or invalid, the download reports an offline region response error and goes on from the stored copy. Resources that the current style no longer lists stay in the region until it's deleted.
See mln_runtime_invalidate_offline_region in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
Errors:
- StatusNotFound when the cache file has no region regionID.
func (*RuntimeHandle) IsClosed
func (handle *RuntimeHandle) IsClosed() bool
IsClosed reports whether the binding has accepted a release, dispose, or discard of the handle. A nil handle is closed.
func (*RuntimeHandle) ListOfflineRegions
func (receiver *RuntimeHandle) ListOfflineRegions() (*Future[[]OfflineRegionInfo], error)
ListOfflineRegions lists the offline regions in the runtime's cache file.
See mln_runtime_list_offline_regions in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
func (*RuntimeHandle) MergeOfflineRegions
func (receiver *RuntimeHandle) MergeOfflineRegions(sideDatabasePath string) (*Future[[]OfflineRegionInfo], error)
MergeOfflineRegions copies the offline regions of another cache file into the runtime's cache file.
A region whose definition and metadata match one that the runtime's file already has isn't copied again. The result lists the runtime's copy of each region in the other file.
See mln_runtime_merge_offline_regions in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
Errors:
- StatusInvalidArgument when sideDatabasePath isn't a readable database file.
- StatusNativeError when the merge would exceed the tile limit that RuntimeEventTypeOfflineRegionTileCountLimitExceeded describes.
func (*RuntimeHandle) Release
func (receiver *RuntimeHandle) Release() (*Future[struct{}], error)
Release releases a runtime.
Release the runtime's maps first.
See mln_runtime_release in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
func (*RuntimeHandle) RunCacheDatabaseOperation
func (receiver *RuntimeHandle) RunCacheDatabaseOperation(operation CacheDatabaseOperation) (*Future[struct{}], error)
RunCacheDatabaseOperation runs a maintenance action on the runtime's cache database.
See mln_runtime_run_cache_database_operation in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
func (*RuntimeHandle) SetEventHandler
func (receiver *RuntimeHandle) SetEventHandler(handler RuntimeEventHandler) (*Future[CommandCompletion], error)
SetEventHandler sends the events of the runtime and its maps to a callback.
The callback replaces the one set before.
See mln_runtime_set_event_handler in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
func (*RuntimeHandle) SetHTTPHeaderTransform
func (receiver *RuntimeHandle) SetHTTPHeaderTransform(transform HTTPHeaderTransform) (*Future[CommandCompletion], error)
SetHTTPHeaderTransform adds headers to the runtime's HTTP requests.
The transform replaces the one set before. In a browser or on OpenHarmony, serve the requests with RuntimeHandle.SetResourceProvider() instead.
Runs on a library thread.
See mln_runtime_set_http_header_transform in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
Errors:
- StatusUnsupported when the library runs in a browser or on OpenHarmony.
func (*RuntimeHandle) SetMaximumAmbientCacheSize
func (receiver *RuntimeHandle) SetMaximumAmbientCacheSize(size uint64) (*Future[struct{}], error)
SetMaximumAmbientCacheSize limits the size of the runtime's ambient cache.
size is in bytes. Offline regions don't count toward it. It defaults to 50 MB, or to 0 in the browser when the runtime has no cache file.
See mln_runtime_set_maximum_ambient_cache_size in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
func (*RuntimeHandle) SetOfflineRegionDownloadState
func (receiver *RuntimeHandle) SetOfflineRegionDownloadState(regionID int64, state OfflineRegionDownloadState) (*Future[struct{}], error)
SetOfflineRegionDownloadState starts or pauses the download of the offline region regionID.
Setting the state that the download already has does nothing. A download stops when the runtime closes.
See mln_runtime_set_offline_region_download_state in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
Errors:
- StatusNotFound when the cache file has no region regionID.
func (*RuntimeHandle) SetOfflineRegionObserved
func (receiver *RuntimeHandle) SetOfflineRegionObserved(regionID int64, events RuntimeEventFlag) (*Future[struct{}], error)
SetOfflineRegionObserved selects the events that the runtime reports about the download of the offline region regionID.
events holds bits of RuntimeEventFlagAllRuntimeEvents and replaces the region's previous selection. RuntimeEventFlagNone stops the region's events.
See mln_runtime_set_offline_region_observed in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
Errors:
- StatusNotFound when the cache file has no region regionID.
func (*RuntimeHandle) SetResourceProvider
func (receiver *RuntimeHandle) SetResourceProvider(provider ResourceProvider) (*Future[CommandCompletion], error)
SetResourceProvider serves the runtime's network requests through a callback.
The provider receives the network requests that its routes match, and the library loads the rest as usual. A provider can serve URL schemes that the library can't load itself. The provider replaces the one set before.
See mln_runtime_set_resource_provider in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
func (*RuntimeHandle) SetResourceTransform
func (receiver *RuntimeHandle) SetResourceTransform(transform ResourceTransform) (*Future[CommandCompletion], error)
SetResourceTransform rewrites the URLs of the runtime's network requests.
The transform replaces the one set before.
See mln_runtime_set_resource_transform in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
func (*RuntimeHandle) String
func (handle *RuntimeHandle) String() string
String formats the handle as RuntimeHandle(id=0x<hex>, closed=<true|false>).
func (*RuntimeHandle) UpdateOfflineRegionMetadata
func (receiver *RuntimeHandle) UpdateOfflineRegionMetadata(regionID int64, metadata []byte) (*Future[OfflineRegionInfo], error)
UpdateOfflineRegionMetadata replaces the metadata of the offline region regionID.
See mln_runtime_update_offline_region_metadata in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
Errors:
- StatusNotFound when the cache file has no region regionID.
type RuntimeHandleDiscarding
type RuntimeHandleDiscarding struct { // contains filtered or unexported fields }
func (RuntimeHandleDiscarding) ClearEventHandler
func (view RuntimeHandleDiscarding) ClearEventHandler() error
func (RuntimeHandleDiscarding) ClearHTTPHeaderTransform
func (view RuntimeHandleDiscarding) ClearHTTPHeaderTransform() error
func (RuntimeHandleDiscarding) ClearResourceProvider
func (view RuntimeHandleDiscarding) ClearResourceProvider() error
func (RuntimeHandleDiscarding) ClearResourceTransform
func (view RuntimeHandleDiscarding) ClearResourceTransform() error
func (RuntimeHandleDiscarding) SetEventHandler
func (view RuntimeHandleDiscarding) SetEventHandler(handler RuntimeEventHandler) error
func (RuntimeHandleDiscarding) SetHTTPHeaderTransform
func (view RuntimeHandleDiscarding) SetHTTPHeaderTransform(transform HTTPHeaderTransform) error
func (RuntimeHandleDiscarding) SetResourceProvider
func (view RuntimeHandleDiscarding) SetResourceProvider(provider ResourceProvider) error
func (RuntimeHandleDiscarding) SetResourceTransform
func (view RuntimeHandleDiscarding) SetResourceTransform(transform ResourceTransform) error
type RuntimeOptions
type RuntimeOptions struct { // The directory that asset:// URLs load from. Empty uses the working directory, // or the app's assets on Android. AssetPath string // The path of the cache database file, which holds the ambient cache and // offline regions. Its directory must be writable. Empty keeps the cache in // memory. CachePath string }
RuntimeOptions corresponds to mln_runtime_options. Options for NewRuntime().
See mln_runtime_options in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
type ScreenBox
type ScreenBox struct { Min ScreenPoint Max ScreenPoint }
ScreenBox corresponds to mln_screen_box. A rectangle of the screen, from its min corner to its max corner.
See mln_screen_box in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/query_8h.html
type ScreenLineString
type ScreenLineString struct{ Points []ScreenPoint }
ScreenLineString corresponds to mln_screen_line_string. A line through points on the screen.
See mln_screen_line_string in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/query_8h.html
type ScreenPoint
type ScreenPoint struct { X float64 Y float64 }
ScreenPoint corresponds to mln_screen_point. A point on the screen, in logical pixels from the map's top-left corner.
See mln_screen_point in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type SourceFeature
type SourceFeature struct { // The feature, as a GeoJSON feature. Feature string // The feature's source layer, or empty when its source has none. SourceLayerID string }
SourceFeature corresponds to mln_source_feature. A feature that a source feature query found.
See mln_source_feature in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/query_8h.html
type SourceFeatureQueryOptions
type SourceFeatureQueryOptions struct { // The source layers to query. A vector source finds features only in the source // layers named here. SourceLayerIDs []string // A [filter](https://maplibre.org/maplibre-style-spec/expressions/) that each // feature must match. Empty matches every feature. Filter string }
SourceFeatureQueryOptions corresponds to mln_source_feature_query_options. Options for a source feature query.
See mln_source_feature_query_options in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/query_8h.html
type Status
type Status int32
Status corresponds to mln_status. The result of a call or of asynchronous work.
See mln_status in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/base_8h.html
const ( StatusOk Status = Status(C.MLN_STATUS_OK) // An argument is invalid, such as malformed JSON or a value out of range. StatusInvalidArgument Status = Status(C.MLN_STATUS_INVALID_ARGUMENT) // The call doesn't fit the current state, such as removing a source that a // layer still uses. StatusInvalidState Status = Status(C.MLN_STATUS_INVALID_STATE) // The call came from a thread that can't make it. StatusWrongThread Status = Status(C.MLN_STATUS_WRONG_THREAD) // The platform, the build, or the render target lacks the feature. StatusUnsupported Status = Status(C.MLN_STATUS_UNSUPPORTED) // The library or the platform hit an error, such as a failed graphics driver // call. StatusNativeError Status = Status(C.MLN_STATUS_NATIVE_ERROR) // The work stopped before it finished, such as when its handle was released. StatusCancelled Status = Status(C.MLN_STATUS_CANCELLED) // Another call is still using the same object. StatusBusy Status = Status(C.MLN_STATUS_BUSY) // The render target can't be drawn to anymore. StatusTargetLost Status = Status(C.MLN_STATUS_TARGET_LOST) // Nothing has the given ID. StatusNotFound Status = Status(C.MLN_STATUS_NOT_FOUND) // Something already has the given ID. StatusAlreadyExists Status = Status(C.MLN_STATUS_ALREADY_EXISTS) )
func (Status) Error
func (value Status) Error() string
func (Status) String
func (value Status) String() string
type StyleExpressionHandle
type StyleExpressionHandle struct { // contains filtered or unexported fields }
StyleExpressionHandle corresponds to mln_style_expression. A parsed style expression.
See mln_style_expression in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/base_8h.html
func NewStyleExpression
func NewStyleExpression(expression string, options *StyleExpressionOptions) (*StyleExpressionHandle, error)
NewStyleExpression parses a style [expression](https://maplibre.org/maplibre-style-spec/expressions/) to evaluate without a map.
See mln_style_expression_create in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style__expression_8h.html
Errors:
- StatusInvalidArgument when expression isn't a valid expression, or its result can't have the expected type.
func (*StyleExpressionHandle) Evaluate
func (receiver *StyleExpressionHandle) Evaluate(inputs *StyleExpressionInputs) (string, error)
Evaluate evaluates a style expression and writes its result as JSON.
A number in the result that isn't finite becomes null. A color is ["rgba", r, g, b, a], with red, green, and blue from 0 to 255 and alpha from 0 to 1, each exact only to single precision. Formatted text is a ["format", …] expression, an image is {"name": …, "available": …}, padding is [top, right, bottom, left], and a variable anchor offset is [anchor, [x, y], …].
See mln_style_expression_evaluate in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style__expression_8h.html
Errors:
- StatusInvalidArgument when the expression fails to evaluate, such as when it reads an input that inputs doesn't set.
func (*StyleExpressionHandle) ID
func (handle *StyleExpressionHandle) ID() uint64
ID returns the native handle value. It stays readable after the handle is released.
func (*StyleExpressionHandle) Info
func (receiver *StyleExpressionHandle) Info() (StyleExpressionInfo, error)
Info reads what a style expression's result depends on.
See mln_style_expression_get_info in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style__expression_8h.html
func (*StyleExpressionHandle) IsClosed
func (handle *StyleExpressionHandle) IsClosed() bool
IsClosed reports whether the binding has accepted a release, dispose, or discard of the handle. A nil handle is closed.
func (*StyleExpressionHandle) Release
func (receiver *StyleExpressionHandle) Release() error
Release releases a parsed style expression.
See mln_style_expression_release in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style__expression_8h.html
func (*StyleExpressionHandle) String
func (handle *StyleExpressionHandle) String() string
String formats the handle as StyleExpressionHandle(id=0x<hex>, closed=<true|false>).
type StyleExpressionInfo
type StyleExpressionInfo struct { // True when the result doesn't depend on the feature or its state. IsFeatureConstant bool // True when the result doesn't depend on the zoom level. IsZoomConstant bool }
StyleExpressionInfo corresponds to mln_style_expression_info. What a style expression's result depends on.
See mln_style_expression_info in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style__expression_8h.html
type StyleExpressionInputs
type StyleExpressionInputs struct { Zoom *float64 // The value of heatmap-density, line-progress, and elevation. ColorRampParameter *float64 // The feature to evaluate against, as a GeoJSON feature, or empty for none. Feature string // The feature's state, as a JSON object, or empty for none. FeatureState string // The values that global-state reads, as a JSON object, or empty for none. GlobalState string // The tile that holds the feature. within and distance need it to read the // feature's geometry. CanonicalTileID *CanonicalTileID // The IDs of the images that image treats as available. AvailableImages []string }
StyleExpressionInputs corresponds to mln_style_expression_inputs. The inputs that a style expression reads while it evaluates.
See mln_style_expression_inputs in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style__expression_8h.html
type StyleExpressionOptions
type StyleExpressionOptions struct { // The type that the result must have. ExpectedType *StyleExpressionType }
StyleExpressionOptions corresponds to mln_style_expression_options. Options for parsing a style expression.
See mln_style_expression_options in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style__expression_8h.html
type StyleExpressionType
type StyleExpressionType struct { Kind StyleExpressionTypeKind // The type of each item when kind is StyleExpressionTypeKindArray. It can't be // an array itself. ItemKind StyleExpressionTypeKind // The length of an array, or 0 for any length. ItemCount uint32 }
StyleExpressionType corresponds to mln_style_expression_type. The type of a style expression's result.
See mln_style_expression_type in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style__expression_8h.html
type StyleExpressionTypeKind
type StyleExpressionTypeKind uint32
StyleExpressionTypeKind corresponds to mln_style_expression_type_kind. The type of a style expression's result, or of the items of an array result.
See mln_style_expression_type_kind in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style__expression_8h.html
const ( // Any type. StyleExpressionTypeKindValue StyleExpressionTypeKind = StyleExpressionTypeKind(C.MLN_STYLE_EXPRESSION_TYPE_VALUE) StyleExpressionTypeKindNumber StyleExpressionTypeKind = StyleExpressionTypeKind(C.MLN_STYLE_EXPRESSION_TYPE_NUMBER) StyleExpressionTypeKindString StyleExpressionTypeKind = StyleExpressionTypeKind(C.MLN_STYLE_EXPRESSION_TYPE_STRING) StyleExpressionTypeKindBoolean StyleExpressionTypeKind = StyleExpressionTypeKind(C.MLN_STYLE_EXPRESSION_TYPE_BOOLEAN) StyleExpressionTypeKindColor StyleExpressionTypeKind = StyleExpressionTypeKind(C.MLN_STYLE_EXPRESSION_TYPE_COLOR) StyleExpressionTypeKindObject StyleExpressionTypeKind = StyleExpressionTypeKind(C.MLN_STYLE_EXPRESSION_TYPE_OBJECT) StyleExpressionTypeKindFormatted StyleExpressionTypeKind = StyleExpressionTypeKind(C.MLN_STYLE_EXPRESSION_TYPE_FORMATTED) StyleExpressionTypeKindImage StyleExpressionTypeKind = StyleExpressionTypeKind(C.MLN_STYLE_EXPRESSION_TYPE_IMAGE) StyleExpressionTypeKindPadding StyleExpressionTypeKind = StyleExpressionTypeKind(C.MLN_STYLE_EXPRESSION_TYPE_PADDING) StyleExpressionTypeKindVariableAnchorOffsetCollection StyleExpressionTypeKind = StyleExpressionTypeKind(C.MLN_STYLE_EXPRESSION_TYPE_VARIABLE_ANCHOR_OFFSET_COLLECTION) StyleExpressionTypeKindArray StyleExpressionTypeKind = StyleExpressionTypeKind(C.MLN_STYLE_EXPRESSION_TYPE_ARRAY) )
func (StyleExpressionTypeKind) String
func (value StyleExpressionTypeKind) String() string
type StyleImageInfo
type StyleImageInfo struct { Width uint32 Height uint32 // The premultiplied RGBA pixels, in rows of width * 4 bytes, from the top row // down. Pixels []byte StretchX []ImageStretch StretchY []ImageStretch Content *ImageContent TextFitWidth *StyleImageTextFit TextFitHeight *StyleImageTextFit PixelRatio float32 Sdf bool KeepUnused bool }
StyleImageInfo corresponds to mln_style_image_info. An image in the map's style.
See mln_style_image_info in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
type StyleImageOptions
type StyleImageOptions struct { // The ranges of columns that stretch, in increasing order without overlap. StretchX []ImageStretch // The ranges of rows that stretch, in increasing order without overlap. StretchY []ImageStretch Content *ImageContent TextFitWidth *StyleImageTextFit TextFitHeight *StyleImageTextFit PixelRatio *float32 Sdf *bool // Keeps the image after no layer uses it. Without this, the map can remove an // image that it asked for through RuntimeEventTypeMapStyleImageMissing. KeepUnused *bool }
StyleImageOptions corresponds to mln_style_image_options. Options for a style image, as the [sprite](https://maplibre.org/maplibre-style-spec/sprite/) spec describes them.
See mln_style_image_options in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
type StyleImageTextFit
type StyleImageTextFit uint32
StyleImageTextFit corresponds to mln_style_image_text_fit. How an image stretches to fit text along one axis.
See mln_style_image_text_fit in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
const ( StyleImageTextFitStretchOrShrink StyleImageTextFit = StyleImageTextFit(C.MLN_STYLE_IMAGE_TEXT_FIT_STRETCH_OR_SHRINK) StyleImageTextFitStretchOnly StyleImageTextFit = StyleImageTextFit(C.MLN_STYLE_IMAGE_TEXT_FIT_STRETCH_ONLY) StyleImageTextFitProportional StyleImageTextFit = StyleImageTextFit(C.MLN_STYLE_IMAGE_TEXT_FIT_PROPORTIONAL) )
func (StyleImageTextFit) String
func (value StyleImageTextFit) String() string
type StyleLayerInfo
type StyleLayerInfo struct { ID string // The layer's [type](https://maplibre.org/maplibre-style-spec/layers/#type), // such as fill. Type string SourceID string SourceLayer string // The zoom level where the layer starts to show, or negative infinity when the // layer doesn't set one. MinZoom float64 // The zoom level where the layer stops showing, or infinity when the layer // doesn't set one. MaxZoom float64 Visibility StyleLayerVisibility }
StyleLayerInfo corresponds to mln_style_layer_info. A layer in the map's style.
See mln_style_layer_info in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
type StyleLayerVisibility
type StyleLayerVisibility uint32
StyleLayerVisibility corresponds to mln_style_layer_visibility. Whether a layer shows.
See mln_style_layer_visibility in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
const ( StyleLayerVisibilityVisible StyleLayerVisibility = StyleLayerVisibility(C.MLN_STYLE_LAYER_VISIBILITY_VISIBLE) StyleLayerVisibilityNone StyleLayerVisibility = StyleLayerVisibility(C.MLN_STYLE_LAYER_VISIBILITY_NONE) )
func (StyleLayerVisibility) String
func (value StyleLayerVisibility) String() string
type StyleRasterDemEncoding
type StyleRasterDemEncoding uint32
StyleRasterDemEncoding corresponds to mln_style_raster_dem_encoding. How a raster DEM tile encodes elevation in its colors.
See mln_style_raster_dem_encoding in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
const ( StyleRasterDemEncodingMapbox StyleRasterDemEncoding = StyleRasterDemEncoding(C.MLN_STYLE_RASTER_DEM_ENCODING_MAPBOX) StyleRasterDemEncodingTerrarium StyleRasterDemEncoding = StyleRasterDemEncoding(C.MLN_STYLE_RASTER_DEM_ENCODING_TERRARIUM) )
func (StyleRasterDemEncoding) String
func (value StyleRasterDemEncoding) String() string
type StyleSourceInfo
type StyleSourceInfo struct { ID string Type StyleSourceType IsVolatile bool Attribution string URL string // The tiles that the style lists in the source itself, instead of at a URL. TileJSON *StyleSourceTileInfo Bounds *LatLngBounds TileSize *uint32 VectorEncoding *StyleVectorTileEncoding RasterEncoding *StyleRasterDemEncoding // A GeoJSON source's options, with every field set. GeoJSON *GeoJSONSourceOptions }
StyleSourceInfo corresponds to mln_style_source_info. A source in the map's style.
See mln_style_source_info in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
type StyleSourceTileInfo
type StyleSourceTileInfo struct { TileURLs []string MinZoom float64 MaxZoom float64 Scheme StyleTileScheme }
StyleSourceTileInfo corresponds to mln_style_source_tile_info. The tiles of a source, as the style lists them.
See mln_style_source_tile_info in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
type StyleSourceType
type StyleSourceType uint32
StyleSourceType corresponds to mln_style_source_type. The type of a style source.
See mln_style_source_type in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
const ( StyleSourceTypeUnknown StyleSourceType = StyleSourceType(C.MLN_STYLE_SOURCE_TYPE_UNKNOWN) StyleSourceTypeVector StyleSourceType = StyleSourceType(C.MLN_STYLE_SOURCE_TYPE_VECTOR) StyleSourceTypeRaster StyleSourceType = StyleSourceType(C.MLN_STYLE_SOURCE_TYPE_RASTER) StyleSourceTypeRasterDem StyleSourceType = StyleSourceType(C.MLN_STYLE_SOURCE_TYPE_RASTER_DEM) StyleSourceTypeGeoJSON StyleSourceType = StyleSourceType(C.MLN_STYLE_SOURCE_TYPE_GEO_JSON) StyleSourceTypeImage StyleSourceType = StyleSourceType(C.MLN_STYLE_SOURCE_TYPE_IMAGE) StyleSourceTypeVideo StyleSourceType = StyleSourceType(C.MLN_STYLE_SOURCE_TYPE_VIDEO) StyleSourceTypeAnnotations StyleSourceType = StyleSourceType(C.MLN_STYLE_SOURCE_TYPE_ANNOTATIONS) StyleSourceTypeCustomGeometry StyleSourceType = StyleSourceType(C.MLN_STYLE_SOURCE_TYPE_CUSTOM_GEOMETRY) StyleSourceTypeCustomVector StyleSourceType = StyleSourceType(C.MLN_STYLE_SOURCE_TYPE_CUSTOM_VECTOR) )
func (StyleSourceType) String
func (value StyleSourceType) String() string
type StyleTileScheme
type StyleTileScheme uint32
StyleTileScheme corresponds to mln_style_tile_scheme. Whether a tileset counts tile rows from the north (XYZ) or the south (TMS).
See mln_style_tile_scheme in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
const ( StyleTileSchemeXyz StyleTileScheme = StyleTileScheme(C.MLN_STYLE_TILE_SCHEME_XYZ) StyleTileSchemeTms StyleTileScheme = StyleTileScheme(C.MLN_STYLE_TILE_SCHEME_TMS) )
func (StyleTileScheme) String
func (value StyleTileScheme) String() string
type StyleTransitionOptions
type StyleTransitionOptions struct { DurationMs *float64 DelayMs *float64 // Whether symbols fade in and out as the map places them. EnablePlacementTransitions *bool }
StyleTransitionOptions corresponds to mln_style_transition_options. The default [transition](https://maplibre.org/maplibre-style-spec/transition/) for changes to a style's paint properties.
See mln_style_transition_options in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
type StyleVectorTileEncoding
type StyleVectorTileEncoding uint32
StyleVectorTileEncoding corresponds to mln_style_vector_tile_encoding. The format of vector tiles.
See mln_style_vector_tile_encoding in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html
const ( StyleVectorTileEncodingMvt StyleVectorTileEncoding = StyleVectorTileEncoding(C.MLN_STYLE_VECTOR_TILE_ENCODING_MVT) StyleVectorTileEncodingMlt StyleVectorTileEncoding = StyleVectorTileEncoding(C.MLN_STYLE_VECTOR_TILE_ENCODING_MLT) )
func (StyleVectorTileEncoding) String
func (value StyleVectorTileEncoding) String() string
type TextureImageInfo
type TextureImageInfo struct { Width uint32 Height uint32 // The bytes from the start of one row to the start of the next. Stride uint32 ByteLength uint }
TextureImageInfo corresponds to mln_texture_image_info. The layout of the pixels that RenderSessionHandle.ReadTexture() reads.
See mln_texture_image_info in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html
type TextureReadbackResult
type TextureReadbackResult struct { // Premultiplied RGBA pixels with 8 bits per channel, in rows from top to // bottom. Data []byte Info TextureImageInfo }
TextureReadbackResult corresponds to mln_texture_readback_result. The pixels that RenderSessionHandle.ReadTexture() reads.
See mln_texture_readback_result in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html
type TileID
type TileID struct { OverscaledZ uint32 Wrap int32 CanonicalZ uint32 CanonicalX uint32 CanonicalY uint32 }
TileID corresponds to mln_tile_id. The ID of a tile.
canonical_x and canonical_y place the tile in the source's grid at zoom canonical_z. overscaled_z is the zoom that the map draws the tile at, and is greater when the source has no tiles that deep. wrap says which copy of the world holds the tile: zero for the main one, negative to the west, and positive to the east.
See mln_tile_id in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
type TileLodMode
type TileLodMode uint32
TileLodMode corresponds to mln_tile_lod_mode. How the map picks the level of detail of its tiles.
See mln_tile_lod_mode in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
const ( // Uses the most detail at the center of the screen. TileLodModeDefault TileLodMode = TileLodMode(C.MLN_TILE_LOD_MODE_DEFAULT) // Uses the most detail closest to the camera. TileLodModeDistance TileLodMode = TileLodMode(C.MLN_TILE_LOD_MODE_DISTANCE) )
func (TileLodMode) String
func (value TileLodMode) String() string
type TileOperation
type TileOperation uint32
TileOperation corresponds to mln_tile_operation. A step in loading a tile.
See mln_tile_operation in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
const ( TileOperationRequestedFromCache TileOperation = TileOperation(C.MLN_TILE_OPERATION_REQUESTED_FROM_CACHE) TileOperationRequestedFromNetwork TileOperation = TileOperation(C.MLN_TILE_OPERATION_REQUESTED_FROM_NETWORK) TileOperationLoadFromNetwork TileOperation = TileOperation(C.MLN_TILE_OPERATION_LOAD_FROM_NETWORK) TileOperationLoadFromCache TileOperation = TileOperation(C.MLN_TILE_OPERATION_LOAD_FROM_CACHE) TileOperationStartParse TileOperation = TileOperation(C.MLN_TILE_OPERATION_START_PARSE) TileOperationEndParse TileOperation = TileOperation(C.MLN_TILE_OPERATION_END_PARSE) TileOperationError TileOperation = TileOperation(C.MLN_TILE_OPERATION_ERROR) TileOperationCancelled TileOperation = TileOperation(C.MLN_TILE_OPERATION_CANCELLED) TileOperationNull TileOperation = TileOperation(C.MLN_TILE_OPERATION_NULL) )
func (TileOperation) String
func (value TileOperation) String() string
type URLMatchFlag
type URLMatchFlag uint32
URLMatchFlag corresponds to mln_url_match_flag. How a URL pattern matches a request's URL.
A pattern matches the whole URL, query included. Without flags, it matches only the URL that equals it exactly.
See mln_url_match_flag in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
const ( // The URL matches the pattern as a glob. * matches any characters except /, ** // matches any characters, and ? matches one character except /. \ makes the // next character match only itself. For example, https://*.example.com/tiles/** // matches every URL under /tiles/ on each subdomain of example.com. URLMatchFlagGlob URLMatchFlag = URLMatchFlag(C.MLN_URL_MATCH_GLOB) )
func (URLMatchFlag) Has
func (value URLMatchFlag) Has(flags URLMatchFlag) bool
func (URLMatchFlag) String
func (value URLMatchFlag) String() string
type URLQueryParameter
type URLQueryParameter struct { Name string Value string }
URLQueryParameter corresponds to mln_url_query_parameter. A query parameter that a resource transform rule adds to a URL.
Pass name and value unencoded. The library percent-encodes every byte of them except the letters, digits, -, ., _, and ~, and adds them as name=value.
See mln_url_query_parameter in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html
type UnitBezier
type UnitBezier struct { X1 float64 Y1 float64 X2 float64 Y2 float64 }
UnitBezier corresponds to mln_unit_bezier. A timing curve from (0, 0) to (1, 1), with the control points (x1, y1) and (x2, y2).
x1 and x2 are between 0 and 1.
See mln_unit_bezier in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type UnknownVariant
type UnknownVariant struct{ Tag uint32 }
UnknownVariant preserves a discriminator whose payload this binding cannot interpret. Only a union that native returns admits it, and submitting one fails.
type Vec3
type Vec3 struct { X float64 Y float64 Z float64 }
Vec3 corresponds to mln_vec3. A vector in three dimensions.
See mln_vec3 in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
type ViewportMode
type ViewportMode uint32
ViewportMode corresponds to mln_viewport_mode. The vertical direction of the image that the map renders.
See mln_viewport_mode in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html
const ( ViewportModeDefault ViewportMode = ViewportMode(C.MLN_VIEWPORT_MODE_DEFAULT) // Renders the image upside down. ViewportModeFlippedY ViewportMode = ViewportMode(C.MLN_VIEWPORT_MODE_FLIPPED_Y) )
func (ViewportMode) String
func (value ViewportMode) String() string
type VulkanBorrowedTexture
type VulkanBorrowedTexture struct { // Your VkImage. Image uint64 // A 2D VkImageView of image with one mip level and one layer. ImageView uint64 }
VulkanBorrowedTexture corresponds to mln_vulkan_borrowed_texture. A Vulkan image of a borrowed ring.
See mln_vulkan_borrowed_texture in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html
type VulkanBorrowedTextureDescriptor
type VulkanBorrowedTextureDescriptor struct { LogicalSize LogicalSize PhysicalWidth uint32 PhysicalHeight uint32 Context VulkanContextDescriptor Textures []VulkanBorrowedTexture // The images' VkFormat. Format uint32 // The VkImageLayout that each frame leaves its image in. FinalLayout uint32 Owner VulkanImageOwner }
VulkanBorrowedTextureDescriptor corresponds to mln_vulkan_borrowed_texture_descriptor. A ring of your Vulkan images, for MapHandle.AttachVulkanBorrowedTexture().
logical_size sets the map's size. physical_width and physical_height give the images' size in pixels, which is usually logical_size times the map's scale factor. Each image must have that size, format, and VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, and belong to the context's device. The ring holds up to TextureRingMaxDepth distinct images.
The session uses the images until a replacement or release of the target completes, a detach or release of the session completes, or an abandon of it returns.
See mln_vulkan_borrowed_texture_descriptor in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html
type VulkanBorrowedTextureReplacement
type VulkanBorrowedTextureReplacement struct { LogicalSize LogicalSize PhysicalWidth uint32 PhysicalHeight uint32 Textures []VulkanBorrowedTexture }
VulkanBorrowedTextureReplacement corresponds to mln_vulkan_borrowed_texture_replacement. New Vulkan images for a borrowed ring, for RenderSessionHandle.SetVulkanBorrowedTextureTarget().
The members and the images follow the rules of VulkanBorrowedTextureDescriptor. The ring keeps its depth, context, format, final_layout, and owner, so give it as many images as it attached with, in that format, on the same device.
See mln_vulkan_borrowed_texture_replacement in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html
type VulkanContextDescriptor
type VulkanContextDescriptor struct { // A VkInstance. Instance uintptr // A VkPhysicalDevice. PhysicalDevice uintptr // A VkDevice. Device uintptr // A VkQueue from graphics_queue_family_index that supports graphics. If you // submit to it too, set RenderSessionAttachOptions.QueueLock. GraphicsQueue uintptr GraphicsQueueFamilyIndex uint32 // Your vkGetInstanceProcAddr, or null to use the Vulkan loader's. GetInstanceProcAddr uintptr // Your vkGetDeviceProcAddr, or null to look it up from the instance. GetDeviceProcAddr uintptr }
VulkanContextDescriptor corresponds to mln_vulkan_context_descriptor. The Vulkan device and queue that a render session uses.
Keep these objects alive until a detach or release of the session completes, or an abandon of it returns.
See mln_vulkan_context_descriptor in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html
type VulkanDeviceContextResult
type VulkanDeviceContextResult struct{ Context VulkanContextDescriptor }
VulkanDeviceContextResult corresponds to mln_vulkan_device_context_result. A Vulkan device's context, as VulkanDeviceHandle.Context() reports it.
See mln_vulkan_device_context_result in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/vulkan_8h.html
type VulkanDeviceHandle
type VulkanDeviceHandle struct { // contains filtered or unexported fields }
VulkanDeviceHandle corresponds to mln_vulkan_device. A Vulkan instance, device, and queue that the library creates and owns.
See mln_vulkan_device in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/base_8h.html
func NewVulkanDevice
func NewVulkanDevice(options *VulkanDeviceOptions) (*VulkanDeviceHandle, error)
NewVulkanDevice creates a Vulkan instance, device, and graphics queue for render sessions.
Attach sessions with the context from VulkanDeviceHandle.Context(), in place of a device of your own. Without device_uuid or device_luid, it prefers a discrete GPU. The device enables the external memory and semaphore extensions that the GPU offers.
See mln_vulkan_device_create in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/vulkan_8h.html
Errors:
- StatusUnsupported when SupportedRenderBackendMask() lacks RenderBackendFlagVulkan, or when presentation is true and the Vulkan loader or the GPU can't present.
- StatusNotFound when no GPU matches device_uuid and device_luid.
- StatusNativeError when there is no Vulkan loader, no GPU has a graphics queue, or Vulkan can't create the instance or the device.
func (*VulkanDeviceHandle) Context
func (receiver *VulkanDeviceHandle) Context() (VulkanDeviceContextResult, error)
Context gets the context to attach render sessions to the device with.
Pass it as the context of MapHandle.AttachVulkanSurface() or MapHandle.AttachVulkanBorrowedTexture(). The sessions on the device share its graphics queue. To submit to the queue yourself, set RenderSessionAttachOptions.QueueLock on each session.
See mln_vulkan_device_get_context in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/vulkan_8h.html
func (*VulkanDeviceHandle) ID
func (handle *VulkanDeviceHandle) ID() uint64
ID returns the native handle value. It stays readable after the handle is released.
func (*VulkanDeviceHandle) IsClosed
func (handle *VulkanDeviceHandle) IsClosed() bool
IsClosed reports whether the binding has accepted a release, dispose, or discard of the handle. A nil handle is closed.
func (*VulkanDeviceHandle) Release
func (receiver *VulkanDeviceHandle) Release() error
Release releases a Vulkan device.
Render sessions that attached with the device's context keep using it until they detach or their release finishes.
See mln_vulkan_device_release in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/vulkan_8h.html
func (*VulkanDeviceHandle) String
func (handle *VulkanDeviceHandle) String() string
String formats the handle as VulkanDeviceHandle(id=0x<hex>, closed=<true|false>).
type VulkanDeviceOptions
type VulkanDeviceOptions struct { // Whether the device can present to a window. The instance then enables // VK_KHR_surface and the platform's surface extensions, and the device enables // VK_KHR_swapchain. Defaults to false. Presentation *bool // The 16-byte deviceUUID of the GPU to use, as VkPhysicalDeviceIDProperties // reports it. DeviceUuid *[]byte // The 8-byte deviceLUID of the GPU to use, as VkPhysicalDeviceIDProperties // reports it. On Windows, this is the GPU's DXGI adapter LUID. DeviceLuid *[]byte }
VulkanDeviceOptions corresponds to mln_vulkan_device_options. Options for NewVulkanDevice().
See mln_vulkan_device_options in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/vulkan_8h.html
type VulkanImageOwner
type VulkanImageOwner uint32
VulkanImageOwner corresponds to mln_vulkan_image_owner. The queue family that a borrowed image goes to after each frame.
With VulkanImageOwnerExternal or VulkanImageOwnerForeign, acquire the image on your side before you read it. You don't need to release it back.
See mln_vulkan_image_owner in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html
const ( // The image stays with the queue family of graphics_queue_family_index. VulkanImageOwnerGraphicsQueue VulkanImageOwner = VulkanImageOwner(C.MLN_VULKAN_IMAGE_OWNER_GRAPHICS_QUEUE) // Each frame releases the image to VK_QUEUE_FAMILY_EXTERNAL. VulkanImageOwnerExternal VulkanImageOwner = VulkanImageOwner(C.MLN_VULKAN_IMAGE_OWNER_EXTERNAL) // Each frame releases the image to VK_QUEUE_FAMILY_FOREIGN_EXT. VulkanImageOwnerForeign VulkanImageOwner = VulkanImageOwner(C.MLN_VULKAN_IMAGE_OWNER_FOREIGN) )
func (VulkanImageOwner) String
func (value VulkanImageOwner) String() string
type VulkanSurfaceDescriptor
type VulkanSurfaceDescriptor struct { LogicalSize LogicalSize Context VulkanContextDescriptor // Your VkSurfaceKHR. Surface uint64 }
VulkanSurfaceDescriptor corresponds to mln_vulkan_surface_descriptor. A Vulkan surface to present to, for MapHandle.AttachVulkanSurface().
The device must have VK_KHR_swapchain enabled, and the queue family of graphics_queue_family_index must support presenting to the surface. The session creates the swapchain. It uses the surface until a replacement or release of the target completes, a detach or release of the session completes, or an abandon of it returns.
See mln_vulkan_surface_descriptor in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/surface_8h.html
type VulkanSurfaceReplacement
type VulkanSurfaceReplacement struct { LogicalSize LogicalSize // Your VkSurfaceKHR. Surface uint64 }
VulkanSurfaceReplacement corresponds to mln_vulkan_surface_replacement. A new Vulkan surface for RenderSessionHandle.SetVulkanSurfaceTarget().
The session presents to it with the context that it attached with, so the queue family of that context's graphics_queue_family_index must support presenting to the surface. It uses the surface until a replacement or release of the target completes, a detach or release of the session completes, or an abandon of it returns.
See mln_vulkan_surface_replacement in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/surface_8h.html
type VulkanTextureFrame
type VulkanTextureFrame struct { Width uint32 Height uint32 ScaleFactor float64 // The image's index in the descriptor's textures. Slot uint32 // The VkImage. Image uint64 // The VkImageView. ImageView uint64 // The image's VkDevice. Device uintptr // The image's VkFormat. Format uint32 // The VkImageLayout that the frame left the image in. Layout uint32 }
VulkanTextureFrame corresponds to mln_vulkan_texture_frame. The Vulkan image of an acquired frame.
See mln_vulkan_texture_frame in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html
type VulkanTextureFrameView
type VulkanTextureFrameView struct { // contains filtered or unexported fields }
func (VulkanTextureFrameView) Format
func (view VulkanTextureFrameView) Format() uint32
func (VulkanTextureFrameView) Height
func (view VulkanTextureFrameView) Height() uint32
func (VulkanTextureFrameView) Image
func (view VulkanTextureFrameView) Image() (uint64, error)
func (VulkanTextureFrameView) ImageView
func (view VulkanTextureFrameView) ImageView() (uint64, error)
func (VulkanTextureFrameView) Layout
func (view VulkanTextureFrameView) Layout() uint32
func (VulkanTextureFrameView) ScaleFactor
func (view VulkanTextureFrameView) ScaleFactor() float64
func (VulkanTextureFrameView) Slot
func (view VulkanTextureFrameView) Slot() uint32
func (VulkanTextureFrameView) UnsafeDevice
func (view VulkanTextureFrameView) UnsafeDevice() (uintptr, error)
func (VulkanTextureFrameView) Width
func (view VulkanTextureFrameView) Width() uint32
type WGLContextDescriptor
type WGLContextDescriptor struct { // An HDC. DeviceContext uintptr // Your HGLRC, for a shared context. uintptr // Your wglGetProcAddress, or null to use the system's. GetProcAddress uintptr }
WGLContextDescriptor corresponds to mln_wgl_context_descriptor. The WGL objects that a render session makes its OpenGL context from.
See mln_wgl_context_descriptor in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html
type Wake
type Wake struct { // Null to turn the wake off. Callback func() // contains filtered or unexported fields }
Wake corresponds to mln_wake. A callback that tells the caller when work is ready.
Can run on any thread, including the caller's own thread during a library call. Return quickly and don't block.
See mln_wake in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/wake_8h.html
func NewNativeWake
func NewNativeWake(callback, userData, releaseUserData uintptr) Wake
NewNativeWake returns a Wake from C values that native code in the host supplies: callback, userData, and releaseUserData are the members of the C struct that Wake presents, which the binding copies unchanged. The first call that carries the Wake consumes it. Native code releases userData if it accepts the call, and otherwise the binding calls releaseUserData. A later call returns StatusInvalidState.
type WaylandSurfaceDescriptor
type WaylandSurfaceDescriptor struct { LogicalSize LogicalSize // Your wl_display*. Display uintptr // Your wl_surface*, on display. Surface uintptr }
WaylandSurfaceDescriptor corresponds to mln_wayland_surface_descriptor. A Wayland surface to present to, for MapHandle.AttachWaylandSurface().
See mln_wayland_surface_descriptor in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/wayland_8h.html
type WaylandSurfaceReplacement
type WaylandSurfaceReplacement struct { LogicalSize LogicalSize // Your wl_surface*, on the display that the session attached with. Surface uintptr }
WaylandSurfaceReplacement corresponds to mln_wayland_surface_replacement. A new Wayland surface for RenderSessionHandle.SetWaylandSurfaceTarget().
See mln_wayland_surface_replacement in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/wayland_8h.html
type WebGLContextDescriptor
type WebGLContextDescriptor struct { Kind WebGLContextKind // Your EMSCRIPTEN_WEBGL_CONTEXT_HANDLE, for an existing context. Context int32 // The canvas's CSS selector, for a transferred canvas. CanvasSelector string }
WebGLContextDescriptor corresponds to mln_web_gl_context_descriptor. The WebGL context or canvas that a render session uses.
See mln_web_gl_context_descriptor in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html
type WebGLContextKind
type WebGLContextKind uint32
WebGLContextKind corresponds to mln_web_gl_context_kind. How a render session gets its WebGL context.
See mln_web_gl_context_kind in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html
const ( // The session uses a context that you created with // emscripten_webgl_create_context(). WebGLContextKindExisting WebGLContextKind = WebGLContextKind(C.MLN_WEB_GL_CONTEXT_EXISTING) // The library transfers the canvas that canvas_selector names to a worker and // creates the context there. WebGLContextKindTransferredCanvas WebGLContextKind = WebGLContextKind(C.MLN_WEB_GL_CONTEXT_TRANSFERRED_CANVAS) )
func (WebGLContextKind) String
func (value WebGLContextKind) String() string
type Win32WindowDescriptor
type Win32WindowDescriptor struct { LogicalSize LogicalSize // Your HWND. Window uintptr }
Win32WindowDescriptor corresponds to mln_win32_window_descriptor. A Win32 window to present to, for MapHandle.AttachWin32Window().
See mln_win32_window_descriptor in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/win32_8h.html
type Win32WindowReplacement
type Win32WindowReplacement struct { LogicalSize LogicalSize // Your HWND. Window uintptr }
Win32WindowReplacement corresponds to mln_win32_window_replacement. A new Win32 window for RenderSessionHandle.SetWin32WindowTarget().
See mln_win32_window_replacement in the C API reference: https://maplibre.org/maplibre-native-ffi/reference/c/win32_8h.html