add CreateSolidFill request

This commit is contained in:
Andrey Sidorov 2014-03-29 23:52:51 +11:00
parent f0d25c325e
commit 5b4bcbbe92

View file

@ -183,6 +183,13 @@ exports.requireExt = function(display, callback)
X.pack_stream.flush();
}
ext.CreateSolidFill = function(pid, r, g, b, a)
{
X.seq_num++;
X.pack_stream.pack('CCSLSSSS', [ext.majorOpcode, 33, 4, pid, floatToFix(r), floatToFix(g), floatToFix(b), floatToFix(a)]);
X.pack_stream.flush();
}
ext.RadialGradient = function(pid, p1, p2, r1, r2, stops)
{
// TODO: merge with linear gradient
@ -369,10 +376,14 @@ exports.requireExt = function(display, callback)
X.seq_num++;
var numGlyphs = glyphs.length;
var imageBytes = 0;
for (var i = 0; i < numGlyphs; i++)
//imageBytes += glyphs[i].image.length;
imageBytes += xutil.padded_length(glyphs[i].image.length);
//var paddedLength = xutil.padded_length(imageBytes);
var glyphPaddedLength;
var glyphLength;
for (var i = 0; i < numGlyphs; i++) {
glyphLength = glyphs[i].image.length;
if (glyphLength % 4 !== 0)
throw new Error('Glyph image length must be divisible by 4!');
imageBytes += glyphLength;
}
console.log(imageBytes);
var len = numGlyphs * 4 + imageBytes/4 + 3;
// TODO: check length, use bigReq
@ -384,10 +395,11 @@ exports.requireExt = function(display, callback)
//X.pack_stream.pack('CCSLLL', [ext.majorOpcode, 20, 0, len+1, gsid, glyphs.length]);
//console.log('CCSLLL', [ext.majorOpcode, 20, 0, len+1, gsid, glyphs.length]);
debugger;
for (i = 0; i < numGlyphs; i++) {
var id = glyphs[i].id;
console.log('============= added glyph ', id, String.fromCharCode(id));
X.pack_stream.pack('L', id);
X.pack_stream.pack('L', [id]);
}
for (i = 0; i < numGlyphs; i++)
{
@ -484,6 +496,7 @@ exports.requireExt = function(display, callback)
// 11 - colormap or none
ext.QueryPictFormat(function(err, formats) {
console.log(formats);
for (var i=0; i < formats.formats.length; ++i) {
var f = formats.formats[i];
if (f[2] == 1 && f[10] == 1)