@illgrenoble/webx-client 1.11.0 → 1.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/WebXClient.d.ts +1 -2
- package/dist/common/WebXImageBlenderFunc.d.ts +26 -0
- package/dist/{display → common}/WebXSubImage.d.ts +5 -5
- package/dist/common/index.d.ts +3 -0
- package/dist/display/WebXCursor.d.ts +5 -17
- package/dist/display/WebXCursorFactory.d.ts +2 -2
- package/dist/display/WebXDisplay.d.ts +11 -10
- package/dist/display/WebXDisplayOverlay.d.ts +10 -0
- package/dist/display/WebXWindow.d.ts +4 -4
- package/dist/display/WebXWindowImageFactory.d.ts +31 -0
- package/dist/display/index.d.ts +0 -6
- package/dist/index.d.ts +2 -0
- package/dist/message/WebXCursorImageMessage.d.ts +3 -3
- package/dist/message/WebXImageMessage.d.ts +4 -4
- package/dist/message/WebXMessage.d.ts +13 -1
- package/dist/message/WebXShapeMessage.d.ts +3 -3
- package/dist/message/WebXSubImagesMessage.d.ts +1 -1
- package/dist/message/WebXWindowsMessage.d.ts +1 -1
- package/dist/renderer/WebXCanvasRenderer.d.ts +1 -2
- package/dist/renderer/{WebXAlphaStencilBlender.d.ts → WebXImageBlender.d.ts} +1 -1
- package/dist/renderer/WebXImageBlenderWorker.d.ts +1 -0
- package/dist/renderer/WebXWindowCanvas.d.ts +27 -8
- package/dist/renderer/index.d.ts +1 -1
- package/dist/texture/WebXTexture.d.ts +18 -0
- package/dist/texture/WebXTextureFactory.d.ts +23 -0
- package/dist/texture/WebXTextureFunc.d.ts +3 -0
- package/dist/texture/index.d.ts +3 -0
- package/dist/transport/WebXBinarySerializer.d.ts +13 -8
- package/dist/transport/WebXMessageBuffer.d.ts +4 -0
- package/dist/transport/WebXMessageDecoder.d.ts +2 -5
- package/dist/transport/WebXMessageDecoderWorker.d.ts +1 -0
- package/dist/transport/WebXMessageFunc.d.ts +22 -0
- package/dist/transport/index.d.ts +0 -2
- package/dist/tunnel/WebXTunnel.d.ts +5 -2
- package/dist/tunnel/WebXWebSocketTunnel.d.ts +2 -4
- package/dist/webx-client.cjs +1 -0
- package/dist/webx-client.esm.js +1 -0
- package/package.json +12 -9
- package/dist/WebXClient.js +0 -513
- package/dist/WebXClient.js.map +0 -1
- package/dist/WebXConnectionHandler.js +0 -96
- package/dist/WebXConnectionHandler.js.map +0 -1
- package/dist/WebXEngine.js +0 -7
- package/dist/WebXEngine.js.map +0 -1
- package/dist/display/WebXCursor.js +0 -150
- package/dist/display/WebXCursor.js.map +0 -1
- package/dist/display/WebXCursorFactory.js +0 -59
- package/dist/display/WebXCursorFactory.js.map +0 -1
- package/dist/display/WebXDisplay.js +0 -501
- package/dist/display/WebXDisplay.js.map +0 -1
- package/dist/display/WebXMaterial.js +0 -142
- package/dist/display/WebXMaterial.js.map +0 -1
- package/dist/display/WebXSubImage.js +0 -26
- package/dist/display/WebXSubImage.js.map +0 -1
- package/dist/display/WebXTextureFactory.d.ts +0 -54
- package/dist/display/WebXTextureFactory.js +0 -160
- package/dist/display/WebXTextureFactory.js.map +0 -1
- package/dist/display/WebXWindow.js +0 -475
- package/dist/display/WebXWindow.js.map +0 -1
- package/dist/display/WebXWindowProperties.js +0 -25
- package/dist/display/WebXWindowProperties.js.map +0 -1
- package/dist/display/index.js +0 -24
- package/dist/display/index.js.map +0 -1
- package/dist/index.js +0 -25
- package/dist/index.js.map +0 -1
- package/dist/input/GuacamoleKeyboard.js +0 -1551
- package/dist/input/WebXKeyboard.js +0 -44
- package/dist/input/WebXKeyboard.js.map +0 -1
- package/dist/input/WebXMouse.js +0 -231
- package/dist/input/WebXMouse.js.map +0 -1
- package/dist/input/index.js +0 -20
- package/dist/input/index.js.map +0 -1
- package/dist/input/mouse/WebXMouseState.js +0 -217
- package/dist/input/mouse/WebXMouseState.js.map +0 -1
- package/dist/input/mouse/index.js +0 -18
- package/dist/input/mouse/index.js.map +0 -1
- package/dist/instruction/WebXClipboardInstruction.js +0 -23
- package/dist/instruction/WebXClipboardInstruction.js.map +0 -1
- package/dist/instruction/WebXConnectInstruction.js +0 -24
- package/dist/instruction/WebXConnectInstruction.js.map +0 -1
- package/dist/instruction/WebXCursorImageInstruction.js +0 -23
- package/dist/instruction/WebXCursorImageInstruction.js.map +0 -1
- package/dist/instruction/WebXDataAckInstruction.js +0 -26
- package/dist/instruction/WebXDataAckInstruction.js.map +0 -1
- package/dist/instruction/WebXImageInstruction.js +0 -23
- package/dist/instruction/WebXImageInstruction.js.map +0 -1
- package/dist/instruction/WebXInstruction.js +0 -28
- package/dist/instruction/WebXInstruction.js.map +0 -1
- package/dist/instruction/WebXInstructionResponse.js +0 -78
- package/dist/instruction/WebXInstructionResponse.js.map +0 -1
- package/dist/instruction/WebXInstructionType.js +0 -96
- package/dist/instruction/WebXInstructionType.js.map +0 -1
- package/dist/instruction/WebXKeyboardInstruction.js +0 -25
- package/dist/instruction/WebXKeyboardInstruction.js.map +0 -1
- package/dist/instruction/WebXMouseInstruction.js +0 -27
- package/dist/instruction/WebXMouseInstruction.js.map +0 -1
- package/dist/instruction/WebXPongInstruction.js +0 -23
- package/dist/instruction/WebXPongInstruction.js.map +0 -1
- package/dist/instruction/WebXQualityInstruction.js +0 -24
- package/dist/instruction/WebXQualityInstruction.js.map +0 -1
- package/dist/instruction/WebXScreenInstruction.js +0 -20
- package/dist/instruction/WebXScreenInstruction.js.map +0 -1
- package/dist/instruction/WebXShapeInstruction.js +0 -23
- package/dist/instruction/WebXShapeInstruction.js.map +0 -1
- package/dist/instruction/WebXWindowsInstruction.js +0 -21
- package/dist/instruction/WebXWindowsInstruction.js.map +0 -1
- package/dist/instruction/index.js +0 -32
- package/dist/instruction/index.js.map +0 -1
- package/dist/message/WebXClipboardMessage.js +0 -23
- package/dist/message/WebXClipboardMessage.js.map +0 -1
- package/dist/message/WebXConnectionMessage.js +0 -21
- package/dist/message/WebXConnectionMessage.js.map +0 -1
- package/dist/message/WebXCursorImageMessage.js +0 -35
- package/dist/message/WebXCursorImageMessage.js.map +0 -1
- package/dist/message/WebXImageMessage.js +0 -33
- package/dist/message/WebXImageMessage.js.map +0 -1
- package/dist/message/WebXMessage.js +0 -23
- package/dist/message/WebXMessage.js.map +0 -1
- package/dist/message/WebXMessageType.js +0 -64
- package/dist/message/WebXMessageType.js.map +0 -1
- package/dist/message/WebXMouseMessage.js +0 -29
- package/dist/message/WebXMouseMessage.js.map +0 -1
- package/dist/message/WebXNopMessage.js +0 -18
- package/dist/message/WebXNopMessage.js.map +0 -1
- package/dist/message/WebXPingMessage.js +0 -21
- package/dist/message/WebXPingMessage.js.map +0 -1
- package/dist/message/WebXQualityMessage.js +0 -32
- package/dist/message/WebXQualityMessage.js.map +0 -1
- package/dist/message/WebXScreenMessage.js +0 -29
- package/dist/message/WebXScreenMessage.js.map +0 -1
- package/dist/message/WebXShapeMessage.js +0 -29
- package/dist/message/WebXShapeMessage.js.map +0 -1
- package/dist/message/WebXSubImagesMessage.js +0 -29
- package/dist/message/WebXSubImagesMessage.js.map +0 -1
- package/dist/message/WebXWindowsMessage.js +0 -25
- package/dist/message/WebXWindowsMessage.js.map +0 -1
- package/dist/message/index.js +0 -31
- package/dist/message/index.js.map +0 -1
- package/dist/renderer/WebXAlphaStencilBlender.js +0 -136
- package/dist/renderer/WebXAlphaStencilBlender.js.map +0 -1
- package/dist/renderer/WebXBlenderWorker.d.ts +0 -1
- package/dist/renderer/WebXBlenderWorker.js +0 -33
- package/dist/renderer/WebXBlenderWorker.js.map +0 -1
- package/dist/renderer/WebXCanvasRenderer.js +0 -190
- package/dist/renderer/WebXCanvasRenderer.js.map +0 -1
- package/dist/renderer/WebXWindowBlender.d.ts +0 -11
- package/dist/renderer/WebXWindowBlender.js +0 -27
- package/dist/renderer/WebXWindowBlender.js.map +0 -1
- package/dist/renderer/WebXWindowCanvas.js +0 -306
- package/dist/renderer/WebXWindowCanvas.js.map +0 -1
- package/dist/renderer/blender.d.ts +0 -5
- package/dist/renderer/blender.js +0 -201
- package/dist/renderer/blender.js.map +0 -1
- package/dist/renderer/index.js +0 -20
- package/dist/renderer/index.js.map +0 -1
- package/dist/tracer/WebXDebugImageMessageHandler.js +0 -102
- package/dist/tracer/WebXDebugImageMessageHandler.js.map +0 -1
- package/dist/tracer/WebXHandler.js +0 -3
- package/dist/tracer/WebXHandler.js.map +0 -1
- package/dist/tracer/WebXInstructionHandler.js +0 -13
- package/dist/tracer/WebXInstructionHandler.js.map +0 -1
- package/dist/tracer/WebXMessageHandler.js +0 -13
- package/dist/tracer/WebXMessageHandler.js.map +0 -1
- package/dist/tracer/WebXStatsHandler.js +0 -13
- package/dist/tracer/WebXStatsHandler.js.map +0 -1
- package/dist/tracer/index.js +0 -22
- package/dist/tracer/index.js.map +0 -1
- package/dist/transport/WebXBinarySerializer.js +0 -63
- package/dist/transport/WebXBinarySerializer.js.map +0 -1
- package/dist/transport/WebXInstructionBuffer.js +0 -109
- package/dist/transport/WebXInstructionBuffer.js.map +0 -1
- package/dist/transport/WebXInstructionEncoder.js +0 -294
- package/dist/transport/WebXInstructionEncoder.js.map +0 -1
- package/dist/transport/WebXMessageBuffer.js +0 -104
- package/dist/transport/WebXMessageBuffer.js.map +0 -1
- package/dist/transport/WebXMessageDecoder.js +0 -333
- package/dist/transport/WebXMessageDecoder.js.map +0 -1
- package/dist/transport/index.js +0 -22
- package/dist/transport/index.js.map +0 -1
- package/dist/tunnel/WebXTunnel.js +0 -156
- package/dist/tunnel/WebXTunnel.js.map +0 -1
- package/dist/tunnel/WebXWebSocketTunnel.js +0 -88
- package/dist/tunnel/WebXWebSocketTunnel.js.map +0 -1
- package/dist/tunnel/index.js +0 -19
- package/dist/tunnel/index.js.map +0 -1
- package/dist/utils/WebXColorGenerator.js +0 -46
- package/dist/utils/WebXColorGenerator.js.map +0 -1
- package/dist/utils/WebXVersion.js +0 -25
- package/dist/utils/WebXVersion.js.map +0 -1
- package/dist/utils/index.js +0 -19
- package/dist/utils/index.js.map +0 -1
- /package/dist/{display → common}/WebXWindowProperties.d.ts +0 -0
package/dist/WebXClient.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { WebXTunnel } from './tunnel';
|
|
|
2
2
|
import { WebXDisplay } from './display';
|
|
3
3
|
import { WebXKeyboard, WebXMouse, WebXMouseState } from './input';
|
|
4
4
|
import { WebXDebugImageMessageHandler, WebXHandler } from './tracer';
|
|
5
|
-
import { Blob } from "buffer";
|
|
6
5
|
/**
|
|
7
6
|
* Configuration options for the WebXClient.
|
|
8
7
|
*/
|
|
@@ -20,7 +19,7 @@ export interface WebXClientConfig {
|
|
|
20
19
|
*/
|
|
21
20
|
export declare class WebXClient {
|
|
22
21
|
private _tunnel;
|
|
23
|
-
private readonly
|
|
22
|
+
private readonly _windowImageFactory;
|
|
24
23
|
private readonly _cursorFactory;
|
|
25
24
|
private _tracers;
|
|
26
25
|
private _onCloseCallback;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Alpha and stencil buffer blending function. The alpha buffer contains alpha data in the
|
|
3
|
+
* green channel. The stencil buffer is a black and white image: only pixels with a stencil value > 127 are to be rendered
|
|
4
|
+
* @param colorData the color data array
|
|
5
|
+
* @param alphaData the alpha data array
|
|
6
|
+
* @param stencilData the stencil data array
|
|
7
|
+
*/
|
|
8
|
+
export declare const alphaAndStencilBlend: (colorData: Uint8ClampedArray, alphaData: Uint8ClampedArray, stencilData: Uint8ClampedArray) => void;
|
|
9
|
+
/**
|
|
10
|
+
* The Alpha buffer blending function. The alpha buffer contains alpha data in the
|
|
11
|
+
* green channel.
|
|
12
|
+
* @param colorData the color data array
|
|
13
|
+
* @param alphaData the alpha data array
|
|
14
|
+
*/
|
|
15
|
+
export declare const alphaBufferBlend: (colorData: Uint8ClampedArray, alphaData: Uint8ClampedArray) => void;
|
|
16
|
+
/**
|
|
17
|
+
* The Alpha image blending function. The alpha image contains alpha image data
|
|
18
|
+
* @param colorImage the color image array
|
|
19
|
+
* @param alphaImage the alpha image
|
|
20
|
+
*/
|
|
21
|
+
export declare const colorAndAlphaBlendImageToImageData: (colorImage: ImageBitmap | HTMLImageElement, alphaImage: ImageBitmap | HTMLImageElement) => ImageData;
|
|
22
|
+
/**
|
|
23
|
+
* Draws an image to a canvas to obtain the raw image data
|
|
24
|
+
* @param image the image
|
|
25
|
+
*/
|
|
26
|
+
export declare const imageToImageData: (image: ImageBitmap | HTMLImageElement) => ImageData;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { WebXTexture } from "../texture";
|
|
2
2
|
/**
|
|
3
3
|
* Represents a sub-image within a WebX window.
|
|
4
4
|
*
|
|
@@ -28,11 +28,11 @@ export declare class WebXSubImage {
|
|
|
28
28
|
/**
|
|
29
29
|
* The color map texture of the sub-image.
|
|
30
30
|
*/
|
|
31
|
-
readonly colorMap:
|
|
31
|
+
readonly colorMap: WebXTexture;
|
|
32
32
|
/**
|
|
33
33
|
* The alpha map texture of the sub-image.
|
|
34
34
|
*/
|
|
35
|
-
readonly alphaMap:
|
|
35
|
+
readonly alphaMap: WebXTexture;
|
|
36
36
|
/**
|
|
37
37
|
* Creates a new instance of WebXSubImage.
|
|
38
38
|
*
|
|
@@ -44,7 +44,7 @@ export declare class WebXSubImage {
|
|
|
44
44
|
width: number;
|
|
45
45
|
height: number;
|
|
46
46
|
depth: number;
|
|
47
|
-
colorMap:
|
|
48
|
-
alphaMap:
|
|
47
|
+
colorMap: WebXTexture;
|
|
48
|
+
alphaMap: WebXTexture;
|
|
49
49
|
});
|
|
50
50
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import { Texture } from 'three';
|
|
3
1
|
import { WebXCursorFactory } from './WebXCursorFactory';
|
|
4
2
|
/**
|
|
5
3
|
* Represents the cursor in the WebX display.
|
|
@@ -9,11 +7,10 @@ import { WebXCursorFactory } from './WebXCursorFactory';
|
|
|
9
7
|
*/
|
|
10
8
|
export declare class WebXCursor {
|
|
11
9
|
private _cursorFactory;
|
|
12
|
-
private static _PLANE_GEOMETRY;
|
|
13
10
|
private _cursorId;
|
|
14
11
|
private _texture;
|
|
15
|
-
private readonly
|
|
16
|
-
private readonly
|
|
12
|
+
private readonly _canvas;
|
|
13
|
+
private readonly _context;
|
|
17
14
|
private _x;
|
|
18
15
|
private _y;
|
|
19
16
|
private _xHot;
|
|
@@ -21,23 +18,17 @@ export declare class WebXCursor {
|
|
|
21
18
|
private _width;
|
|
22
19
|
private _height;
|
|
23
20
|
/**
|
|
24
|
-
* Gets the
|
|
21
|
+
* Gets the HTML Canvas containing the cursor image.
|
|
25
22
|
*
|
|
26
|
-
* @returns The cursor
|
|
23
|
+
* @returns The cursor canvas.
|
|
27
24
|
*/
|
|
28
|
-
get
|
|
25
|
+
get canvas(): HTMLCanvasElement;
|
|
29
26
|
/**
|
|
30
27
|
* Gets the cursor ID.
|
|
31
28
|
*
|
|
32
29
|
* @returns The cursor ID.
|
|
33
30
|
*/
|
|
34
31
|
get cursorId(): number;
|
|
35
|
-
/**
|
|
36
|
-
* Gets the texture of the cursor.
|
|
37
|
-
*
|
|
38
|
-
* @returns The cursor texture.
|
|
39
|
-
*/
|
|
40
|
-
get texture(): Texture;
|
|
41
32
|
/**
|
|
42
33
|
* Sets the x-coordinate of the cursor.
|
|
43
34
|
*
|
|
@@ -66,12 +57,9 @@ export declare class WebXCursor {
|
|
|
66
57
|
/**
|
|
67
58
|
* Updates the cursor's position and appearance based on the given cursor ID and coordinates.
|
|
68
59
|
*
|
|
69
|
-
* @param x The x-coordinate of the cursor.
|
|
70
|
-
* @param y The y-coordinate of the cursor.
|
|
71
60
|
* @param cursorId The ID of the cursor to display.
|
|
72
61
|
*/
|
|
73
62
|
setCursorId(cursorId: number): void;
|
|
74
|
-
dispose(): void;
|
|
75
63
|
/**
|
|
76
64
|
* Updates the mouse cursor, appearance, and texture.
|
|
77
65
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WebXTunnel } from '../tunnel';
|
|
2
|
-
import {
|
|
2
|
+
import { WebXTexture } from "../texture";
|
|
3
3
|
/**
|
|
4
4
|
* Interface representing cursor data.
|
|
5
5
|
*/
|
|
@@ -7,7 +7,7 @@ export interface WebXCursorData {
|
|
|
7
7
|
xHot: number;
|
|
8
8
|
yHot: number;
|
|
9
9
|
cursorId: number;
|
|
10
|
-
texture:
|
|
10
|
+
texture: WebXTexture;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* Factory class for creating and managing cursor textures.
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
|
-
import { OrthographicCamera
|
|
2
|
+
import { OrthographicCamera } from 'three';
|
|
3
3
|
import { WebXWindow } from './WebXWindow';
|
|
4
|
-
import { WebXWindowProperties } from '
|
|
5
|
-
import { WebXSubImage } from './WebXSubImage';
|
|
6
|
-
import { WebXTextureFactory } from './WebXTextureFactory';
|
|
4
|
+
import { WebXSubImage, WebXWindowProperties } from '../common';
|
|
7
5
|
import { WebXCursorFactory } from './WebXCursorFactory';
|
|
8
6
|
import { WebXCanvasRenderer } from '../renderer';
|
|
9
|
-
import {
|
|
7
|
+
import { WebXWindowImageFactory } from "./WebXWindowImageFactory";
|
|
8
|
+
import { WebXTexture } from "../texture";
|
|
10
9
|
/**
|
|
11
10
|
* Manages the rendering of the WebX remote desktop using WebGL.
|
|
12
11
|
*
|
|
@@ -21,15 +20,17 @@ export declare class WebXDisplay {
|
|
|
21
20
|
private readonly _screen;
|
|
22
21
|
private readonly _screenWidth;
|
|
23
22
|
private readonly _screenHeight;
|
|
24
|
-
private readonly
|
|
23
|
+
private readonly _windowImageFactory;
|
|
25
24
|
private readonly _containerElement;
|
|
26
25
|
private _windows;
|
|
27
26
|
private _cursor;
|
|
28
27
|
private _scale;
|
|
29
28
|
private _displayElement;
|
|
30
29
|
private _boundsElement;
|
|
30
|
+
private _displayOverlay;
|
|
31
31
|
private _disposed;
|
|
32
32
|
private _sceneDirty;
|
|
33
|
+
private _disableStencil;
|
|
33
34
|
/**
|
|
34
35
|
* Gets the WebGL renderer used for rendering the display.
|
|
35
36
|
*
|
|
@@ -88,10 +89,10 @@ export declare class WebXDisplay {
|
|
|
88
89
|
* @param containerElement The HTML element to render the display.
|
|
89
90
|
* @param screenWidth The width of the screen.
|
|
90
91
|
* @param screenHeight The height of the screen.
|
|
91
|
-
* @param
|
|
92
|
+
* @param windowImageFactory The factory used for obtaining window images.
|
|
92
93
|
* @param cursorFactory The cursor factory used for managing cursors.
|
|
93
94
|
*/
|
|
94
|
-
constructor(containerElement: HTMLElement, screenWidth: number, screenHeight: number,
|
|
95
|
+
constructor(containerElement: HTMLElement, screenWidth: number, screenHeight: number, windowImageFactory: WebXWindowImageFactory, cursorFactory: WebXCursorFactory);
|
|
95
96
|
/**
|
|
96
97
|
* Displays the screen by adding it to the scene.
|
|
97
98
|
*/
|
|
@@ -156,7 +157,7 @@ export declare class WebXDisplay {
|
|
|
156
157
|
* @param colorMap The color texture.
|
|
157
158
|
* @param alphaMap The alpha texture.
|
|
158
159
|
*/
|
|
159
|
-
updateImage(windowId: number, depth: number, colorMap:
|
|
160
|
+
updateImage(windowId: number, depth: number, colorMap: WebXTexture, alphaMap: WebXTexture): void;
|
|
160
161
|
/**
|
|
161
162
|
* Updates sub-images of a window with new image data.
|
|
162
163
|
*
|
|
@@ -170,7 +171,7 @@ export declare class WebXDisplay {
|
|
|
170
171
|
* @param windowId The ID of the window to update.
|
|
171
172
|
* @param stencilMap The stencil texture.
|
|
172
173
|
*/
|
|
173
|
-
updateShape(windowId: number, stencilMap:
|
|
174
|
+
updateShape(windowId: number, stencilMap: WebXTexture): void;
|
|
174
175
|
/**
|
|
175
176
|
* Updates the mouse cursor on the display.
|
|
176
177
|
*
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { WebXCursor } from "./WebXCursor";
|
|
2
|
+
export declare class WebXDisplayOverlay {
|
|
3
|
+
private _cursor;
|
|
4
|
+
private readonly _overlayElement;
|
|
5
|
+
get overlayElement(): HTMLElement;
|
|
6
|
+
set visible(visible: boolean);
|
|
7
|
+
constructor(_cursor: WebXCursor);
|
|
8
|
+
update(): void;
|
|
9
|
+
private _createDisplayOverlayElement;
|
|
10
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
|
-
import { WebXTextureFactory } from './WebXTextureFactory';
|
|
3
2
|
import { Texture } from 'three';
|
|
3
|
+
import { WebXWindowImageFactory } from "./WebXWindowImageFactory";
|
|
4
4
|
/**
|
|
5
5
|
* Represents a window in the WebX display.
|
|
6
6
|
*
|
|
@@ -11,7 +11,7 @@ export declare class WebXWindow {
|
|
|
11
11
|
static WINDOW_REFRESH_TIME_MS: number;
|
|
12
12
|
private static _PLANE_GEOMETRY;
|
|
13
13
|
private static _COLOR_INDEX;
|
|
14
|
-
private readonly
|
|
14
|
+
private readonly _windowImageFactory;
|
|
15
15
|
private readonly _colorIndex;
|
|
16
16
|
private readonly _id;
|
|
17
17
|
private readonly _material;
|
|
@@ -182,7 +182,7 @@ export declare class WebXWindow {
|
|
|
182
182
|
* Creates a new instance of WebXWindow.
|
|
183
183
|
*
|
|
184
184
|
* @param configuration The properties of the window, such as position and size.
|
|
185
|
-
* @param
|
|
185
|
+
* @param windowImageFactory The factory used to create textures for the window.
|
|
186
186
|
*/
|
|
187
187
|
constructor(configuration: {
|
|
188
188
|
id: number;
|
|
@@ -192,7 +192,7 @@ export declare class WebXWindow {
|
|
|
192
192
|
width: number;
|
|
193
193
|
height: number;
|
|
194
194
|
shaped: boolean;
|
|
195
|
-
},
|
|
195
|
+
}, windowImageFactory: WebXWindowImageFactory);
|
|
196
196
|
/**
|
|
197
197
|
* Loads the window image from the texture factory.
|
|
198
198
|
*/
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { WebXTunnel } from '../tunnel';
|
|
2
|
+
import { WebXTexture } from "../texture";
|
|
3
|
+
/**
|
|
4
|
+
* Factory class for request textures for WebX windows.
|
|
5
|
+
*
|
|
6
|
+
* This class retrieves textures from the WebX Engine
|
|
7
|
+
*/
|
|
8
|
+
export declare class WebXWindowImageFactory {
|
|
9
|
+
private _tunnel;
|
|
10
|
+
constructor(_tunnel: WebXTunnel);
|
|
11
|
+
/**
|
|
12
|
+
* Retrieves the textures (colorMap and alphaMap) for a specific window ID from the WebX Engine.
|
|
13
|
+
*
|
|
14
|
+
* @param windowId The ID of the window to retrieve the texture for.
|
|
15
|
+
* @returns A promise that resolves to the textures and associated data.
|
|
16
|
+
*/
|
|
17
|
+
getWindowTexture(windowId: number): Promise<{
|
|
18
|
+
depth: number;
|
|
19
|
+
colorMap: WebXTexture;
|
|
20
|
+
alphaMap: WebXTexture;
|
|
21
|
+
}>;
|
|
22
|
+
/**
|
|
23
|
+
* Retrieves the stencil textures for a specific window ID from the WebX Engine.
|
|
24
|
+
*
|
|
25
|
+
* @param windowId The ID of the window to retrieve the texture for.
|
|
26
|
+
* @returns A promise that resolves to the stencil texture
|
|
27
|
+
*/
|
|
28
|
+
getWindowStencilTexture(windowId: number): Promise<{
|
|
29
|
+
stencilMap: WebXTexture;
|
|
30
|
+
}>;
|
|
31
|
+
}
|
package/dist/display/index.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WebXMessage } from './WebXMessage';
|
|
2
|
-
import {
|
|
2
|
+
import { WebXTexture } from "../texture";
|
|
3
3
|
/**
|
|
4
4
|
* Represents a message containing cursor image data.
|
|
5
5
|
*
|
|
@@ -22,7 +22,7 @@ export declare class WebXCursorImageMessage extends WebXMessage {
|
|
|
22
22
|
/**
|
|
23
23
|
* The texture of the cursor.
|
|
24
24
|
*/
|
|
25
|
-
readonly texture:
|
|
25
|
+
readonly texture: WebXTexture;
|
|
26
26
|
/**
|
|
27
27
|
* The x-coordinate of the cursor's position.
|
|
28
28
|
*/
|
|
@@ -42,5 +42,5 @@ export declare class WebXCursorImageMessage extends WebXMessage {
|
|
|
42
42
|
* @param y The y-coordinate of the cursor's position.
|
|
43
43
|
* @param commandId The ID of the command associated with this message.
|
|
44
44
|
*/
|
|
45
|
-
constructor(x: number, y: number, xHot: number, yHot: number, cursorId: number, texture:
|
|
45
|
+
constructor(x: number, y: number, xHot: number, yHot: number, cursorId: number, texture: WebXTexture, commandId: number);
|
|
46
46
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WebXMessage } from './WebXMessage';
|
|
2
|
-
import {
|
|
2
|
+
import { WebXTexture } from "../texture";
|
|
3
3
|
/**
|
|
4
4
|
* Represents a message containing image data for a window.
|
|
5
5
|
*
|
|
@@ -18,11 +18,11 @@ export declare class WebXImageMessage extends WebXMessage {
|
|
|
18
18
|
/**
|
|
19
19
|
* The color texture of the image.
|
|
20
20
|
*/
|
|
21
|
-
readonly colorMap:
|
|
21
|
+
readonly colorMap: WebXTexture;
|
|
22
22
|
/**
|
|
23
23
|
* The alpha texture of the image.
|
|
24
24
|
*/
|
|
25
|
-
readonly alphaMap:
|
|
25
|
+
readonly alphaMap: WebXTexture;
|
|
26
26
|
/**
|
|
27
27
|
* The size of the image.
|
|
28
28
|
*/
|
|
@@ -37,5 +37,5 @@ export declare class WebXImageMessage extends WebXMessage {
|
|
|
37
37
|
* @param commandId The ID of the command associated with this message.
|
|
38
38
|
* @param size The size of the image.
|
|
39
39
|
*/
|
|
40
|
-
constructor(windowId: number, depth: number, colorMap:
|
|
40
|
+
constructor(windowId: number, depth: number, colorMap: WebXTexture, alphaMap: WebXTexture, commandId: number, size: number);
|
|
41
41
|
}
|
|
@@ -14,11 +14,23 @@ export declare abstract class WebXMessage {
|
|
|
14
14
|
* The ID of the command associated with this message.
|
|
15
15
|
*/
|
|
16
16
|
readonly commandId: number;
|
|
17
|
+
/**
|
|
18
|
+
* Used to globally set function of web worker when decoding messages
|
|
19
|
+
*/
|
|
20
|
+
private static _convertToImageDataInWorker;
|
|
17
21
|
/**
|
|
18
22
|
* Constructs a new WebXMessage.
|
|
19
23
|
*
|
|
20
24
|
* @param type The type of the message.
|
|
21
25
|
* @param commandId The ID of the command associated with this message.
|
|
22
26
|
*/
|
|
23
|
-
constructor(type: WebXMessageType, commandId?: number);
|
|
27
|
+
protected constructor(type: WebXMessageType, commandId?: number);
|
|
28
|
+
/**
|
|
29
|
+
* Get the flag to determine if images should be converted to image data in a worker
|
|
30
|
+
*/
|
|
31
|
+
static get convertToImageDataInWorker(): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Set the flag to specify whether images should be converted to image data in a worker
|
|
34
|
+
*/
|
|
35
|
+
static set convertToImageDataInWorker(value: boolean);
|
|
24
36
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WebXMessage } from './WebXMessage';
|
|
2
|
-
import {
|
|
2
|
+
import { WebXTexture } from "../texture";
|
|
3
3
|
/**
|
|
4
4
|
* Represents a message containing image data for a window.
|
|
5
5
|
*
|
|
@@ -14,7 +14,7 @@ export declare class WebXShapeMessage extends WebXMessage {
|
|
|
14
14
|
/**
|
|
15
15
|
* The stencil texture of the window.
|
|
16
16
|
*/
|
|
17
|
-
readonly stencilMap:
|
|
17
|
+
readonly stencilMap: WebXTexture;
|
|
18
18
|
/**
|
|
19
19
|
* The size of the image.
|
|
20
20
|
*/
|
|
@@ -27,5 +27,5 @@ export declare class WebXShapeMessage extends WebXMessage {
|
|
|
27
27
|
* @param commandId The ID of the command associated with this message.
|
|
28
28
|
* @param size The size of the image.
|
|
29
29
|
*/
|
|
30
|
-
constructor(windowId: number, stencilMap:
|
|
30
|
+
constructor(windowId: number, stencilMap: WebXTexture, commandId: number, size: number);
|
|
31
31
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Camera, ColorRepresentation, Object3D, Texture, Vector2 } from 'three';
|
|
2
|
-
import { Blob } from "buffer";
|
|
3
2
|
/**
|
|
4
3
|
* The `WebXCanvasRenderer` class is responsible for rendering a desktop-like environment
|
|
5
4
|
* using HTML elements. It integrates with the Three.js library using 3D objects (meshes, materials, textures)
|
|
@@ -11,7 +10,7 @@ export declare class WebXCanvasRenderer {
|
|
|
11
10
|
private _desktopContainer;
|
|
12
11
|
private _desktop;
|
|
13
12
|
private _clearColor;
|
|
14
|
-
private readonly
|
|
13
|
+
private readonly _imageBlender;
|
|
15
14
|
private _windowCanvases;
|
|
16
15
|
/**
|
|
17
16
|
* Gets the root DOM element of the renderer.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* The `WebXAlphaStencilBlender` class handles blending of alpha and stencil data
|
|
3
3
|
* for rendering purposes. It uses a Web Worker for asynchronous processing.
|
|
4
4
|
*/
|
|
5
|
-
export declare class
|
|
5
|
+
export declare class WebXImageBlender {
|
|
6
6
|
private readonly _worker;
|
|
7
7
|
private _pending;
|
|
8
8
|
private _nextId;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Mesh, Texture, Vector2 } from "three";
|
|
2
|
-
import {
|
|
2
|
+
import { WebXImageBlender } from "./WebXImageBlender";
|
|
3
3
|
/**
|
|
4
4
|
* The `WebXWindowCanvas` class holds the graphical elements necessary for rendering
|
|
5
5
|
* a specific window in the desktop environment. HTML Canvases are used for rendering image data. Window image data
|
|
@@ -7,11 +7,10 @@ import { WebXAlphaStencilBlender } from "./WebXAlphaStencilBlender";
|
|
|
7
7
|
*/
|
|
8
8
|
export declare class WebXWindowCanvas {
|
|
9
9
|
private readonly _mesh;
|
|
10
|
-
private readonly
|
|
10
|
+
private readonly _imageBlender;
|
|
11
11
|
private readonly _canvas;
|
|
12
12
|
private _context;
|
|
13
|
-
private
|
|
14
|
-
private _stencilContext;
|
|
13
|
+
private _stencilData;
|
|
15
14
|
private _x;
|
|
16
15
|
private _y;
|
|
17
16
|
private _zIndex;
|
|
@@ -53,9 +52,9 @@ export declare class WebXWindowCanvas {
|
|
|
53
52
|
* Initializes a new `WebXWindowCanvas` for the given window Mesh and Material. The Mesh and Material contains all graphical information
|
|
54
53
|
* necessary to render a window (namely window position, size and z-order), the Mesh Material contains the graphical information (color, alpha and stencil data).
|
|
55
54
|
* @param _mesh - The `Mesh` object representing the window.
|
|
56
|
-
* @param
|
|
55
|
+
* @param _imageBlender - The image blender instance.
|
|
57
56
|
*/
|
|
58
|
-
constructor(_mesh: Mesh,
|
|
57
|
+
constructor(_mesh: Mesh, _imageBlender: WebXImageBlender);
|
|
59
58
|
/**
|
|
60
59
|
* Updates the geometry of the window canvas based on the mesh's properties if any changes are needed.
|
|
61
60
|
*/
|
|
@@ -78,6 +77,7 @@ export declare class WebXWindowCanvas {
|
|
|
78
77
|
* @param dstPosition - The destination position of the region.
|
|
79
78
|
*/
|
|
80
79
|
addRegionUpdate(srcColorMap: Texture, dstColorMap: Texture, srcAlphaMap: Texture, dstAlphaMap: Texture, width: number, height: number, dstPosition: Vector2): void;
|
|
80
|
+
private resizeCanvas;
|
|
81
81
|
/**
|
|
82
82
|
* Handles all pending region updates for the canvas. The different buffers (color, alpha and stencil) are blended (in a web
|
|
83
83
|
* worker if available) and then re-rendered into the main canvas of the window. If the window has only a color buffer then this
|
|
@@ -98,8 +98,8 @@ export declare class WebXWindowCanvas {
|
|
|
98
98
|
/**
|
|
99
99
|
* Prepares temporary canvases to renderer the image data (jpeg format) into raw pixmaps. The pixmap data for the different
|
|
100
100
|
* images is sent to the blender for processing.
|
|
101
|
-
* @param
|
|
102
|
-
* @param
|
|
101
|
+
* @param colorMap - The color texture.
|
|
102
|
+
* @param alphaMap - The alpha texture.
|
|
103
103
|
* @param dstX - The destination X position.
|
|
104
104
|
* @param dstY - The destination Y position.
|
|
105
105
|
* @returns A promise that resolves to the blended `ImageData`.
|
|
@@ -111,4 +111,23 @@ export declare class WebXWindowCanvas {
|
|
|
111
111
|
* @returns The created `HTMLElement`.
|
|
112
112
|
*/
|
|
113
113
|
private createElementNS;
|
|
114
|
+
/**
|
|
115
|
+
* Generates ImageData from an image (ImageBitmap | HTMLImageElement) by creating a temporary canvas
|
|
116
|
+
* and drawing the image onto it. The raw image data is then read from the canvas.
|
|
117
|
+
* @param image the image to convert to ImageData
|
|
118
|
+
*/
|
|
119
|
+
private getImageData;
|
|
120
|
+
/**
|
|
121
|
+
* Converts raw image data from TextureImageData into an ImageData object. Ensures that the raw data is a Uin8ClampedArray
|
|
122
|
+
* @param textureData the raw image data from a TextureData
|
|
123
|
+
*/
|
|
124
|
+
private dataTextureToImageData;
|
|
125
|
+
/**
|
|
126
|
+
* Returns a region of the stencil data as a new ImageData object
|
|
127
|
+
* @param x the x position of the region
|
|
128
|
+
* @param y the y position of the region
|
|
129
|
+
* @param width the width of the region
|
|
130
|
+
* @param height the height of the region
|
|
131
|
+
*/
|
|
132
|
+
private getStencilDataRegion;
|
|
114
133
|
}
|
package/dist/renderer/index.d.ts
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const SRGBColorSpace = "srgb";
|
|
2
|
+
export declare const LinearSRGBColorSpace = "srgb-linear";
|
|
3
|
+
export declare class WebXTexture {
|
|
4
|
+
image: ImageBitmap | HTMLImageElement;
|
|
5
|
+
data: Uint8ClampedArray;
|
|
6
|
+
colorSpace: string;
|
|
7
|
+
flipY: boolean;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
constructor(data: {
|
|
11
|
+
image?: ImageBitmap | HTMLImageElement;
|
|
12
|
+
data?: Uint8ClampedArray;
|
|
13
|
+
width?: number;
|
|
14
|
+
height?: number;
|
|
15
|
+
});
|
|
16
|
+
isTransferable(): boolean;
|
|
17
|
+
get transferable(): Transferable;
|
|
18
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { WebXTexture } from "./WebXTexture";
|
|
2
|
+
/**
|
|
3
|
+
* Factory class for creating textures for WebX windows from image data.
|
|
4
|
+
*/
|
|
5
|
+
export declare class WebXTextureFactory {
|
|
6
|
+
constructor();
|
|
7
|
+
/**
|
|
8
|
+
* Creates a texture from raw image data.
|
|
9
|
+
*
|
|
10
|
+
* @param imageData The raw image data as a Uint8Array.
|
|
11
|
+
* @param mimetype The MIME type of the image data (e.g., "image/png").
|
|
12
|
+
* @param colorSpace The color space of the image data (e.g., "srgb").
|
|
13
|
+
* @returns A promise that resolves to the created texture.
|
|
14
|
+
*/
|
|
15
|
+
createTextureFromArray(imageData: Uint8Array, mimetype: string, colorSpace: string): Promise<WebXTexture>;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a texture from a Blob object.
|
|
18
|
+
*
|
|
19
|
+
* @param blob The Blob object containing the image data.
|
|
20
|
+
* @returns A promise that resolves to the created texture.
|
|
21
|
+
*/
|
|
22
|
+
createTextureFromBlob(blob: Blob): Promise<WebXTexture>;
|
|
23
|
+
}
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import { WebXInstruction } from '../instruction';
|
|
2
2
|
import { WebXMessage } from '../message';
|
|
3
|
-
import { WebXMessageBuffer } from
|
|
4
|
-
import { WebXTextureFactory } from '../display';
|
|
3
|
+
import { WebXMessageBuffer } from "./WebXMessageBuffer";
|
|
5
4
|
/**
|
|
6
5
|
* Serializes and deserializes WebX instructions and messages.
|
|
7
6
|
*/
|
|
8
7
|
export declare class WebXBinarySerializer {
|
|
9
8
|
private readonly _instructionEncoder;
|
|
10
9
|
private readonly _messageDecoder;
|
|
10
|
+
private readonly _worker;
|
|
11
|
+
private _pending;
|
|
12
|
+
private _nextId;
|
|
11
13
|
/**
|
|
12
14
|
* Creates a new instance of WebXBinarySerializer.
|
|
13
|
-
*
|
|
14
|
-
* @param textureFactory The texture factory used for decoding image data.
|
|
15
15
|
*/
|
|
16
|
-
constructor(
|
|
16
|
+
constructor();
|
|
17
|
+
/**
|
|
18
|
+
* Terminates the Web Worker and clears pending tasks.
|
|
19
|
+
*/
|
|
20
|
+
terminate(): void;
|
|
17
21
|
/**
|
|
18
22
|
* Serializes a WebXInstruction into a binary ArrayBuffer.
|
|
19
23
|
*
|
|
@@ -22,10 +26,11 @@ export declare class WebXBinarySerializer {
|
|
|
22
26
|
*/
|
|
23
27
|
serializeInstruction(instruction: WebXInstruction): ArrayBuffer;
|
|
24
28
|
/**
|
|
25
|
-
* Deserializes a binary message buffer into a WebXMessage object.
|
|
29
|
+
* Deserializes a binary message buffer into a WebXMessage object. A web worker is used if available
|
|
30
|
+
* and the message should be decoded in a separate thread.
|
|
26
31
|
*
|
|
27
|
-
* @param
|
|
32
|
+
* @param messageBuffer The binary message buffer to deserialize.
|
|
28
33
|
* @returns A promise that resolves to the deserialized WebXMessage.
|
|
29
34
|
*/
|
|
30
|
-
deserializeMessage(
|
|
35
|
+
deserializeMessage(messageBuffer: WebXMessageBuffer): Promise<WebXMessage>;
|
|
31
36
|
}
|