initial PictureFilter support

This commit is contained in:
sidorares 2011-08-08 17:31:55 +10:00
parent 1a7929ee9f
commit 0b00c965fd
2 changed files with 27 additions and 1 deletions

View file

@ -31,6 +31,8 @@ $X->event_handler('queue');
sub draw {
$X->RenderFillRectangles('Src', $picture, [(0xffff)x4], [0, 0, 500, 500]);
$X->RenderSetPictureFilter($pix_pict, "nearest");
$X->RenderTriangles('Over', $pix_pict, 500, 500, $picture, 0, [(250, 100), (100, 350), (400, 350), (175, 100), (185, 100), (180, 0)]);
#$X->RenderFillRectangles('Src', $picture, [(0xffff, 0, 0, 0xffff)], [10, 10, 50, 50]);
}

View file

@ -135,6 +135,30 @@ x11.createClient(
return parseInt(f*65536);
}
// see example of blur filter here: https://github.com/richoH/rxvt-unicode/blob/master/src/background.C
// TODO: not ready yet.
function RenderSetPictureFilter(pid, name, filterParams)
{
X.seq_num++;
var reqLen = 2; //header + params + 1xStopfix+2xColors
var format = 'CCSLa';
var params = [ext.majorOpcode, 30, reqLen, pid];
/*
if (name == 'convolution')
{
reqLen += 2;
format += 'L';
params.push(floatToFix(filterParams));
} else {
throw 'Not implemented filter ' + name;
}
*/
params[2] = reqLen;
console.log([format, params]);
X.pack_stream.pack(format, params);
X.pack_stream.flush();
}
function RenderRadialGradient(pid, p1, p2, r1, r2, stops)
{
// TODO: merge with linear gradient
@ -372,7 +396,7 @@ x11.createClient(
//RenderTriangles(3, pic_grad, 0, 0, picture, 0, [0, 500, 500, 500, 500, 0]);
//RenderTrapezoids(3, pic_grad, 0, 0, picture, 0, [100, 500, 240, 0, 0, 500, 500, 500, 260, 0]);
//RenderTrapezoids(3, pic_grad, 0, 0, picture, 0, [0, 500, 0, 0, 0, 500, 500, 500, 500, 0]);
//RenderSetPictureFilter(pix_pict, 'convolution', [3, 3, 0, 0, 0, 0, 9, 0, 0, 0, 0]);
RenderComposite(3, pix_pict, 0, picture, 0, 0, 0, 0, 0, 0, 500, 500);
//RenderComposite(3, pic_grad, 0, picture, 0, 0, 0, 0, 0, 0, 500, 500);