RemoteDesktop: support 16 bits color space

This commit is contained in:
DanyLE 2022-08-17 22:23:09 +02:00
parent f3a8f17ef1
commit 55787b135b
13 changed files with 46 additions and 37 deletions

View File

@ -7,6 +7,7 @@ Further information on **wvnc**: [https://blog.lxsang.me/post/id/23](https://blo
## Change logs
* v0.1.11 - Support 16 bits per pixel
* v0.1.10 - Allow to sync clipboard between local and remote machine, CTRL+SHIF+V to paste text from local to remote machine
* v0.1.9 - improve stability
* v0.1.7-8 - remove package dependencies, use web assembly for jpeg decoding, improve rendering performance and connection stability

View File

@ -7,6 +7,7 @@ Further information on **wvnc**: [https://blog.lxsang.me/post/id/23](https://blo
## Change logs
* v0.1.11 - Support 16 bits per pixel
* v0.1.10 - Allow to sync clipboard between local and remote machine, CTRL+SHIF+V to paste text from local to remote machine
* v0.1.9 - improve stability
* v0.1.7-8 - remove package dependencies, use web assembly for jpeg decoding, improve rendering performance and connection stability

View File

@ -11,19 +11,20 @@
return api = {
createBuffer: Module.cwrap('create_buffer', 'number', ['number', 'number']),
destroyBuffer: Module.cwrap('destroy_buffer', '', ['number']),
updateBuffer: Module.cwrap("update", 'number', ['number', 'number', 'number', 'number', 'number', 'number']),
decodeBuffer: Module.cwrap("decode", 'number', ['number', 'number', 'number', 'number'])
updateBuffer: Module.cwrap("update", 'number', ['number', 'number', 'number', 'number', 'number']),
decodeBuffer: Module.cwrap("decode", 'number', ['number', 'number', 'number'])
};
};
wasm_update = function(msg) {
var datain, dataout, flag, h, p, po, size, tmp, w, x, y;
var bbp, datain, dataout, flag, h, p, po, size, tmp, w, x, y;
datain = new Uint8Array(msg);
x = datain[1] | (datain[2] << 8);
y = datain[3] | (datain[4] << 8);
w = datain[5] | (datain[6] << 8);
h = datain[7] | (datain[8] << 8);
flag = datain[9];
flag = datain[9] & 0x01;
bbp = datain[9] & 0xFE;
msg = {};
msg.pixels = void 0;
msg.x = x;
@ -31,13 +32,10 @@
msg.w = w;
msg.h = h;
size = w * h * 4;
tmp = new Uint8Array(size);
if (flag === 0) {
tmp.set(datain.subarray(10), 0);
msg.pixels = tmp.buffer;
postMessage(msg, [msg.pixels]);
if (size === 0) {
return;
}
tmp = new Uint8Array(size);
p = api.createBuffer(datain.length);
Module.HEAP8.set(datain, p);
po = api.decodeBuffer(p, datain.length, size);
@ -45,12 +43,14 @@
tmp.set(dataout, 0);
msg.pixels = tmp.buffer;
postMessage(msg, [msg.pixels]);
api.destroyBuffer(po);
return api.destroyBuffer(p);
api.destroyBuffer(p);
if (flag !== 0x0 || bbp !== 32) {
return api.destroyBuffer(po);
}
};
onmessage = function(e) {
if (e.data.depth) {
if (e.data.width) {
return resolution = e.data;
} else {
return wasm_update(e.data);

File diff suppressed because one or more lines are too long

View File

@ -7,7 +7,7 @@
"author": "Dany LE",
"email": "contact@iohub.dev"
},
"version":"0.1.10-b",
"version":"0.1.11-b",
"dependencies": [],
"category":"Internet",
"icon": "icon.png",

View File

@ -138,13 +138,11 @@ class WVNC
initCanvas: (w, h , d) ->
me = @
@depth = d
@canvas.width = w
@canvas.height = h
@resolution =
w: w,
h: h,
depth: @depth
@decoder.postMessage @resolution
#me.canvas.style.cursor = "none"
@setScale @scale
@ -193,13 +191,15 @@ class WVNC
initConnection: (vncserver, params) ->
#vncserver = "192.168.1.20:5901"
data = new Uint8Array vncserver.length + 1
data[0] = 50 # jpeg quality
data = new Uint8Array vncserver.length + 2
data[0] = 16 # bbp
data[1] = 50 # jpeg quality
if params
data[0] = params.quality if params.quality
data[0] = params.bbp if params.bbp
data[1] = params.quality if params.quality
## rate in milisecond
data.set (new TextEncoder()).encode(vncserver), 1
data.set (new TextEncoder()).encode(vncserver), 2
@socket.send(@buildCommand 0x01, data)
resetModifierKeys: () ->
@ -308,8 +308,7 @@ class WVNC
when 0x83
w = data[1] | (data[2]<<8)
h = data[3] | (data[4]<<8)
depth = 32
@initCanvas w, h, depth
@initCanvas w, h
# status command for ack
@socket.send(@buildCommand 0x04, 1)
@enableEvent = true

View File

@ -5,12 +5,17 @@ class ConnectionDialog extends this.OS.GUI.BasicDialog
main: () ->
super.main()
@find("bbp").data = [
{ text: "16 bits", value: 16, selected: true },
{ text: "32 bits", value: 32 }
]
@find("jq").value = 40
@find("bt-ok").onbtclick = (e) =>
return unless @handle
data =
wvnc: (@find "txtWVNC").value
server: (@find "txtServer").value
bbp: (@find "bbp").selectedItem.data.value,
quality:(@find "jq").value
@handle data
@quit()
@ -19,7 +24,7 @@ class ConnectionDialog extends this.OS.GUI.BasicDialog
@quit()
ConnectionDialog.scheme = """
<afx-app-window width='350' height='220'>
<afx-app-window width='350' height='270'>
<afx-hbox>
<div data-width="5"></div>
<afx-vbox>
@ -28,6 +33,9 @@ ConnectionDialog.scheme = """
<afx-label text="__(VNC Server)" data-height="25" class="header" ></afx-label>
<input data-height="25" data-id="txtServer" value="192.168.1.27:5900"></input>
<div data-height="5"></div>
<afx-label text="__(Bits per pixel)" data-height="25" class="header" ></afx-label>
<afx-list-view dropdown = "true" data-id ="bbp" data-height="25" ></afx-list-view>
<div data-height="5"></div>
<afx-label text="__(JPEG quality)" data-height="25" class="header" ></afx-label>
<afx-slider data-id ="jq" data-height="25" ></afx-slider>
<afx-hbox data-height = '30'>

View File

@ -11,19 +11,20 @@
return api = {
createBuffer: Module.cwrap('create_buffer', 'number', ['number', 'number']),
destroyBuffer: Module.cwrap('destroy_buffer', '', ['number']),
updateBuffer: Module.cwrap("update", 'number', ['number', 'number', 'number', 'number', 'number', 'number']),
decodeBuffer: Module.cwrap("decode", 'number', ['number', 'number', 'number', 'number'])
updateBuffer: Module.cwrap("update", 'number', ['number', 'number', 'number', 'number', 'number']),
decodeBuffer: Module.cwrap("decode", 'number', ['number', 'number', 'number'])
};
};
wasm_update = function(msg) {
var datain, dataout, flag, h, p, po, size, tmp, w, x, y;
var bbp, datain, dataout, flag, h, p, po, size, tmp, w, x, y;
datain = new Uint8Array(msg);
x = datain[1] | (datain[2] << 8);
y = datain[3] | (datain[4] << 8);
w = datain[5] | (datain[6] << 8);
h = datain[7] | (datain[8] << 8);
flag = datain[9];
flag = datain[9] & 0x01;
bbp = datain[9] & 0xFE;
msg = {};
msg.pixels = void 0;
msg.x = x;
@ -31,13 +32,10 @@
msg.w = w;
msg.h = h;
size = w * h * 4;
tmp = new Uint8Array(size);
if (flag === 0) {
tmp.set(datain.subarray(10), 0);
msg.pixels = tmp.buffer;
postMessage(msg, [msg.pixels]);
if (size === 0) {
return;
}
tmp = new Uint8Array(size);
p = api.createBuffer(datain.length);
Module.HEAP8.set(datain, p);
po = api.decodeBuffer(p, datain.length, size);
@ -45,12 +43,14 @@
tmp.set(dataout, 0);
msg.pixels = tmp.buffer;
postMessage(msg, [msg.pixels]);
api.destroyBuffer(po);
return api.destroyBuffer(p);
api.destroyBuffer(p);
if (flag !== 0x0 || bbp !== 32) {
return api.destroyBuffer(po);
}
};
onmessage = function(e) {
if (e.data.depth) {
if (e.data.width) {
return resolution = e.data;
} else {
return wasm_update(e.data);

View File

@ -7,7 +7,7 @@
"author": "Dany LE",
"email": "contact@iohub.dev"
},
"version":"0.1.10-b",
"version":"0.1.11-b",
"dependencies": [],
"category":"Internet",
"icon": "icon.png",

View File

@ -365,7 +365,7 @@
"description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/RemoteDesktop/README.md",
"category": "Internet",
"author": "Dany LE",
"version": "0.1.10-b",
"version": "0.1.11-b",
"dependencies": [],"category":"Internet","icon":"icon.png","mimes":["none"],
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/RemoteDesktop/build/release/RemoteDesktop.zip"
},