Skip to content

@luminaphoto/lumina-js


@luminaphoto/lumina-js / Client / MessageProtocol

Class: MessageProtocol

Message protocol handler for structured Client Worker communication

Provides a typed interface for sending messages to and receiving responses from the Client Worker that uses Core.Editor internally. Handles message ID generation, timeout management, and type-safe request/response matching.

Constructors

Constructor

ts
new MessageProtocol(worker): MessageProtocol;

Create a new message protocol handler

Parameters

ParameterTypeDescription
workerWorkerThe Web Worker instance to communicate with

Returns

MessageProtocol

Methods

applyBrightness()

ts
applyBrightness(payload): Promise<void>;

Apply brightness adjustment permanently

Parameters

ParameterTypeDescription
payloadPreviewBrightnessPayloadBrightness value

Returns

Promise<void>


applyColorGrading()

ts
applyColorGrading(payload): Promise<void>;

Apply color grading adjustment permanently

Parameters

ParameterTypeDescription
payloadPreviewColorGradingPayloadShadow, midtone, and highlight color grading parameters

Returns

Promise<void>


applyContrast()

ts
applyContrast(payload): Promise<void>;

Apply contrast adjustment permanently

Parameters

ParameterTypeDescription
payloadPreviewContrastPayloadContrast value

Returns

Promise<void>


applyExposure()

ts
applyExposure(payload): Promise<void>;

Apply exposure adjustment permanently

Parameters

ParameterTypeDescription
payloadPreviewExposurePayloadExposure value in stops

Returns

Promise<void>


applyHighlightsShadows()

ts
applyHighlightsShadows(payload): Promise<void>;

Apply highlights, shadows, and midtones adjustment permanently

Parameters

ParameterTypeDescription
payloadPreviewHighlightsShadowsPayloadHighlights, shadows, and midtones values

Returns

Promise<void>


applySaturation()

ts
applySaturation(payload): Promise<void>;

Apply saturation adjustment permanently

Parameters

ParameterTypeDescription
payloadPreviewSaturationPayloadSaturation value

Returns

Promise<void>


applyTemperature()

ts
applyTemperature(payload): Promise<void>;

Apply color temperature and tint adjustment permanently

Parameters

ParameterTypeDescription
payloadPreviewTemperaturePayloadTemperature and tint values

Returns

Promise<void>


applyTonalCurve()

ts
applyTonalCurve(payload): Promise<void>;

Apply tonal curve adjustment permanently

Parameters

ParameterTypeDescription
payloadPreviewTonalCurvePayloadTonal curve control points

Returns

Promise<void>


cleanup()

ts
cleanup(): Promise<void>;

Clean up worker resources

Returns

Promise<void>


exportImage()

ts
exportImage(payload): Promise<ExportImageResult>;

Export the processed image to a specific format

Parameters

ParameterTypeDescription
payloadExportImagePayloadExport format and quality settings

Returns

Promise<ExportImageResult>

Encoded full-resolution image data

Throws

If no image is loaded or the operation times out


getPreview()

ts
getPreview(): Promise<PreviewResult>;

Get preview of the current processed state

Returns

Promise<PreviewResult>

Encoded preview image data

Throws

If no image is loaded or the operation times out


initialize()

ts
initialize(payload?): Promise<void>;

Initialize the Client Worker with Core.Editor

Parameters

ParameterTypeDescription
payload?InitializePayloadOptional initialization configuration (logging, preview quality/size)

Returns

Promise<void>

Throws

If WASM module fails to load or the operation times out


loadImage()

ts
loadImage(payload): Promise<LoadImageResult>;

Load an image from an ArrayBuffer

Parameters

ParameterTypeDescription
payloadLoadImagePayloadImage buffer and format type

Returns

Promise<LoadImageResult>

Image dimensions and metadata

Throws

If the image cannot be decoded or the operation times out


previewBrightness()

ts
previewBrightness(payload): Promise<PreviewResult>;

Preview brightness adjustment without applying permanently

Parameters

ParameterTypeDescription
payloadPreviewBrightnessPayloadBrightness value

Returns

Promise<PreviewResult>

Preview image data


previewColorGrading()

ts
previewColorGrading(payload): Promise<PreviewResult>;

Preview color grading adjustment without applying permanently

Parameters

ParameterTypeDescription
payloadPreviewColorGradingPayloadShadow, midtone, and highlight color grading parameters

Returns

Promise<PreviewResult>

Preview image data


previewContrast()

ts
previewContrast(payload): Promise<PreviewResult>;

Preview contrast adjustment without applying permanently

Parameters

ParameterTypeDescription
payloadPreviewContrastPayloadContrast value

Returns

Promise<PreviewResult>

Preview image data


previewExposure()

ts
previewExposure(payload): Promise<PreviewResult>;

Preview exposure adjustment without applying permanently

Parameters

ParameterTypeDescription
payloadPreviewExposurePayloadExposure value in stops

Returns

Promise<PreviewResult>

Preview image data


previewHighlightsShadows()

ts
previewHighlightsShadows(payload): Promise<PreviewResult>;

Preview highlights, shadows, and midtones adjustment without applying permanently

Parameters

ParameterTypeDescription
payloadPreviewHighlightsShadowsPayloadHighlights, shadows, and midtones values

Returns

Promise<PreviewResult>

Preview image data


previewSaturation()

ts
previewSaturation(payload): Promise<PreviewResult>;

Preview saturation adjustment without applying permanently

Parameters

ParameterTypeDescription
payloadPreviewSaturationPayloadSaturation value

Returns

Promise<PreviewResult>

Preview image data


previewTemperature()

ts
previewTemperature(payload): Promise<PreviewResult>;

Preview color temperature and tint adjustment without applying permanently

Parameters

ParameterTypeDescription
payloadPreviewTemperaturePayloadTemperature and tint values

Returns

Promise<PreviewResult>

Preview image data


previewTonalCurve()

ts
previewTonalCurve(payload): Promise<PreviewResult>;

Preview tonal curve adjustment without applying permanently

Parameters

ParameterTypeDescription
payloadPreviewTonalCurvePayloadTonal curve control points

Returns

Promise<PreviewResult>

Preview image data


redoOperation()

ts
redoOperation(nodeType): Promise<PreviewResult>;

Redo the next undone operation of the specified type

Parameters

ParameterTypeDescription
nodeTypeNodeTypeThe operation type to redo

Returns

Promise<PreviewResult>

Preview image data after the redo


terminate()

ts
terminate(): Promise<void>;

Terminate the worker and clean up all resources

Returns

Promise<void>


undoOperation()

ts
undoOperation(nodeType): Promise<PreviewResult>;

Undo the last operation of the specified type

Parameters

ParameterTypeDescription
nodeTypeNodeTypeThe operation type to undo

Returns

Promise<PreviewResult>

Preview image data after the undo

Proprietary. All rights reserved.