mirror of
https://github.com/danbulant/node-x11
synced 2026-05-19 04:18:35 +00:00
fix formatting; fix binomial filter params check; set format beforehand for SetPictureTransform
This commit is contained in:
parent
21cc95a8bb
commit
4a3f3f6075
1 changed files with 19 additions and 20 deletions
|
|
@ -170,12 +170,11 @@ exports.requireExt = function(display, callback)
|
|||
}
|
||||
|
||||
ext.SetPictureTransform = function(pid, matrix) {
|
||||
var format = 'CCSL';
|
||||
var format = 'CCSLLLLLLLLLLLLL';
|
||||
if (matrix.length !== 9)
|
||||
throw 'Render.SetPictureTransform: incorrect transform matrix. Must be array of 9 numbers';
|
||||
var params = [ext.majorOpcode, 28, 11, pid];
|
||||
for (var i=0; i < 9; ++i) {
|
||||
format += 'L';
|
||||
if (typeof matrix[i] !== 'number')
|
||||
throw 'Render.SetPictureTransform: matrix element must be a number';
|
||||
params.push(floatToFix(matrix[i]));
|
||||
|
|
@ -201,7 +200,7 @@ exports.requireExt = function(display, callback)
|
|||
reqLen += xutil.padded_length(name.length+3)/4 + filterParams.length;
|
||||
|
||||
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';
|
||||
}
|
||||
} else if (name == 'convolution') {
|
||||
|
|
@ -213,7 +212,7 @@ exports.requireExt = function(display, callback)
|
|||
params.push(floatToFix(filterParams[i]));
|
||||
}
|
||||
} else if (name == 'binomial' || name == 'gaussian') {
|
||||
if (filterParams.length < 2) {
|
||||
if (filterParams.length !== 1) {
|
||||
throw 'Render.SetPictureFilter: "' + name + '" - incorrect number of parameters, must be exactly 1 number, instead got: ' + filterParams;
|
||||
}
|
||||
format += 'L';
|
||||
|
|
@ -674,23 +673,23 @@ exports.requireExt = function(display, callback)
|
|||
/*,
|
||||
* Operators only available in version 0.11,
|
||||
*/
|
||||
BlendMinimum: 0x30,
|
||||
Multiply: 0x30,
|
||||
Screen: 0x31,
|
||||
Overlay: 0x32,
|
||||
Darken: 0x33,
|
||||
Lighten: 0x34,
|
||||
ColorDodge: 0x35,
|
||||
ColorBurn: 0x36,
|
||||
HardLight: 0x37,
|
||||
SoftLight: 0x38,
|
||||
Difference: 0x39,
|
||||
Exclusion: 0x3a,
|
||||
HSLHue: 0x3b,
|
||||
BlendMinimum : 0x30,
|
||||
Multiply : 0x30,
|
||||
Screen : 0x31,
|
||||
Overlay : 0x32,
|
||||
Darken : 0x33,
|
||||
Lighten : 0x34,
|
||||
ColorDodge : 0x35,
|
||||
ColorBurn : 0x36,
|
||||
HardLight : 0x37,
|
||||
SoftLight : 0x38,
|
||||
Difference : 0x39,
|
||||
Exclusion : 0x3a,
|
||||
HSLHue : 0x3b,
|
||||
HSLSaturation: 0x3c,
|
||||
HSLColor: 0x3d,
|
||||
HSLColor : 0x3d,
|
||||
HSLLuminosity: 0x3e,
|
||||
BlendMaximum: 0x3e
|
||||
BlendMaximum : 0x3e
|
||||
};
|
||||
|
||||
ext.PolyEdge = {
|
||||
|
|
@ -714,7 +713,7 @@ exports.requireExt = function(display, callback)
|
|||
Unknown: 0,
|
||||
HorizontalRGB: 1,
|
||||
HorizontalBGR: 2,
|
||||
VerticalRGB : 3,
|
||||
VerticalRGB : 3,
|
||||
VerticalBGR : 4,
|
||||
None : 5
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue