From 0b00c965fda150deda2b7aace676f0c10fb1e5a7 Mon Sep 17 00:00:00 2001 From: sidorares Date: Mon, 8 Aug 2011 17:31:55 +1000 Subject: [PATCH] initial PictureFilter support --- test/render-simplest.pl | 2 ++ test/render.js | 26 +++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/test/render-simplest.pl b/test/render-simplest.pl index 85f3c95..31e1fca 100644 --- a/test/render-simplest.pl +++ b/test/render-simplest.pl @@ -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]); } diff --git a/test/render.js b/test/render.js index a4c7a20..6830881 100644 --- a/test/render.js +++ b/test/render.js @@ -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);