mirror of
https://github.com/danbulant/node-x11
synced 2026-06-08 01:01:13 +00:00
Add Render.AddGlyphsFromPicture request
This commit is contained in:
parent
4bddee6d5e
commit
15c7149c6a
1 changed files with 806 additions and 669 deletions
|
|
@ -5,19 +5,14 @@ var xutil = require('../xutil');
|
||||||
// http://cgit.freedesktop.org/xcb/proto/tree/src/render.xml?id=HEAD
|
// http://cgit.freedesktop.org/xcb/proto/tree/src/render.xml?id=HEAD
|
||||||
// and http://www.x.org/releases/X11R7.6/doc/renderproto/renderproto.txt
|
// and http://www.x.org/releases/X11R7.6/doc/renderproto/renderproto.txt
|
||||||
// TODO: move to templates
|
// TODO: move to templates
|
||||||
exports.requireExt = function(display, callback)
|
exports.requireExt = function(display, callback) {
|
||||||
{
|
|
||||||
|
|
||||||
var X = display.client;
|
var X = display.client;
|
||||||
X.QueryExtension('RENDER', function(err, ext) {
|
X.QueryExtension('RENDER', function(err, ext) {
|
||||||
|
if (!ext.present) {
|
||||||
if (!ext.present)
|
|
||||||
{
|
|
||||||
return callback(new Error('extension not available'));
|
return callback(new Error('extension not available'));
|
||||||
}
|
}
|
||||||
|
|
||||||
ext.QueryVersion = function(clientMaj, clientMin, callback)
|
ext.QueryVersion = function(clientMaj, clientMin, callback) {
|
||||||
{
|
|
||||||
X.seq_num++;
|
X.seq_num++;
|
||||||
X.pack_stream.pack('CCSLL', [ext.majorOpcode, 0, 3, clientMaj, clientMin]);
|
X.pack_stream.pack('CCSLL', [ext.majorOpcode, 0, 3, clientMaj, clientMin]);
|
||||||
X.replies[X.seq_num] = [
|
X.replies[X.seq_num] = [
|
||||||
|
|
@ -28,14 +23,13 @@ exports.requireExt = function(display, callback)
|
||||||
callback
|
callback
|
||||||
];
|
];
|
||||||
X.pack_stream.flush();
|
X.pack_stream.flush();
|
||||||
}
|
};
|
||||||
|
|
||||||
ext.QueryPictFormat = function(callback)
|
ext.QueryPictFormat = function(callback) {
|
||||||
{
|
|
||||||
X.pack_stream.pack('CCS', [ext.majorOpcode, 1, 1]);
|
X.pack_stream.pack('CCS', [ext.majorOpcode, 1, 1]);
|
||||||
X.seq_num++;
|
X.seq_num++;
|
||||||
X.replies[X.seq_num] = [
|
X.replies[X.seq_num] = [
|
||||||
function (buf, opt) {
|
function(buf, opt) {
|
||||||
var res = {};
|
var res = {};
|
||||||
var res1 = buf.unpack('LLLLL');
|
var res1 = buf.unpack('LLLLL');
|
||||||
var num_formats = res1[0];
|
var num_formats = res1[0];
|
||||||
|
|
@ -46,8 +40,7 @@ exports.requireExt = function(display, callback)
|
||||||
// formats list:
|
// formats list:
|
||||||
var offset = 24;
|
var offset = 24;
|
||||||
res.formats = [];
|
res.formats = [];
|
||||||
for (var i=0; i < num_formats; ++i)
|
for (var i = 0; i < num_formats; ++i) {
|
||||||
{
|
|
||||||
var format = {};
|
var format = {};
|
||||||
var f = buf.unpack('LCCxxSSSSSSSSL', offset);
|
var f = buf.unpack('LCCxxSSSSSSSSL', offset);
|
||||||
res.formats.push(f);
|
res.formats.push(f);
|
||||||
|
|
@ -58,10 +51,9 @@ exports.requireExt = function(display, callback)
|
||||||
callback
|
callback
|
||||||
];
|
];
|
||||||
X.pack_stream.flush();
|
X.pack_stream.flush();
|
||||||
}
|
};
|
||||||
|
|
||||||
ext.QueryFilters = function(callback)
|
ext.QueryFilters = function(callback) {
|
||||||
{
|
|
||||||
X.pack_stream.pack('CCSL', [ext.majorOpcode, 29, 2, display.screen[0].root]);
|
X.pack_stream.pack('CCSL', [ext.majorOpcode, 29, 2, display.screen[0].root]);
|
||||||
X.seq_num++;
|
X.seq_num++;
|
||||||
X.replies[X.seq_num] = [
|
X.replies[X.seq_num] = [
|
||||||
|
|
@ -71,26 +63,24 @@ exports.requireExt = function(display, callback)
|
||||||
var num_filters = h[1];
|
var num_filters = h[1];
|
||||||
var aliases = [];
|
var aliases = [];
|
||||||
var offset = 24; // LL + 16 bytes pad
|
var offset = 24; // LL + 16 bytes pad
|
||||||
for (var i=0; i < num_aliases; ++i)
|
for (var i = 0; i < num_aliases; ++i) {
|
||||||
{
|
|
||||||
aliases.push(buf.unpack('S', offset)[0]);
|
aliases.push(buf.unpack('S', offset)[0]);
|
||||||
offset+=2;
|
offset += 2;
|
||||||
}
|
}
|
||||||
var filters = [];
|
var filters = [];
|
||||||
for (var i=0; i < num_filters; ++i)
|
for (var i = 0; i < num_filters; ++i) {
|
||||||
{
|
|
||||||
var len = buf.unpack('C', offset)[0];
|
var len = buf.unpack('C', offset)[0];
|
||||||
//if (!len) break;
|
//if (!len) break;
|
||||||
offset++;
|
offset++;
|
||||||
filters.push(buf.toString('ascii', offset, offset+len));
|
filters.push(buf.toString('ascii', offset, offset + len));
|
||||||
offset+=len;
|
offset += len;
|
||||||
}
|
}
|
||||||
return [aliases, filters];
|
return [aliases, filters];
|
||||||
},
|
},
|
||||||
callback
|
callback
|
||||||
];
|
];
|
||||||
X.pack_stream.flush();
|
X.pack_stream.flush();
|
||||||
}
|
};
|
||||||
|
|
||||||
var valueList = [
|
var valueList = [
|
||||||
['repeat', 'Cxxx'],
|
['repeat', 'Cxxx'],
|
||||||
|
|
@ -116,22 +106,19 @@ exports.requireExt = function(display, callback)
|
||||||
x: 1
|
x: 1
|
||||||
};
|
};
|
||||||
|
|
||||||
ext.CreatePicture = function(pid, drawable, pictformat, values)
|
ext.CreatePicture = function(pid, drawable, pictformat, values) {
|
||||||
{
|
|
||||||
var mask = 0;
|
var mask = 0;
|
||||||
var reqLen = 5; // + (values + pad)/4
|
var reqLen = 5; // + (values + pad)/4
|
||||||
var format = 'CCSLLLL';
|
var format = 'CCSLLLL';
|
||||||
var params = [ext.majorOpcode, 4, reqLen, pid, drawable, pictformat, mask];
|
var params = [ext.majorOpcode, 4, reqLen, pid, drawable, pictformat, mask];
|
||||||
|
|
||||||
if (values)
|
if (values) {
|
||||||
{
|
|
||||||
var valuesLength = 0;
|
var valuesLength = 0;
|
||||||
for (var i=0; i < valueList.length; ++i)
|
for (var i = 0; i < valueList.length; ++i) {
|
||||||
{
|
|
||||||
var name = valueList[i][0];
|
var name = valueList[i][0];
|
||||||
var val = values[name];
|
var val = values[name];
|
||||||
if (val) {
|
if (val) {
|
||||||
mask |= (1 << i);
|
mask |= 1 << i;
|
||||||
params.push(val);
|
params.push(val);
|
||||||
var valueFormat = valueList[i][1];
|
var valueFormat = valueList[i][1];
|
||||||
format += valueFormat;
|
format += valueFormat;
|
||||||
|
|
@ -140,8 +127,7 @@ exports.requireExt = function(display, callback)
|
||||||
}
|
}
|
||||||
var pad4 = (valuesLength + 3) >> 2;
|
var pad4 = (valuesLength + 3) >> 2;
|
||||||
var toPad = (pad4 << 2) - valuesLength;
|
var toPad = (pad4 << 2) - valuesLength;
|
||||||
for (var i=0; i < toPad; ++i)
|
for (var i = 0; i < toPad; ++i) format += 'x';
|
||||||
format += 'x';
|
|
||||||
reqLen += pad4;
|
reqLen += pad4;
|
||||||
params[2] = reqLen;
|
params[2] = reqLen;
|
||||||
params[6] = mask;
|
params[6] = mask;
|
||||||
|
|
@ -149,7 +135,7 @@ exports.requireExt = function(display, callback)
|
||||||
X.pack_stream.pack(format, params);
|
X.pack_stream.pack(format, params);
|
||||||
X.pack_stream.flush();
|
X.pack_stream.flush();
|
||||||
X.seq_num++;
|
X.seq_num++;
|
||||||
}
|
};
|
||||||
|
|
||||||
ext.FreePicture = function(pid) {
|
ext.FreePicture = function(pid) {
|
||||||
X.pack_stream.pack('CCSL', [ext.majorOpcode, 7, 2, pid]);
|
X.pack_stream.pack('CCSL', [ext.majorOpcode, 7, 2, pid]);
|
||||||
|
|
@ -157,16 +143,14 @@ exports.requireExt = function(display, callback)
|
||||||
X.seq_num++;
|
X.seq_num++;
|
||||||
};
|
};
|
||||||
|
|
||||||
function floatToFix(f)
|
function floatToFix(f) {
|
||||||
{
|
return parseInt(f * 65536);
|
||||||
return parseInt(f*65536);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function colorToFix(f)
|
function colorToFix(f) {
|
||||||
{
|
|
||||||
if (f < 0) f = 0;
|
if (f < 0) f = 0;
|
||||||
if (f > 1) f = 1;
|
if (f > 1) f = 1;
|
||||||
return parseInt(f*65535);
|
return parseInt(f * 65535);
|
||||||
}
|
}
|
||||||
|
|
||||||
ext.SetPictureTransform = function(pid, matrix) {
|
ext.SetPictureTransform = function(pid, matrix) {
|
||||||
|
|
@ -174,7 +158,7 @@ exports.requireExt = function(display, callback)
|
||||||
if (matrix.length !== 9)
|
if (matrix.length !== 9)
|
||||||
throw 'Render.SetPictureTransform: incorrect transform matrix. Must be array of 9 numbers';
|
throw 'Render.SetPictureTransform: incorrect transform matrix. Must be array of 9 numbers';
|
||||||
var params = [ext.majorOpcode, 28, 11, pid];
|
var params = [ext.majorOpcode, 28, 11, pid];
|
||||||
for (var i=0; i < 9; ++i) {
|
for (var i = 0; i < 9; ++i) {
|
||||||
if (typeof matrix[i] !== 'number')
|
if (typeof matrix[i] !== 'number')
|
||||||
throw 'Render.SetPictureTransform: matrix element must be a number';
|
throw 'Render.SetPictureTransform: matrix element must be a number';
|
||||||
params.push(floatToFix(matrix[i]));
|
params.push(floatToFix(matrix[i]));
|
||||||
|
|
@ -185,35 +169,43 @@ exports.requireExt = function(display, callback)
|
||||||
};
|
};
|
||||||
|
|
||||||
// see example of blur filter here: https://github.com/richoH/rxvt-unicode/blob/master/src/background.C
|
// see example of blur filter here: https://github.com/richoH/rxvt-unicode/blob/master/src/background.C
|
||||||
ext.SetPictureFilter = function(pid, name, filterParams)
|
ext.SetPictureFilter = function(pid, name, filterParams) {
|
||||||
{
|
if (filterParams === 0) filterParams = [0];
|
||||||
if (filterParams === 0)
|
if (!filterParams) filterParams = [];
|
||||||
filterParams = [0];
|
if (!Array.isArray(filterParams)) filterParams = [filterParams];
|
||||||
if (!filterParams)
|
|
||||||
filterParams = [];
|
|
||||||
if (!Array.isArray(filterParams))
|
|
||||||
filterParams = [filterParams];
|
|
||||||
|
|
||||||
var reqLen = 2;
|
var reqLen = 2;
|
||||||
var format = 'CCSLSxxp';
|
var format = 'CCSLSxxp';
|
||||||
var params = [ext.majorOpcode, 30, reqLen, pid, name.length, name];
|
var params = [ext.majorOpcode, 30, reqLen, pid, name.length, name];
|
||||||
reqLen += xutil.padded_length(name.length+3)/4 + filterParams.length;
|
reqLen += xutil.padded_length(name.length + 3) / 4 + filterParams.length;
|
||||||
|
|
||||||
if (name == 'nearest' || name == 'bilinear' || name == 'fast' || name == 'good' || name == 'best') {
|
if (
|
||||||
|
name == 'nearest' ||
|
||||||
|
name == 'bilinear' ||
|
||||||
|
name == 'fast' ||
|
||||||
|
name == 'good' ||
|
||||||
|
name == 'best'
|
||||||
|
) {
|
||||||
if (filterParams.length !== 0) {
|
if (filterParams.length !== 0) {
|
||||||
throw 'Render.SetPictureFilter: "' + name + '" - unexpected parameters for filters';
|
throw 'Render.SetPictureFilter: "' + name + '" - unexpected parameters for filters';
|
||||||
}
|
}
|
||||||
} else if (name == 'convolution') {
|
} else if (name == 'convolution') {
|
||||||
if (filterParams.length < 2 || ((filterParams[0]*filterParams[1] + 2) !== filterParams.length) ) {
|
if (
|
||||||
|
filterParams.length < 2 ||
|
||||||
|
filterParams[0] * filterParams[1] + 2 !== filterParams.length
|
||||||
|
) {
|
||||||
throw 'Render.SetPictureFilter: "convolution" - incorrect matrix dimensions. Must be flat array [ w, h, elem1, elem2, ... ]';
|
throw 'Render.SetPictureFilter: "convolution" - incorrect matrix dimensions. Must be flat array [ w, h, elem1, elem2, ... ]';
|
||||||
}
|
}
|
||||||
for (var i=0; i < filterParams.length; ++i) {
|
for (var i = 0; i < filterParams.length; ++i) {
|
||||||
format += 'L';
|
format += 'L';
|
||||||
params.push(floatToFix(filterParams[i]));
|
params.push(floatToFix(filterParams[i]));
|
||||||
}
|
}
|
||||||
} else if (name == 'binomial' || name == 'gaussian') {
|
} else if (name == 'binomial' || name == 'gaussian') {
|
||||||
if (filterParams.length !== 1) {
|
if (filterParams.length !== 1) {
|
||||||
throw 'Render.SetPictureFilter: "' + name + '" - incorrect number of parameters, must be exactly 1 number, instead got: ' + filterParams;
|
throw 'Render.SetPictureFilter: "' +
|
||||||
|
name +
|
||||||
|
'" - incorrect number of parameters, must be exactly 1 number, instead got: ' +
|
||||||
|
filterParams;
|
||||||
}
|
}
|
||||||
format += 'L';
|
format += 'L';
|
||||||
params.push(floatToFix(filterParams[0]));
|
params.push(floatToFix(filterParams[0]));
|
||||||
|
|
@ -226,16 +218,23 @@ exports.requireExt = function(display, callback)
|
||||||
X.seq_num++;
|
X.seq_num++;
|
||||||
};
|
};
|
||||||
|
|
||||||
ext.CreateSolidFill = function(pid, r, g, b, a)
|
ext.CreateSolidFill = function(pid, r, g, b, a) {
|
||||||
{
|
X.pack_stream.pack('CCSLSSSS', [
|
||||||
X.pack_stream.pack('CCSLSSSS', [ext.majorOpcode, 33, 4, pid, colorToFix(r), colorToFix(g), colorToFix(b), colorToFix(a)]);
|
ext.majorOpcode,
|
||||||
|
33,
|
||||||
|
4,
|
||||||
|
pid,
|
||||||
|
colorToFix(r),
|
||||||
|
colorToFix(g),
|
||||||
|
colorToFix(b),
|
||||||
|
colorToFix(a)
|
||||||
|
]);
|
||||||
X.pack_stream.flush();
|
X.pack_stream.flush();
|
||||||
X.seq_num++;
|
X.seq_num++;
|
||||||
};
|
};
|
||||||
|
|
||||||
ext.RadialGradient = function(pid, p1, p2, r1, r2, stops)
|
ext.RadialGradient = function(pid, p1, p2, r1, r2, stops) {
|
||||||
{
|
var reqLen = 9 + stops.length * 3; //header + params + 1xStopfix+2xColors
|
||||||
var reqLen = 9+stops.length*3; //header + params + 1xStopfix+2xColors
|
|
||||||
var format = 'CCSLLLLLLLL';
|
var format = 'CCSLLLLLLLL';
|
||||||
var params = [ext.majorOpcode, 35, reqLen, pid];
|
var params = [ext.majorOpcode, 35, reqLen, pid];
|
||||||
params.push(floatToFix(p1[0])); // L
|
params.push(floatToFix(p1[0])); // L
|
||||||
|
|
@ -248,27 +247,23 @@ exports.requireExt = function(display, callback)
|
||||||
|
|
||||||
// [ [float stopDist, [float r, g, b, a] ], ...]
|
// [ [float stopDist, [float r, g, b, a] ], ...]
|
||||||
// stop distances
|
// stop distances
|
||||||
for (var i=0; i < stops.length; ++i)
|
for (var i = 0; i < stops.length; ++i) {
|
||||||
{
|
|
||||||
format += 'L';
|
format += 'L';
|
||||||
// TODO: we know total params length in advance. ? params[index] =
|
// TODO: we know total params length in advance. ? params[index] =
|
||||||
params.push(floatToFix(stops[i][0]))
|
params.push(floatToFix(stops[i][0]));
|
||||||
}
|
}
|
||||||
// colors
|
// colors
|
||||||
for (var i=0; i < stops.length; ++i)
|
for (var i = 0; i < stops.length; ++i) {
|
||||||
{
|
|
||||||
format += 'SSSS';
|
format += 'SSSS';
|
||||||
for (var j=0; j < 4; ++j)
|
for (var j = 0; j < 4; ++j) params.push(colorToFix(stops[i][1][j]));
|
||||||
params.push(colorToFix(stops[i][1][j]));
|
|
||||||
}
|
}
|
||||||
X.pack_stream.pack(format, params);
|
X.pack_stream.pack(format, params);
|
||||||
X.pack_stream.flush();
|
X.pack_stream.flush();
|
||||||
X.seq_num++;
|
X.seq_num++;
|
||||||
};
|
};
|
||||||
|
|
||||||
ext.LinearGradient = function(pid, p1, p2, stops)
|
ext.LinearGradient = function(pid, p1, p2, stops) {
|
||||||
{
|
var reqLen = 7 + stops.length * 3; //header + params + 1xStopfix+2xColors
|
||||||
var reqLen = 7+stops.length*3; //header + params + 1xStopfix+2xColors
|
|
||||||
var format = 'CCSLLLLLL';
|
var format = 'CCSLLLLLL';
|
||||||
var params = [ext.majorOpcode, 34, reqLen, pid];
|
var params = [ext.majorOpcode, 34, reqLen, pid];
|
||||||
params.push(floatToFix(p1[0])); // L
|
params.push(floatToFix(p1[0])); // L
|
||||||
|
|
@ -280,27 +275,23 @@ exports.requireExt = function(display, callback)
|
||||||
|
|
||||||
// [ [float stopDist, [float r, g, b, a] ], ...]
|
// [ [float stopDist, [float r, g, b, a] ], ...]
|
||||||
// stop distances
|
// stop distances
|
||||||
for (var i=0; i < stops.length; ++i)
|
for (var i = 0; i < stops.length; ++i) {
|
||||||
{
|
|
||||||
format += 'L';
|
format += 'L';
|
||||||
// TODO: we know total params length in advance. ? params[index] =
|
// TODO: we know total params length in advance. ? params[index] =
|
||||||
params.push(floatToFix(stops[i][0]))
|
params.push(floatToFix(stops[i][0]));
|
||||||
}
|
}
|
||||||
// colors
|
// colors
|
||||||
for (var i=0; i < stops.length; ++i)
|
for (var i = 0; i < stops.length; ++i) {
|
||||||
{
|
|
||||||
format += 'SSSS';
|
format += 'SSSS';
|
||||||
for (var j=0; j < 4; ++j)
|
for (var j = 0; j < 4; ++j) params.push(colorToFix(stops[i][1][j]));
|
||||||
params.push(colorToFix(stops[i][1][j]));
|
|
||||||
}
|
}
|
||||||
X.pack_stream.pack(format, params);
|
X.pack_stream.pack(format, params);
|
||||||
X.pack_stream.flush();
|
X.pack_stream.flush();
|
||||||
X.seq_num++;
|
X.seq_num++;
|
||||||
}
|
};
|
||||||
|
|
||||||
ext.ConicalGradient = function(pid, center, angle, stops)
|
ext.ConicalGradient = function(pid, center, angle, stops) {
|
||||||
{
|
var reqLen = 6 + stops.length * 3; //header + params + 1xStopfix+2xColors
|
||||||
var reqLen = 6+stops.length*3; //header + params + 1xStopfix+2xColors
|
|
||||||
var format = 'CCSLLLLL';
|
var format = 'CCSLLLLL';
|
||||||
var params = [ext.majorOpcode, 36, reqLen, pid];
|
var params = [ext.majorOpcode, 36, reqLen, pid];
|
||||||
params.push(floatToFix(center[0])); // L
|
params.push(floatToFix(center[0])); // L
|
||||||
|
|
@ -311,64 +302,81 @@ exports.requireExt = function(display, callback)
|
||||||
|
|
||||||
// [ [float stopDist, [float r, g, b, a] ], ...]
|
// [ [float stopDist, [float r, g, b, a] ], ...]
|
||||||
// stop distances
|
// stop distances
|
||||||
for (var i=0; i < stops.length; ++i)
|
for (var i = 0; i < stops.length; ++i) {
|
||||||
{
|
|
||||||
format += 'L';
|
format += 'L';
|
||||||
// TODO: we know total params length in advance. ? params[index] =
|
// TODO: we know total params length in advance. ? params[index] =
|
||||||
params.push(floatToFix(stops[i][0]))
|
params.push(floatToFix(stops[i][0]));
|
||||||
}
|
}
|
||||||
// colors
|
// colors
|
||||||
for (var i=0; i < stops.length; ++i)
|
for (var i = 0; i < stops.length; ++i) {
|
||||||
{
|
|
||||||
format += 'SSSS';
|
format += 'SSSS';
|
||||||
for (var j=0; j < 4; ++j)
|
for (var j = 0; j < 4; ++j) params.push(colorToFix(stops[i][1][j]));
|
||||||
params.push(colorToFix(stops[i][1][j]));
|
|
||||||
}
|
}
|
||||||
X.pack_stream.pack(format, params);
|
X.pack_stream.pack(format, params);
|
||||||
X.pack_stream.flush();
|
X.pack_stream.flush();
|
||||||
X.seq_num++;
|
X.seq_num++;
|
||||||
}
|
};
|
||||||
|
|
||||||
ext.FillRectangles = function(op, pid, color, rects)
|
ext.FillRectangles = function(op, pid, color, rects) {
|
||||||
{
|
var reqLen = 5 + rects.length / 2;
|
||||||
var reqLen = 5+rects.length/2;
|
|
||||||
var format = 'CCSCxxxLSSSS';
|
var format = 'CCSCxxxLSSSS';
|
||||||
var params = [ext.majorOpcode, 26, reqLen, op, pid];
|
var params = [ext.majorOpcode, 26, reqLen, op, pid];
|
||||||
for (var j=0; j < 4; ++j)
|
for (var j = 0; j < 4; ++j) params.push(colorToFix(color[j]));
|
||||||
params.push(colorToFix(color[j]));
|
for (var i = 0; i < rects.length; i += 4) {
|
||||||
for (var i=0; i < rects.length; i+=4)
|
|
||||||
{
|
|
||||||
format += 'ssSS';
|
format += 'ssSS';
|
||||||
params.push(rects[i*4]);
|
params.push(rects[i * 4]);
|
||||||
params.push(rects[i*4 + 1]);
|
params.push(rects[i * 4 + 1]);
|
||||||
params.push(rects[i*4 + 2]);
|
params.push(rects[i * 4 + 2]);
|
||||||
params.push(rects[i*4 + 3]);
|
params.push(rects[i * 4 + 3]);
|
||||||
}
|
}
|
||||||
X.pack_stream.pack(format, params);
|
X.pack_stream.pack(format, params);
|
||||||
X.pack_stream.flush();
|
X.pack_stream.flush();
|
||||||
X.seq_num++;
|
X.seq_num++;
|
||||||
}
|
};
|
||||||
|
|
||||||
ext.Composite = function(op, src, mask, dst, srcX, srcY, maskX, maskY, dstX, dstY, width, height)
|
ext.Composite = function(
|
||||||
{
|
op,
|
||||||
X.pack_stream.pack(
|
src,
|
||||||
'CCSCxxxLLLssssssSS',
|
mask,
|
||||||
[ext.majorOpcode, 8, 9, op, src, mask, dst, srcX, srcY, maskX, maskY, dstX, dstY, width, height]
|
dst,
|
||||||
)
|
srcX,
|
||||||
|
srcY,
|
||||||
|
maskX,
|
||||||
|
maskY,
|
||||||
|
dstX,
|
||||||
|
dstY,
|
||||||
|
width,
|
||||||
|
height
|
||||||
|
) {
|
||||||
|
X.pack_stream
|
||||||
|
.pack('CCSCxxxLLLssssssSS', [
|
||||||
|
ext.majorOpcode,
|
||||||
|
8,
|
||||||
|
9,
|
||||||
|
op,
|
||||||
|
src,
|
||||||
|
mask,
|
||||||
|
dst,
|
||||||
|
srcX,
|
||||||
|
srcY,
|
||||||
|
maskX,
|
||||||
|
maskY,
|
||||||
|
dstX,
|
||||||
|
dstY,
|
||||||
|
width,
|
||||||
|
height
|
||||||
|
])
|
||||||
.flush();
|
.flush();
|
||||||
X.seq_num++;
|
X.seq_num++;
|
||||||
}
|
};
|
||||||
|
|
||||||
// note that Trapezoids is considered deprecated by Render extension
|
// note that Trapezoids is considered deprecated by Render extension
|
||||||
ext.Trapezoids = function(op, src, srcX, srcY, dst, maskFormat, trapz)
|
ext.Trapezoids = function(op, src, srcX, srcY, dst, maskFormat, trapz) {
|
||||||
{
|
|
||||||
var format = 'CCSCxxxLLLss';
|
var format = 'CCSCxxxLLLss';
|
||||||
var params = [ext.majorOpcode, 10, 6+trapz.length, op, src, dst, maskFormat, srcX, srcY];
|
var params = [ext.majorOpcode, 10, 6 + trapz.length, op, src, dst, maskFormat, srcX, srcY];
|
||||||
for (var i=0; i < trapz.length; i++)
|
for (var i = 0; i < trapz.length; i++) {
|
||||||
{
|
|
||||||
format += 'llllllllll';
|
format += 'llllllllll';
|
||||||
for (var j=0; j < 10; ++j)
|
for (var j = 0; j < 10; ++j) params.push(floatToFix(trapz[i * 10 + j]));
|
||||||
params.push(floatToFix(trapz[i*10 + j]));
|
|
||||||
}
|
}
|
||||||
X.pack_stream.pack(format, params);
|
X.pack_stream.pack(format, params);
|
||||||
X.pack_stream.flush();
|
X.pack_stream.flush();
|
||||||
|
|
@ -377,9 +385,8 @@ exports.requireExt = function(display, callback)
|
||||||
|
|
||||||
ext.AddTraps = function(pic, offX, offY, trapList) {
|
ext.AddTraps = function(pic, offX, offY, trapList) {
|
||||||
var format = 'CCSLss';
|
var format = 'CCSLss';
|
||||||
var params = [ext.majorOpcode, 32, 3+trapList.length, pic, offX, offY];
|
var params = [ext.majorOpcode, 32, 3 + trapList.length, pic, offX, offY];
|
||||||
for (var i=0; i < trapList.length; i++)
|
for (var i = 0; i < trapList.length; i++) {
|
||||||
{
|
|
||||||
format += 'l';
|
format += 'l';
|
||||||
params.push(floatToFix(trapList[i]));
|
params.push(floatToFix(trapList[i]));
|
||||||
}
|
}
|
||||||
|
|
@ -388,12 +395,10 @@ exports.requireExt = function(display, callback)
|
||||||
X.seq_num++;
|
X.seq_num++;
|
||||||
};
|
};
|
||||||
|
|
||||||
ext.Triangles = function(op, src, srcX, srcY, dst, maskFormat, tris)
|
ext.Triangles = function(op, src, srcX, srcY, dst, maskFormat, tris) {
|
||||||
{
|
|
||||||
var format = 'CCSCxxxLLLss';
|
var format = 'CCSCxxxLLLss';
|
||||||
var params = [ext.majorOpcode, 11, 6+tris.length, op, src, dst, maskFormat, srcX, srcY];
|
var params = [ext.majorOpcode, 11, 6 + tris.length, op, src, dst, maskFormat, srcX, srcY];
|
||||||
for (var i=0; i < tris.length; i+=6)
|
for (var i = 0; i < tris.length; i += 6) {
|
||||||
{
|
|
||||||
format += 'llllll';
|
format += 'llllll';
|
||||||
//TODO: Array.copy
|
//TODO: Array.copy
|
||||||
params.push(floatToFix(tris[i + 0])); // x1
|
params.push(floatToFix(tris[i + 0])); // x1
|
||||||
|
|
@ -406,25 +411,25 @@ exports.requireExt = function(display, callback)
|
||||||
X.pack_stream.pack(format, params);
|
X.pack_stream.pack(format, params);
|
||||||
X.pack_stream.flush();
|
X.pack_stream.flush();
|
||||||
X.seq_num++;
|
X.seq_num++;
|
||||||
}
|
};
|
||||||
|
|
||||||
ext.CreateGlyphSet = function(gsid, format) {
|
ext.CreateGlyphSet = function(gsid, format) {
|
||||||
X.pack_stream.pack('CCSLL', [ext.majorOpcode, 17, 3, gsid, format]);
|
X.pack_stream.pack('CCSLL', [ext.majorOpcode, 17, 3, gsid, format]);
|
||||||
X.pack_stream.flush();
|
X.pack_stream.flush();
|
||||||
X.seq_num++;
|
X.seq_num++;
|
||||||
}
|
};
|
||||||
|
|
||||||
ext.ReferenceGlyphSet = function(gsid, existing) {
|
ext.ReferenceGlyphSet = function(gsid, existing) {
|
||||||
X.pack_stream.pack('CCSLL', [ext.majorOpcode, 18, 3, gsid, existing]);
|
X.pack_stream.pack('CCSLL', [ext.majorOpcode, 18, 3, gsid, existing]);
|
||||||
X.pack_stream.flush();
|
X.pack_stream.flush();
|
||||||
X.seq_num++;
|
X.seq_num++;
|
||||||
}
|
};
|
||||||
|
|
||||||
ext.FreeGlyphSet = function(gsid) {
|
ext.FreeGlyphSet = function(gsid) {
|
||||||
X.pack_stream.pack('CCSL', [ext.majorOpcode, 19, 2, gsid]);
|
X.pack_stream.pack('CCSL', [ext.majorOpcode, 19, 2, gsid]);
|
||||||
X.pack_stream.flush();
|
X.pack_stream.flush();
|
||||||
X.seq_num++;
|
X.seq_num++;
|
||||||
}
|
};
|
||||||
|
|
||||||
ext.AddGlyphs = function(gsid, glyphs) {
|
ext.AddGlyphs = function(gsid, glyphs) {
|
||||||
var numGlyphs = glyphs.length;
|
var numGlyphs = glyphs.length;
|
||||||
|
|
@ -436,11 +441,11 @@ exports.requireExt = function(display, callback)
|
||||||
for (var i = 0; i < numGlyphs; i++) {
|
for (var i = 0; i < numGlyphs; i++) {
|
||||||
glyph = glyphs[i];
|
glyph = glyphs[i];
|
||||||
if (glyph.width % 4 !== 0) {
|
if (glyph.width % 4 !== 0) {
|
||||||
var stride = (glyph.width+3)&~3;
|
var stride = (glyph.width + 3) & ~3;
|
||||||
var res = Buffer.alloc(glyph.height*stride);
|
var res = Buffer.alloc(glyph.height * stride);
|
||||||
res.fill(0);
|
res.fill(0);
|
||||||
for (var y=0; y < glyph.height; ++y) {
|
for (var y = 0; y < glyph.height; ++y) {
|
||||||
glyph.image.copy(res, y*stride, y*glyph.width, y*glyph.width + glyph.width);
|
glyph.image.copy(res, y * stride, y * glyph.width, y * glyph.width + glyph.width);
|
||||||
}
|
}
|
||||||
glyph.image = res;
|
glyph.image = res;
|
||||||
glyph.width = stride;
|
glyph.width = stride;
|
||||||
|
|
@ -450,12 +455,12 @@ exports.requireExt = function(display, callback)
|
||||||
glyph.offX = glyph.offX / 64;
|
glyph.offX = glyph.offX / 64;
|
||||||
glyph.offY = glyph.offY / 64;
|
glyph.offY = glyph.offY / 64;
|
||||||
}
|
}
|
||||||
var len = numGlyphs * 4 + imageBytes/4 + 3;
|
var len = numGlyphs * 4 + imageBytes / 4 + 3;
|
||||||
// TODO: check length, use bigReq
|
// TODO: check length, use bigReq
|
||||||
// X.pack_stream.pack('CCSLL', [ext.majorOpcode, 20, len, gsid, glyphs.length]);
|
// X.pack_stream.pack('CCSLL', [ext.majorOpcode, 20, len, gsid, glyphs.length]);
|
||||||
|
|
||||||
// BigReq: S + [ length ] replaced with SL + [ 0, length+1 ]
|
// BigReq: S + [ length ] replaced with SL + [ 0, length+1 ]
|
||||||
X.pack_stream.pack('CCSLLL', [ext.majorOpcode, 20, 0, len+1, gsid, glyphs.length]);
|
X.pack_stream.pack('CCSLLL', [ext.majorOpcode, 20, 0, len + 1, gsid, glyphs.length]);
|
||||||
|
|
||||||
// glyph ids
|
// glyph ids
|
||||||
for (i = 0; i < numGlyphs; i++) {
|
for (i = 0; i < numGlyphs; i++) {
|
||||||
|
|
@ -463,7 +468,14 @@ exports.requireExt = function(display, callback)
|
||||||
}
|
}
|
||||||
// width + heiht + origin xy + advance xy
|
// width + heiht + origin xy + advance xy
|
||||||
for (i = 0; i < numGlyphs; i++) {
|
for (i = 0; i < numGlyphs; i++) {
|
||||||
X.pack_stream.pack('SSssss', [glyphs[i].width, glyphs[i].height, -glyphs[i].x, glyphs[i].y, glyphs[i].offX, glyphs[i].offY]);
|
X.pack_stream.pack('SSssss', [
|
||||||
|
glyphs[i].width,
|
||||||
|
glyphs[i].height,
|
||||||
|
-glyphs[i].x,
|
||||||
|
glyphs[i].y,
|
||||||
|
glyphs[i].offX,
|
||||||
|
glyphs[i].offY
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
// image
|
// image
|
||||||
for (i = 0; i < numGlyphs; i++) {
|
for (i = 0; i < numGlyphs; i++) {
|
||||||
|
|
@ -471,12 +483,29 @@ exports.requireExt = function(display, callback)
|
||||||
}
|
}
|
||||||
X.pack_stream.flush();
|
X.pack_stream.flush();
|
||||||
X.seq_num++;
|
X.seq_num++;
|
||||||
}
|
};
|
||||||
|
|
||||||
//AddGlyphsFromPicture, opcode=21 (not in spec)
|
// As far as I know this is not implemented in any X server and always retuen "Bad implementation"
|
||||||
// FreeGlyps - opcode 22
|
// Also documentation looks misleading as it's not mention glyph ids.
|
||||||
// gsid(L) , glyphs.length (L) + each glyph id (L)
|
ext.AddGlyphsFromPicture = function(gsid, src, glyphs) {
|
||||||
//
|
var len = 3 + glyphs.length * 5;
|
||||||
|
X.pack_stream.pack('CCSLLL', [ext.majorOpcode, 21, 0, len + 1, gsid, src]);
|
||||||
|
for (i = 0; i < glyphs.length; i++) {
|
||||||
|
X.pack_stream.pack('L', [glyphs[i].id]);
|
||||||
|
}
|
||||||
|
for (i = 0; i < glyphs.length; i++) {
|
||||||
|
X.pack_stream.pack('SSssssss', [
|
||||||
|
glyphs[i].width,
|
||||||
|
glyphs[i].height,
|
||||||
|
-glyphs[i].x,
|
||||||
|
glyphs[i].y,
|
||||||
|
glyphs[i].offX,
|
||||||
|
glyphs[i].offY,
|
||||||
|
glyphs[i].srcX,
|
||||||
|
glyphs[i].srcY
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// each GlyphEle:
|
// each GlyphEle:
|
||||||
// 1 byte - number of glyphs
|
// 1 byte - number of glyphs
|
||||||
|
|
@ -492,53 +521,160 @@ exports.requireExt = function(display, callback)
|
||||||
// glyphs as input:
|
// glyphs as input:
|
||||||
// [ "just string (0,0) offset is used", [ 10, 10, "string offseted 10,10 from previous pen position" ], 1234567 ] 1234567 is glypfset id or FONT
|
// [ "just string (0,0) offset is used", [ 10, 10, "string offseted 10,10 from previous pen position" ], 1234567 ] 1234567 is glypfset id or FONT
|
||||||
|
|
||||||
|
|
||||||
// TODO: pre-process input so strings larger than 254 chars are supported
|
// TODO: pre-process input so strings larger than 254 chars are supported
|
||||||
// (split them into multiple entries with 0,0 offset)
|
// (split them into multiple entries with 0,0 offset)
|
||||||
|
|
||||||
var formatFromBits = [,,,,,,,,'C',,,,,,,,'S',,,,,,,,,,,,,,,,'L'];
|
var formatFromBits = [
|
||||||
var bufferWriteBits = [,,,,,,,,'writeUInt8',,,,,,,,'writeUInt16LE',,,,,,,,,,,,,,,,'writeUInt32LE'];
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
'C',
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
'S',
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
'L'
|
||||||
|
];
|
||||||
|
var bufferWriteBits = [
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
'writeUInt8',
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
'writeUInt16LE',
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
'writeUInt32LE'
|
||||||
|
];
|
||||||
|
|
||||||
// 8/16/32 bit string + 4-byte pad
|
// 8/16/32 bit string + 4-byte pad
|
||||||
function wstring(bits, s) {
|
function wstring(bits, s) {
|
||||||
var charLength = bits / 8;
|
var charLength = bits / 8;
|
||||||
var dataLength = s.length*charLength;
|
var dataLength = s.length * charLength;
|
||||||
var res = Buffer.alloc(xutil.padded_length(dataLength));
|
var res = Buffer.alloc(xutil.padded_length(dataLength));
|
||||||
debugger;
|
debugger;
|
||||||
var write = res[bufferWriteBits[bits]]
|
var write = res[bufferWriteBits[bits]];
|
||||||
res.fill(0);
|
res.fill(0);
|
||||||
for(var i=0; i < s.length; i++)
|
for (var i = 0; i < s.length; i++) write.call(res, s.charCodeAt(i), i * charLength);
|
||||||
write.call(res, s.charCodeAt(i), i*charLength);
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
var compositeGlyphsOpcodeFromBits = [,,,,,,,,23,,,,,,,,24,,,,,,,,,,,,,,,,25];
|
var compositeGlyphsOpcodeFromBits = [
|
||||||
ext.CompositeGlyphs = function(glyphBits, op, src, dst, maskFormat, gsid, srcX, srcY, glyphs)
|
,
|
||||||
{
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
23,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
24,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
,
|
||||||
|
25
|
||||||
|
];
|
||||||
|
ext.CompositeGlyphs = function(glyphBits, op, src, dst, maskFormat, gsid, srcX, srcY, glyphs) {
|
||||||
var opcode = compositeGlyphsOpcodeFromBits[glyphBits];
|
var opcode = compositeGlyphsOpcodeFromBits[glyphBits];
|
||||||
var charFormat = formatFromBits[glyphBits];
|
var charFormat = formatFromBits[glyphBits];
|
||||||
var charLength = glyphBits / 8;
|
var charLength = glyphBits / 8;
|
||||||
var length = 7;
|
var length = 7;
|
||||||
var glyphs_length_split = [];
|
var glyphs_length_split = [];
|
||||||
for (var i=0; i < glyphs.length; ++i) {
|
for (var i = 0; i < glyphs.length; ++i) {
|
||||||
var g = glyphs[i];
|
var g = glyphs[i];
|
||||||
switch (typeof g) {
|
switch (typeof g) {
|
||||||
case 'string':
|
case 'string':
|
||||||
length += xutil.padded_length(g.length*charLength)/4 + 2;
|
length += xutil.padded_length(g.length * charLength) / 4 + 2;
|
||||||
break;
|
break;
|
||||||
case 'object':
|
case 'object':
|
||||||
length += xutil.padded_length(g[2].length*charLength)/4 + 2;
|
length += xutil.padded_length(g[2].length * charLength) / 4 + 2;
|
||||||
break;
|
break;
|
||||||
case 'number': // glyphset id
|
case 'number': // glyphset id
|
||||||
length += 3;
|
length += 3;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
X.pack_stream.pack(
|
X.pack_stream.pack('CCSCxxxLLLLss', [
|
||||||
'CCSCxxxLLLLss',
|
ext.majorOpcode,
|
||||||
[ext.majorOpcode, opcode, length, op, src, dst, maskFormat, gsid, srcX, srcY]
|
opcode,
|
||||||
);
|
length,
|
||||||
for (var i=0; i < glyphs.length; ++i) {
|
op,
|
||||||
|
src,
|
||||||
|
dst,
|
||||||
|
maskFormat,
|
||||||
|
gsid,
|
||||||
|
srcX,
|
||||||
|
srcY
|
||||||
|
]);
|
||||||
|
for (var i = 0; i < glyphs.length; ++i) {
|
||||||
var g = glyphs[i];
|
var g = glyphs[i];
|
||||||
switch (typeof g) {
|
switch (typeof g) {
|
||||||
case 'string':
|
case 'string':
|
||||||
|
|
@ -556,18 +692,15 @@ exports.requireExt = function(display, callback)
|
||||||
X.seq_num++;
|
X.seq_num++;
|
||||||
};
|
};
|
||||||
|
|
||||||
ext.CompositeGlyphs8 = function(op, src, dst, maskFormat, gsid, srcX, srcY, glyphs)
|
ext.CompositeGlyphs8 = function(op, src, dst, maskFormat, gsid, srcX, srcY, glyphs) {
|
||||||
{
|
|
||||||
return ext.CompositeGlyphs(8, op, src, dst, maskFormat, gsid, srcX, srcY, glyphs);
|
return ext.CompositeGlyphs(8, op, src, dst, maskFormat, gsid, srcX, srcY, glyphs);
|
||||||
};
|
};
|
||||||
|
|
||||||
ext.CompositeGlyphs16 = function(op, src, dst, maskFormat, gsid, srcX, srcY, glyphs)
|
ext.CompositeGlyphs16 = function(op, src, dst, maskFormat, gsid, srcX, srcY, glyphs) {
|
||||||
{
|
|
||||||
return ext.CompositeGlyphs(16, op, src, dst, maskFormat, gsid, srcX, srcY, glyphs);
|
return ext.CompositeGlyphs(16, op, src, dst, maskFormat, gsid, srcX, srcY, glyphs);
|
||||||
};
|
};
|
||||||
|
|
||||||
ext.CompositeGlyphs32 = function(op, src, dst, maskFormat, gsid, srcX, srcY, glyphs)
|
ext.CompositeGlyphs32 = function(op, src, dst, maskFormat, gsid, srcX, srcY, glyphs) {
|
||||||
{
|
|
||||||
return ext.CompositeGlyphs(32, op, src, dst, maskFormat, gsid, srcX, srcY, glyphs);
|
return ext.CompositeGlyphs(32, op, src, dst, maskFormat, gsid, srcX, srcY, glyphs);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -590,32 +723,36 @@ exports.requireExt = function(display, callback)
|
||||||
// 11 - colormap or none
|
// 11 - colormap or none
|
||||||
|
|
||||||
ext.QueryPictFormat(function(err, formats) {
|
ext.QueryPictFormat(function(err, formats) {
|
||||||
if (err)
|
if (err) return callback(err);
|
||||||
return callback(err);
|
for (var i = 0; i < formats.formats.length; ++i) {
|
||||||
for (var i=0; i < formats.formats.length; ++i) {
|
|
||||||
var f = formats.formats[i];
|
var f = formats.formats[i];
|
||||||
if (f[2] == 1 && f[10] == 1)
|
if (f[2] == 1 && f[10] == 1) ext.mono1 = f[0];
|
||||||
ext.mono1 = f[0] ;
|
if (f[2] == 24 && f[3] == 16 && f[5] == 8 && f[7] == 0) ext.rgb24 = f[0];
|
||||||
if (f[2] == 24 && f[3] == 16 && f[5] == 8 && f[7] == 0)
|
|
||||||
ext.rgb24 = f[0];
|
|
||||||
// 1, 32, 16, 255, 8, 255, 0, 255, 24, 255, 0
|
// 1, 32, 16, 255, 8, 255, 0, 255, 24, 255, 0
|
||||||
if (f[2] == 32 && f[3] == 16 && f[4] == 255 && f[5] == 8 && f[6] == 255 && f[7] == 0 && f[9] == 24)
|
if (
|
||||||
ext.rgba32 = f[0] ;
|
f[2] == 32 &&
|
||||||
if (f[2] == 8 && f[10] == 255)
|
f[3] == 16 &&
|
||||||
ext.a8 = f[0];
|
f[4] == 255 &&
|
||||||
|
f[5] == 8 &&
|
||||||
|
f[6] == 255 &&
|
||||||
|
f[7] == 0 &&
|
||||||
|
f[9] == 24
|
||||||
|
)
|
||||||
|
ext.rgba32 = f[0];
|
||||||
|
if (f[2] == 8 && f[10] == 255) ext.a8 = f[0];
|
||||||
}
|
}
|
||||||
callback(null, ext);
|
callback(null, ext);
|
||||||
});
|
});
|
||||||
|
|
||||||
[
|
[
|
||||||
"PICTFORMAT argument does not name a defined PICTFORMAT",
|
'PICTFORMAT argument does not name a defined PICTFORMAT',
|
||||||
"PICTURE argument does not name a defined PICTURE",
|
'PICTURE argument does not name a defined PICTURE',
|
||||||
"PICTOP argument does not name a defined PICTOP",
|
'PICTOP argument does not name a defined PICTOP',
|
||||||
"GLYPHSET argument does not name a defined GLYPHSET",
|
'GLYPHSET argument does not name a defined GLYPHSET',
|
||||||
"GLYPH argument does not name a defined GLYPH in the glyphset"
|
'GLYPH argument does not name a defined GLYPH in the glyphset'
|
||||||
].forEach(function(desc, code) {
|
].forEach(function(desc, code) {
|
||||||
X.errorParsers[ext.firstError + code] = function(err) {
|
X.errorParsers[ext.firstError + code] = function(err) {
|
||||||
err.message = "XRender: a value for a " + desc;
|
err.message = 'XRender: a value for a ' + desc;
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -673,23 +810,23 @@ exports.requireExt = function(display, callback)
|
||||||
/*,
|
/*,
|
||||||
* Operators only available in version 0.11,
|
* Operators only available in version 0.11,
|
||||||
*/
|
*/
|
||||||
BlendMinimum : 0x30,
|
BlendMinimum: 0x30,
|
||||||
Multiply : 0x30,
|
Multiply: 0x30,
|
||||||
Screen : 0x31,
|
Screen: 0x31,
|
||||||
Overlay : 0x32,
|
Overlay: 0x32,
|
||||||
Darken : 0x33,
|
Darken: 0x33,
|
||||||
Lighten : 0x34,
|
Lighten: 0x34,
|
||||||
ColorDodge : 0x35,
|
ColorDodge: 0x35,
|
||||||
ColorBurn : 0x36,
|
ColorBurn: 0x36,
|
||||||
HardLight : 0x37,
|
HardLight: 0x37,
|
||||||
SoftLight : 0x38,
|
SoftLight: 0x38,
|
||||||
Difference : 0x39,
|
Difference: 0x39,
|
||||||
Exclusion : 0x3a,
|
Exclusion: 0x3a,
|
||||||
HSLHue : 0x3b,
|
HSLHue: 0x3b,
|
||||||
HSLSaturation: 0x3c,
|
HSLSaturation: 0x3c,
|
||||||
HSLColor : 0x3d,
|
HSLColor: 0x3d,
|
||||||
HSLLuminosity: 0x3e,
|
HSLLuminosity: 0x3e,
|
||||||
BlendMaximum : 0x3e
|
BlendMaximum: 0x3e
|
||||||
};
|
};
|
||||||
|
|
||||||
ext.PolyEdge = {
|
ext.PolyEdge = {
|
||||||
|
|
@ -713,9 +850,9 @@ exports.requireExt = function(display, callback)
|
||||||
Unknown: 0,
|
Unknown: 0,
|
||||||
HorizontalRGB: 1,
|
HorizontalRGB: 1,
|
||||||
HorizontalBGR: 2,
|
HorizontalBGR: 2,
|
||||||
VerticalRGB : 3,
|
VerticalRGB: 3,
|
||||||
VerticalBGR : 4,
|
VerticalBGR: 4,
|
||||||
None : 5
|
None: 5
|
||||||
};
|
};
|
||||||
|
|
||||||
ext.Filters = {
|
ext.Filters = {
|
||||||
|
|
@ -727,4 +864,4 @@ exports.requireExt = function(display, callback)
|
||||||
Best: 'best'
|
Best: 'best'
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue